[Android] Add sort by release year for tracks
Geoffrey Métais
git at videolan.org
Tue Sep 24 10:35:32 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Sep 23 14:49:29 2019 +0200| [256e9cde0aab7d8771f4dbccf111c28f8c7b3b52] | committer: Geoffrey Métais
Add sort by release year for tracks
> https://code.videolan.org/videolan/vlc-android/commit/256e9cde0aab7d8771f4dbccf111c28f8c7b3b52
---
.../src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt | 1 +
vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt b/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt
index 41e5a15e7..73b77b07e 100644
--- a/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt
@@ -37,6 +37,7 @@ class TracksProvider(val parent : MediaLibraryItem?, context: Context, scope: So
override fun canSortByDuration() = true
override fun canSortByAlbum() = parent !== null
override fun canSortByLastModified() = true
+ override fun canSortByReleaseDate() = true
override fun isByDisc(): Boolean {
return parent is Album
diff --git a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
index 68dada04c..9c4d52e15 100644
--- a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
+++ b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
@@ -222,8 +222,8 @@ object ModelsHelper {
}
private fun MediaLibraryItem.getYear() = when (itemType) {
- MediaLibraryItem.TYPE_ALBUM -> if ((this as AbstractAlbum).releaseYear == 0) "-" else releaseYear.toString()
- MediaLibraryItem.TYPE_MEDIA -> if ((this as AbstractMediaWrapper).date == null) "-" else date
+ MediaLibraryItem.TYPE_ALBUM -> if ((this as AbstractAlbum).releaseYear <= 0) "-" else releaseYear.toString()
+ MediaLibraryItem.TYPE_MEDIA -> if ((this as AbstractMediaWrapper).releaseYear <= 0) "-" else releaseYear.toString()
else -> "-"
}
More information about the Android
mailing list