[Android] Remove useless option items from the video grid and playlists

Nicolas Pomepuy git at videolan.org
Fri Nov 18 12:29:45 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Nov 17 08:14:51 2022 +0100| [47e7334d4c95f0ad9129a9e6c9d961bab2a21c40] | committer: Nicolas Pomepuy

Remove useless option items from the video grid and playlists

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

 .../vlc-android/res/menu/activity_option.xml       | 23 ----------------------
 .../src/org/videolan/vlc/gui/PlaylistFragment.kt   | 12 +----------
 .../videolan/vlc/gui/video/VideoGridFragment.kt    | 21 --------------------
 3 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/application/vlc-android/res/menu/activity_option.xml b/application/vlc-android/res/menu/activity_option.xml
index 7dd8793a34..3de11191fb 100644
--- a/application/vlc-android/res/menu/activity_option.xml
+++ b/application/vlc-android/res/menu/activity_option.xml
@@ -128,29 +128,6 @@
                     android:title="@string/sortby_media_number" />
         </menu>
     </item>
-    <item
-            android:orderInCategory="2"
-            android:title="@string/video_min_group_length_title"
-            android:id="@+id/ml_menu_video_group"
-            vlc:showAsAction="never"
-            android:visible="false">
-        <menu>
-            <item
-                    android:orderInCategory="2"
-                    android:id="@+id/video_min_group_length_name"
-                    android:title="@string/video_min_group_length_name" />
-            <item
-                    android:orderInCategory="2"
-                    android:id="@+id/video_min_group_length_folder"
-                    android:title="@string/video_min_group_length_folder" />
-            <item
-                    android:orderInCategory="2"
-                    android:id="@+id/video_min_group_length_disable"
-                    android:title="@string/video_min_group_length_disable" />
-
-
-        </menu>
-    </item>
     <item
             android:orderInCategory="3"
             android:title="@string/add_to_playlist"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
index e9009ab762..c9d4682f2b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
@@ -166,23 +166,13 @@ class PlaylistFragment : BaseAudioBrowser<PlaylistsViewModel>(), SwipeRefreshLay
     }
 
     override fun onPrepareOptionsMenu(menu: Menu) {
-        menu.findItem(R.id.ml_menu_display_grid).isVisible = !viewModel.providerInCard
-        menu.findItem(R.id.ml_menu_display_list).isVisible = viewModel.providerInCard
+        super.onPrepareOptionsMenu(menu)
         menu.findItem(R.id.ml_menu_sortby).isVisible = false
         menu.findItem(R.id.ml_menu_display_options).isVisible = true
-        super.onPrepareOptionsMenu(menu)
     }
 
     override fun onOptionsItemSelected(item: MenuItem): Boolean {
         return when (item.itemId) {
-            R.id.ml_menu_display_list, R.id.ml_menu_display_grid -> {
-                viewModel.providerInCard = item.itemId == R.id.ml_menu_display_grid
-                setupLayoutManager()
-                playlists.adapter = adapter
-                activity?.invalidateOptionsMenu()
-                Settings.getInstance(requireActivity()).putSingle(viewModel.displayModeKey, item.itemId == R.id.ml_menu_display_grid)
-                true
-            }
             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 {
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 a71ad3d0d4..f8a3266ee9 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
@@ -150,9 +150,6 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
     override fun onPrepareOptionsMenu(menu: Menu) {
         super.onPrepareOptionsMenu(menu)
         menu.findItem(R.id.ml_menu_last_playlist).isVisible = settings.contains(KEY_MEDIA_LAST_PLAYLIST)
-        menu.findItem(R.id.ml_menu_video_group).isVisible = viewModel.group == null && viewModel.folder == null
-        menu.findItem(R.id.ml_menu_display_grid).isVisible = false
-        menu.findItem(R.id.ml_menu_display_list).isVisible = false
         menu.findItem(R.id.rename_group).isVisible = viewModel.group != null
         menu.findItem(R.id.ungroup).isVisible = viewModel.group != null
         menu.findItem(R.id.ml_menu_sortby).isVisible = false
@@ -165,24 +162,6 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
             R.id.ml_menu_last_playlist -> {
                 MediaUtils.loadlastPlaylist(activity, PLAYLIST_TYPE_VIDEO)
             }
-            R.id.ml_menu_display_list, R.id.ml_menu_display_grid -> {
-                val displayInCards = settings.getBoolean(KEY_VIDEOS_CARDS, true)
-                settings.putSingle(KEY_VIDEOS_CARDS, !displayInCards)
-                updateViewMode()
-                activity?.invalidateOptionsMenu()
-            }
-            R.id.video_min_group_length_disable -> {
-                settings.putSingle(KEY_GROUP_VIDEOS, GROUP_VIDEOS_NONE)
-                changeGroupingType(VideoGroupingType.NONE)
-            }
-            R.id.video_min_group_length_folder -> {
-                settings.putSingle(KEY_GROUP_VIDEOS, GROUP_VIDEOS_FOLDER)
-                changeGroupingType(VideoGroupingType.FOLDER)
-            }
-            R.id.video_min_group_length_name -> {
-                settings.putSingle(KEY_GROUP_VIDEOS, GROUP_VIDEOS_NAME)
-                changeGroupingType(VideoGroupingType.NAME)
-            }
             R.id.rename_group -> {
                 viewModel.group?.let { renameGroup(it) }
             }



More information about the Android mailing list