[Android] VideoBrowser: add sort by insertion date

Duncan McNamara git at videolan.org
Mon May 15 12:09:54 UTC 2023


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu May 11 15:13:28 2023 +0200| [ab26475732c788602622018c13d31997ef4d395c] | committer: Nicolas Pomepuy

VideoBrowser: add sort by insertion date

This adds insertion date sort for videos when not grouped,
As groups can contains videos with different insertion dates

> https://code.videolan.org/videolan/vlc-android/commit/ab26475732c788602622018c13d31997ef4d395c
---

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt     | 2 +-
 .../src/org/videolan/vlc/providers/medialibrary/VideosProvider.kt       | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index debe275966..f31e1455dc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -174,7 +174,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
             }
             R.id.ml_menu_display_options -> {
                 //filter all sorts and keep only applicable ones
-                val sorts = arrayListOf(Medialibrary.SORT_ALPHA, Medialibrary.SORT_FILENAME, Medialibrary.SORT_ARTIST, Medialibrary.SORT_ALBUM, Medialibrary.SORT_DURATION, Medialibrary.SORT_RELEASEDATE, Medialibrary.SORT_LASTMODIFICATIONDATE, Medialibrary.SORT_FILESIZE, Medialibrary.NbMedia).filter {
+                val sorts = arrayListOf(Medialibrary.SORT_ALPHA, Medialibrary.SORT_FILENAME, Medialibrary.SORT_ARTIST, Medialibrary.SORT_ALBUM, Medialibrary.SORT_DURATION, Medialibrary.SORT_RELEASEDATE, Medialibrary.SORT_LASTMODIFICATIONDATE, Medialibrary.SORT_FILESIZE, Medialibrary.NbMedia, Medialibrary.SORT_INSERTIONDATE).filter {
                     viewModel.provider.canSortBy(it)
                 }
                 //Open the display settings Bottom sheet
diff --git a/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideosProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideosProvider.kt
index be7be41ba0..d46115c2c6 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideosProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/medialibrary/VideosProvider.kt
@@ -35,6 +35,7 @@ class VideosProvider(val folder : Folder?, val group: VideoGroup?, context: Cont
     override fun canSortByFileNameName() = true
     override fun canSortByDuration() = true
     override fun canSortByLastModified() = folder == null
+    override fun canSortByInsertionDate() = group == null
 
     override fun getTotalCount() = if (model.filterQuery == null) when {
         folder !== null -> folder.mediaCount(Folder.TYPE_FOLDER_VIDEO)



More information about the Android mailing list