[Android] Fix paged viewmodel getters return type

Geoffrey Métais git at videolan.org
Thu Sep 27 11:22:08 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 27 11:20:11 2018 +0200| [c0f61130156f6eccf410a5624b8aa22fd1f95c5b] | committer: Geoffrey Métais

Fix paged viewmodel getters return type

> https://code.videolan.org/videolan/vlc-android/commit/c0f61130156f6eccf410a5624b8aa22fd1f95c5b
---

 vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt | 2 +-
 .../src/org/videolan/vlc/viewmodels/paged/PagedAlbumsModel.kt     | 2 +-
 .../src/org/videolan/vlc/viewmodels/paged/PagedArtistsModel.kt    | 2 +-
 .../src/org/videolan/vlc/viewmodels/paged/PagedGenresModel.kt     | 8 +++++---
 .../src/org/videolan/vlc/viewmodels/paged/PagedPlaylistsModel.kt  | 8 +++++---
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
index ff97f7673..ef9446f9f 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
@@ -43,7 +43,7 @@ abstract class MLPagedModel<T : MediaLibraryItem>(context: Context) : SortableMo
 
     abstract fun getTotalCount() : Int
     abstract fun getPage(loadSize: Int, startposition: Int) : Array<T>
-    abstract fun getAll() : Array<T>?
+    abstract fun getAll() : Array<T>
 
     override fun sort(sort: Int) {
         if (this.sort != sort) {
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedAlbumsModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedAlbumsModel.kt
index ac62327b1..307e4227a 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedAlbumsModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedAlbumsModel.kt
@@ -28,7 +28,7 @@ class PagedAlbumsModel(context: Context, val parent: MediaLibraryItem? = null) :
         refresh()
     }
 
-    override fun getAll() = when (parent) {
+    override fun getAll() : Array<Album> = when (parent) {
         is Artist -> parent.getAlbums(sort, desc)
         is Genre -> parent.getAlbums(sort, desc)
         else -> medialibrary.getAlbums(sort, desc)
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedArtistsModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedArtistsModel.kt
index 2b22efe1a..7a92f6fec 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedArtistsModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedArtistsModel.kt
@@ -24,7 +24,7 @@ class PagedArtistsModel(context: Context, private var showAll: Boolean = false):
         showAll = show
     }
 
-    override fun getAll() = medialibrary.getArtists(showAll, sort, desc)
+    override fun getAll() : Array<Artist> = medialibrary.getArtists(showAll, sort, desc)
 
     override fun getPage(loadSize: Int, startposition: Int): Array<Artist> {
         return if (filter == null) medialibrary.getPagedArtists(showAll, sort, desc, loadSize, startposition)
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedGenresModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedGenresModel.kt
index 9c56440bb..00dec7ea5 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedGenresModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedGenresModel.kt
@@ -25,10 +25,12 @@ class PagedGenresModel(context: Context): MLPagedModel<Genre>(context), Medialib
         medialibrary.removeGenreCb(this)
     }
 
-    override fun getAll() = medialibrary.getGenres(sort, desc)
+    override fun getAll() : Array<Genre> = medialibrary.getGenres(sort, desc)
 
-    override fun getPage(loadSize: Int, startposition: Int) = if (filter == null) medialibrary.getPagedGenres(sort, desc, loadSize, startposition)
-    else medialibrary.searchGenre(filter, sort, desc, loadSize, startposition)
+    override fun getPage(loadSize: Int, startposition: Int) : Array<Genre> {
+        return if (filter == null) medialibrary.getPagedGenres(sort, desc, loadSize, startposition)
+        else medialibrary.searchGenre(filter, sort, desc, loadSize, startposition)
+    }
 
     override fun getTotalCount() = if (filter == null) medialibrary.genresCount else medialibrary.getGenresCount(filter)
 
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedPlaylistsModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedPlaylistsModel.kt
index 3187b4750..622c30b1b 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedPlaylistsModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/paged/PagedPlaylistsModel.kt
@@ -20,10 +20,12 @@ class PagedPlaylistsModel(context: Context): MLPagedModel<Playlist>(context), Me
 
     override fun canSortByDuration() = true
 
-    override fun getAll() = medialibrary.getPlaylists(sort, desc)
+    override fun getAll() : Array<Playlist> = medialibrary.getPlaylists(sort, desc)
 
-    override fun getPage(loadSize: Int, startposition: Int) = if (filter == null) medialibrary.getPagedPlaylists(sort, desc, loadSize, startposition)
-    else medialibrary.searchPlaylist(filter, sort, desc, loadSize, startposition)
+    override fun getPage(loadSize: Int, startposition: Int)  : Array<Playlist> {
+        return if (filter == null) medialibrary.getPagedPlaylists(sort, desc, loadSize, startposition)
+        else medialibrary.searchPlaylist(filter, sort, desc, loadSize, startposition)
+    }
 
     override fun getTotalCount() = if (filter == null) medialibrary.playlistsCount else medialibrary.getPlaylistsCount(filter)
 



More information about the Android mailing list