[Android] Switch back to video now triggered by long tap on cover

Nicolas Pomepuy git at videolan.org
Tue Feb 8 14:39:35 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb  8 09:03:26 2022 +0100| [72c8c99e845b1a2d0f774fe75d5f72147b0a39d3] | committer: Nicolas Pomepuy

Switch back to video now triggered by long tap on cover

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

 .../src/main/res/drawable/ic_playasaudio_off.xml      |  4 ++--
 application/resources/src/main/res/values/attrs.xml   |  1 -
 .../vlc-android/res/layout-land/audio_player.xml      | 16 ----------------
 application/vlc-android/res/layout/audio_player.xml   | 19 ++-----------------
 application/vlc-android/res/values/styles.xml         |  2 --
 .../src/org/videolan/vlc/gui/audio/AudioPlayer.kt     | 12 +++++++-----
 6 files changed, 11 insertions(+), 43 deletions(-)

diff --git a/application/resources/src/main/res/drawable/ic_playasaudio_off.xml b/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
index 47927a0c8..727646d26 100644
--- a/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
+++ b/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
@@ -1,7 +1,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
-    android:width="48dp"
-    android:height="48dp"
+    android:width="32dp"
+    android:height="32dp"
     android:viewportWidth="48"
     android:viewportHeight="48">
   <path
diff --git a/application/resources/src/main/res/values/attrs.xml b/application/resources/src/main/res/values/attrs.xml
index 03ad8d794..301e62f08 100644
--- a/application/resources/src/main/res/values/attrs.xml
+++ b/application/resources/src/main/res/values/attrs.xml
@@ -84,7 +84,6 @@
     <attr name="progress_mini_player" format="reference" />
 
     <!--Advance Options Icons-->
-    <attr name="ic_playasaudio_off" format="reference" />
     <attr name="ic_playasaudio_on" format="reference" />
     <attr name="ic_passthrough" format="reference" />
     <attr name="player_icon_color" format="reference" />
diff --git a/application/vlc-android/res/layout-land/audio_player.xml b/application/vlc-android/res/layout-land/audio_player.xml
index cfc54ade7..53a71d581 100644
--- a/application/vlc-android/res/layout-land/audio_player.xml
+++ b/application/vlc-android/res/layout-land/audio_player.xml
@@ -232,22 +232,6 @@
                     app:layout_constraintLeft_toLeftOf="parent"
                     app:layout_constraintRight_toRightOf="parent" />
 
-            <ImageView
-                    android:id="@+id/playlist_playasaudio_off"
-                    android:layout_width="32dp"
-                    android:layout_height="32dp"
-                    android:layout_marginStart="@dimen/default_margin"
-                    android:layout_marginEnd="@dimen/half_default_margin"
-                    android:contentDescription="@string/play_as_audio"
-                    android:focusable="true"
-                    android:onClick="@{fragment::onResumeToVideoClick}"
-                    android:scaleType="fitXY"
-                    android:visibility="gone"
-                    app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:srcCompat="?attr/ic_playasaudio_off"
-                    tools:visibility="visible" />
 
             <org.videolan.vlc.gui.view.HeaderMediaSwitcher
                     android:id="@+id/audio_media_switcher"
diff --git a/application/vlc-android/res/layout/audio_player.xml b/application/vlc-android/res/layout/audio_player.xml
index 3466c5da5..ad74c3b7d 100644
--- a/application/vlc-android/res/layout/audio_player.xml
+++ b/application/vlc-android/res/layout/audio_player.xml
@@ -217,21 +217,6 @@
                     app:layout_constraintLeft_toLeftOf="parent"
                     app:layout_constraintRight_toRightOf="parent" />
 
-            <ImageView
-                    android:id="@+id/playlist_playasaudio_off"
-                    android:layout_width="32dp"
-                    android:layout_height="32dp"
-                    android:layout_marginStart="@dimen/default_margin"
-                    android:contentDescription="@string/play_as_audio"
-                    android:focusable="true"
-                    android:onClick="@{fragment::onResumeToVideoClick}"
-                    android:scaleType="fitXY"
-                    android:visibility="gone"
-                    app:layout_constraintBottom_toBottomOf="@id/audio_media_switcher"
-                    app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="@id/audio_media_switcher"
-                    app:srcCompat="?attr/ic_playasaudio_off"
-                    tools:visibility="visible" />
 
             <org.videolan.vlc.gui.view.HeaderMediaSwitcher
                     android:id="@+id/audio_media_switcher"
@@ -239,7 +224,7 @@
                     android:layout_height="68dp"
                     android:background="#00000000"
                     app:layout_constraintEnd_toStartOf="@+id/barrier"
-                    app:layout_constraintStart_toEndOf="@+id/playlist_playasaudio_off"
+                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
             <com.google.android.material.textfield.TextInputLayout
@@ -255,7 +240,7 @@
                     android:visibility="gone"
                     app:layout_constraintBottom_toBottomOf="@id/guideline_header_bottom"
                     app:layout_constraintEnd_toEndOf="@+id/header_play_pause"
-                    app:layout_constraintStart_toEndOf="@+id/playlist_playasaudio_off"
+                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent">
 
                 <EditText
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 3b119f997..fd98122e9 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -76,7 +76,6 @@
         <item name="gridview_progressbar">@drawable/gridview_progressbar</item>
         <item name="progress_mini_player">@drawable/progress_mini_player</item>
         <item name="advanced_options_bg">@drawable/advanced_options_background_light</item>
-        <item name="ic_playasaudio_off">@drawable/ic_playasaudio_off</item>
         <item name="ic_playasaudio_on">@drawable/ic_playasaudio_on</item>
         <item name="ic_tips_double_tap">@drawable/tips_double_tap_500</item>
         <item name="ic_tips_tap">@drawable/tips_tap_500</item>
@@ -223,7 +222,6 @@
         <item name="gridview_progressbar">@drawable/gridview_progressbar_w</item>
         <item name="progress_mini_player">@drawable/progress_mini_player_black</item>
         <item name="advanced_options_bg">@drawable/advanced_options_background_dark</item>
-        <item name="ic_playasaudio_off">@drawable/ic_playasaudio_off</item>
         <item name="ic_playasaudio_on">@drawable/ic_playasaudio_on</item>
         <item name="ic_tips_double_tap">@drawable/tips_double_tap</item>
         <item name="ic_tips_tap">@drawable/tips_tap</item>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 4c95b1b2c..20b559186 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -302,7 +302,6 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
 
     private suspend fun doUpdate() {
         if (isVisible && playlistModel.switchToVideo()) return
-        binding.playlistPlayasaudioOff.visibility = if (playlistModel.videoTrackCount > 0) View.VISIBLE else View.GONE
         updatePlayPause()
         updateShuffleMode()
         updateRepeatMode()
@@ -540,9 +539,9 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
         updateShuffleMode()
     }
 
-    fun onResumeToVideoClick(v: View) {
+    fun onResumeToVideoClick() {
         playlistModel.currentMediaWrapper?.let {
-            if (PlaybackService.hasRenderer()) VideoPlayerActivity.startOpened(v.context,
+            if (PlaybackService.hasRenderer()) VideoPlayerActivity.startOpened(requireActivity(),
                     it.uri, playlistModel.currentMediaPosition)
             else if (hasMedia()) {
                 it.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO)
@@ -754,8 +753,11 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
         override fun onTouchLongClick() {
             val trackInfo = playlistModel.title ?: return
 
-            requireActivity().copy("VLC - song name", trackInfo)
-            UiTools.snacker(requireActivity(), R.string.track_info_copied_to_clipboard)
+            if (playlistModel.videoTrackCount > 0) onResumeToVideoClick()
+            else {
+                requireActivity().copy("VLC - song name", trackInfo)
+                UiTools.snacker(requireActivity(), R.string.track_info_copied_to_clipboard)
+            }
         }
 
         override fun onTouchDown() {}



More information about the Android mailing list