[Android] Video player remote: multiple UI fixes and improvements

Nicolas Pomepuy git at videolan.org
Mon Jun 13 12:54:52 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jun  9 09:15:32 2022 +0200| [a0c846a4d3f4fee5f5d801aa34e3c18b4497d7c6] | committer: Duncan McNamara

Video player remote: multiple UI fixes and improvements

Fixes #2497
Fixes some overlays that were not shown and the hud disappearing
when they became visible. Use a FrameLayout instead of the RelativeLayout
to improve performance.

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

 .../res/layout/player_remote_control.xml           | 25 ++++++++++++----------
 .../videolan/vlc/gui/video/VideoDelayDelegate.kt   |  2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/application/vlc-android/res/layout/player_remote_control.xml b/application/vlc-android/res/layout/player_remote_control.xml
index cdf03d41f..fa3ab2971 100644
--- a/application/vlc-android/res/layout/player_remote_control.xml
+++ b/application/vlc-android/res/layout/player_remote_control.xml
@@ -21,7 +21,7 @@
             android:layout_height="match_parent"
             android:layout="@layout/player_tips" />
 
-    <RelativeLayout
+    <FrameLayout
             android:id="@+id/player_overlay_background"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
@@ -31,15 +31,14 @@
                 android:id="@+id/renderer_background_cone"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_centerInParent="true"
+                android:layout_gravity="center"
                 app:srcCompat="@drawable/ic_renderer_background_cone" />
 
         <androidx.appcompat.widget.ViewStubCompat
                 android:id="@+id/player_info_stub"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_above="@+id/progress_overlay"
-                android:layout_centerHorizontal="true"
+                android:layout_gravity="center"
                 android:layout_marginBottom="@dimen/default_margin"
                 android:layout="@layout/player_overlay_info" />
 
@@ -64,9 +63,7 @@
                 android:id="@+id/player_overlay_settings_stub"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_above="@+id/progress_overlay"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentRight="true"
+                android:layout_gravity="center"
                 android:layout_marginEnd="@dimen/default_margin"
                 android:layout_marginRight="@dimen/default_margin"
                 android:layout_marginBottom="@dimen/default_margin"
@@ -76,6 +73,7 @@
                 android:id="@+id/player_seek_stub"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
+                android:layout_gravity="center"
                 android:fitsSystemWindows="false"
                 android:layout="@layout/player_overlay_seek" />
 
@@ -83,8 +81,7 @@
                 android:id="@+id/player_hud_right_stub"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentEnd="true"
+                android:layout_gravity="top|end"
                 android:layout_marginLeft="@dimen/overlay_margin"
                 android:layout_marginTop="@dimen/overlay_margin"
                 android:layout_marginRight="@dimen/overlay_margin"
@@ -95,12 +92,18 @@
                 android:id="@+id/player_hud_stub"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:layout_alignParentBottom="true"
+                android:layout_gravity="bottom"
                 android:layout_marginLeft="@dimen/overlay_margin"
                 android:layout_marginRight="@dimen/overlay_margin"
                 android:layout_marginBottom="@dimen/overlay_margin"
                 android:layout="@layout/player_hud" />
-    </RelativeLayout>
+
+        <androidx.appcompat.widget.ViewStubCompat
+                android:id="@+id/player_resize_stub"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout="@layout/player_resize" />
+    </FrameLayout>
 
 
     <androidx.appcompat.widget.ViewStubCompat
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoDelayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoDelayDelegate.kt
index 3f7962f7c..26fb41f98 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoDelayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoDelayDelegate.kt
@@ -122,7 +122,7 @@ class VideoDelayDelegate(private val player: VideoPlayerActivity) : View.OnClick
         playbackSettingPlus.requestFocus()
         initPlaybackSettingInfo()
         if (playbackSetting == IPlaybackSettingsController.DelayState.AUDIO) delayApplyAll.setVisible() else delayApplyAll.setGone()
-        player.overlayDelegate.hideOverlay(fromUser = true, forceTalkback = true)
+        if (player.displayManager.isPrimary) player.overlayDelegate.hideOverlay(fromUser = true, forceTalkback = true)
     }
 
     /**



More information about the Android mailing list