[Android] Add sort by release year for tracks
Geoffrey Métais
git at videolan.org
Tue Sep 24 16:29:28 CEST 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Sep 23 14:49:29 2019 +0200| [da54d1a42b0fe313c982ccabecc5e70e61ee4a27] | committer: Geoffrey Métais
Add sort by release year for tracks
(cherry picked from commit 256e9cde0aab7d8771f4dbccf111c28f8c7b3b52)
> https://code.videolan.org/videolan/vlc-android/commit/da54d1a42b0fe313c982ccabecc5e70e61ee4a27
---
.../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 7479edbd5..8f4812d0a 100644
--- a/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/medialibrary/TracksProvider.kt
@@ -36,6 +36,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
init {
sort = Settings.getInstance(context).getInt(sortKey, AbstractMedialibrary.SORT_DEFAULT)
diff --git a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
index 98239f470..f4bef2c49 100644
--- a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
+++ b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
@@ -212,8 +212,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