[Android] Optimize videos grouping
Geoffrey Métais
git at videolan.org
Wed Apr 4 18:35:46 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 21 15:55:27 2018 +0100| [38a374eb3f91a59b265799ee37a10058d7edb4e2] | committer: Geoffrey Métais
Optimize videos grouping
> https://code.videolan.org/videolan/vlc-android/commit/38a374eb3f91a59b265799ee37a10058d7edb4e2
---
vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt b/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
index 401b3a030..e2aadb584 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/VideosProvider.kt
@@ -55,9 +55,10 @@ class VideosProvider(private val group: String?, private val minGroupLen: Int) :
val list = medialibrary.getVideos(sort, desc)
val displayList = mutableListOf<MediaWrapper>()
if (group !== null) {
+ val loGroup = group.toLowerCase()
for (item in list) {
- val title = item.title.substring(if (item.title.toLowerCase().startsWith("the")) 4 else 0)
- if (title.toLowerCase().startsWith(group.toLowerCase())) displayList.add(item)
+ val title = item.title.toLowerCase().let { if (it.startsWith("the")) it.substring(4) else it }
+ if (title.startsWith(loGroup)) displayList.add(item)
}
} else {
MediaGroup.group(list, minGroupLen).mapTo(displayList) { it.media }
More information about the Android
mailing list