[Android] Video player play queue: improve visibilities on tablet/TV

Nicolas Pomepuy git at videolan.org
Fri Oct 20 12:01:31 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Oct  9 10:21:51 2023 +0200| [89e140d12859f1f418141e37395ef077ed6c3056] | committer: Duncan McNamara

Video player play queue: improve visibilities on tablet/TV

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

 application/vlc-android/res/menu/video_playqueue_item.xml           | 6 +++---
 .../vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt   | 3 ++-
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt           | 4 ++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/res/menu/video_playqueue_item.xml b/application/vlc-android/res/menu/video_playqueue_item.xml
index 1d5a277f8f..e4ac0a0464 100644
--- a/application/vlc-android/res/menu/video_playqueue_item.xml
+++ b/application/vlc-android/res/menu/video_playqueue_item.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:id="@+id/audio_player_mini_remove"
-        android:title="@string/remove" />
     <group android:id="@+id/phone_only" >
+        <item
+                android:id="@+id/audio_player_mini_remove"
+                android:title="@string/remove" />
         <item
             android:id="@+id/audio_player_set_song"
             android:title="@string/set_song"/>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
index 1f3d2bbe14..aad390d303 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
@@ -43,6 +43,7 @@ import androidx.lifecycle.Lifecycle
 import androidx.recyclerview.widget.RecyclerView
 import org.videolan.libvlc.util.AndroidUtil
 import org.videolan.medialibrary.interfaces.media.MediaWrapper
+import org.videolan.resources.AndroidDevices
 import org.videolan.resources.AppContextProvider
 import org.videolan.tools.Settings
 import org.videolan.tools.setGone
@@ -141,7 +142,7 @@ class PlaylistAdapter(private val player: IPlayer) : DiffUtilAdapter<MediaWrappe
             holder.binding.cover = defaultCoverAudio
         }
 
-        val tablet = holder.binding.itemDelete.context.isTablet()
+        val tablet = holder.binding.itemDelete.context.isTablet() || AndroidDevices.isTv
         if (tablet) holder.binding.itemDelete.setVisible() else holder.binding.itemDelete.setGone()
         if (tablet) holder.binding.itemMoveDown.setVisible() else holder.binding.itemMoveDown.setGone()
         if (tablet) holder.binding.itemMoveUp.setVisible() else holder.binding.itemMoveUp.setGone()
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index e3dd8b66ed..656baad64e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -105,6 +105,7 @@ import org.videolan.vlc.gui.dialogs.RenderersDialog
 import org.videolan.vlc.gui.dialogs.SleepTimerDialog
 import org.videolan.vlc.gui.dialogs.adapters.VlcTrack
 import org.videolan.vlc.gui.helpers.*
+import org.videolan.vlc.gui.helpers.UiTools.isTablet
 import org.videolan.vlc.gui.helpers.UiTools.showPinIfNeeded
 import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate
 import org.videolan.vlc.interfaces.IPlaybackSettingsController
@@ -1729,6 +1730,9 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
         if (position == service?.playlistManager?.stopAfter) {
             popupMenu.menu.findItem(R.id.stop_after).isChecked = true
         }
+        if (isTablet() || AndroidDevices.isTv) {
+            popupMenu.menu.removeGroup(R.id.phone_only)
+        }
 
         popupMenu.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { curentItem ->
             when (curentItem.itemId) {



More information about the Android mailing list