Commit 9ec507e5 authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Nicolas Pomepuy
Browse files

Set search in groups & folders providers

parent f24bb43d
Pipeline #16576 passed with stage
in 33 minutes and 27 seconds
......@@ -30,8 +30,12 @@ import org.videolan.vlc.viewmodels.SortableModel
class FoldersProvider(context: Context, model: SortableModel, val type: Int) : MedialibraryProvider<Folder>(context, model) {
override fun getAll() : Array<Folder> = medialibrary.getFolders(type, sort, desc, getTotalCount(), 0)
override fun getTotalCount() = medialibrary.getFoldersCount(type)
override fun getTotalCount() = if (model.filterQuery.isNullOrEmpty()) medialibrary.getFoldersCount(type) else medialibrary.getFoldersCount(model.filterQuery)
override fun getPage(loadSize: Int, startposition: Int) : Array<Folder> = medialibrary.getFolders(type, sort, desc, loadSize, startposition).also { completeHeaders(it, startposition) }
override fun getPage(loadSize: Int, startposition: Int) : Array<Folder> = if (model.filterQuery.isNullOrEmpty()) {
medialibrary.getFolders(type, sort, desc, loadSize, startposition).also { completeHeaders(it, startposition) }
} else {
medialibrary.searchFolders(model.filterQuery, sort, desc, loadSize, startposition)
}
}
\ No newline at end of file
......@@ -10,10 +10,13 @@ import org.videolan.vlc.viewmodels.SortableModel
class VideoGroupsProvider(context: Context, model: SortableModel) : MedialibraryProvider<MediaLibraryItem>(context, model) {
override fun getAll() : Array<MediaLibraryItem> = medialibrary.getVideoGroups(sort, desc, getTotalCount(), 0).extractSingles()
override fun getTotalCount() = if (model.filterQuery == null) medialibrary.videoGroupsCount
else medialibrary.videoGroupsCount
override fun getTotalCount() = medialibrary.getVideoGroupsCount(model.filterQuery)
override fun getPage(loadSize: Int, startposition: Int) : Array<MediaLibraryItem> = medialibrary.getVideoGroups(sort, desc, loadSize, startposition).extractSingles().also { completeHeaders(it, startposition) }
override fun getPage(loadSize: Int, startposition: Int) : Array<MediaLibraryItem> = if (model.filterQuery.isNullOrEmpty()) {
medialibrary.getVideoGroups(sort, desc, loadSize, startposition)
} else {
medialibrary.searchVideoGroups(model.filterQuery, sort, desc, loadSize, startposition)
}.extractSingles().also { completeHeaders(it, startposition) }
}
private fun Array<VideoGroup>.extractSingles() = map {
......
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