Commit c0f61130 authored by Geoffrey Métais's avatar Geoffrey Métais

Fix paged viewmodel getters return type

parent 2a46c8bf
...@@ -43,7 +43,7 @@ abstract class MLPagedModel<T : MediaLibraryItem>(context: Context) : SortableMo ...@@ -43,7 +43,7 @@ abstract class MLPagedModel<T : MediaLibraryItem>(context: Context) : SortableMo
abstract fun getTotalCount() : Int abstract fun getTotalCount() : Int
abstract fun getPage(loadSize: Int, startposition: Int) : Array<T> abstract fun getPage(loadSize: Int, startposition: Int) : Array<T>
abstract fun getAll() : Array<T>? abstract fun getAll() : Array<T>
override fun sort(sort: Int) { override fun sort(sort: Int) {
if (this.sort != sort) { if (this.sort != sort) {
......
...@@ -28,7 +28,7 @@ class PagedAlbumsModel(context: Context, val parent: MediaLibraryItem? = null) : ...@@ -28,7 +28,7 @@ class PagedAlbumsModel(context: Context, val parent: MediaLibraryItem? = null) :
refresh() refresh()
} }
override fun getAll() = when (parent) { override fun getAll() : Array<Album> = when (parent) {
is Artist -> parent.getAlbums(sort, desc) is Artist -> parent.getAlbums(sort, desc)
is Genre -> parent.getAlbums(sort, desc) is Genre -> parent.getAlbums(sort, desc)
else -> medialibrary.getAlbums(sort, desc) else -> medialibrary.getAlbums(sort, desc)
......
...@@ -24,7 +24,7 @@ class PagedArtistsModel(context: Context, private var showAll: Boolean = false): ...@@ -24,7 +24,7 @@ class PagedArtistsModel(context: Context, private var showAll: Boolean = false):
showAll = show 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> { override fun getPage(loadSize: Int, startposition: Int): Array<Artist> {
return if (filter == null) medialibrary.getPagedArtists(showAll, sort, desc, loadSize, startposition) return if (filter == null) medialibrary.getPagedArtists(showAll, sort, desc, loadSize, startposition)
......
...@@ -25,10 +25,12 @@ class PagedGenresModel(context: Context): MLPagedModel<Genre>(context), Medialib ...@@ -25,10 +25,12 @@ class PagedGenresModel(context: Context): MLPagedModel<Genre>(context), Medialib
medialibrary.removeGenreCb(this) 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) override fun getPage(loadSize: Int, startposition: Int) : Array<Genre> {
else medialibrary.searchGenre(filter, sort, desc, loadSize, startposition) 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) override fun getTotalCount() = if (filter == null) medialibrary.genresCount else medialibrary.getGenresCount(filter)
......
...@@ -20,10 +20,12 @@ class PagedPlaylistsModel(context: Context): MLPagedModel<Playlist>(context), Me ...@@ -20,10 +20,12 @@ class PagedPlaylistsModel(context: Context): MLPagedModel<Playlist>(context), Me
override fun canSortByDuration() = true 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) override fun getPage(loadSize: Int, startposition: Int) : Array<Playlist> {
else medialibrary.searchPlaylist(filter, sort, desc, loadSize, startposition) 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) override fun getTotalCount() = if (filter == null) medialibrary.playlistsCount else medialibrary.getPlaylistsCount(filter)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment