[Android] Use FrameLayout for player_ui_container

Andrew Churilo git at videolan.org
Tue May 24 06:25:15 UTC 2022


vlc-android | branch: master | Andrew Churilo <AndrewChuriloMinsk at gmail.com> | Tue May 24 08:49:51 2022 +0300| [d6c88bc300b4ec90e042f8e7fa19b3969ac9aab2] | committer: Andrew Churilo

Use FrameLayout for player_ui_container


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

 application/vlc-android/res/layout/player.xml      | 24 ++++++++--------------
 .../vlc/gui/video/VideoPlayerOverlayDelegate.kt    |  3 ++-
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/application/vlc-android/res/layout/player.xml b/application/vlc-android/res/layout/player.xml
index 64a22452f..3177c2b42 100644
--- a/application/vlc-android/res/layout/player.xml
+++ b/application/vlc-android/res/layout/player.xml
@@ -62,7 +62,7 @@
             android:background="@drawable/gradient_title_player"
             android:visibility="gone"/>
 
-    <RelativeLayout
+    <FrameLayout
             android:id="@+id/player_ui_container"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
@@ -78,8 +78,7 @@
                 android:id="@+id/player_overlay_loading"
                 android:layout_width="80dp"
                 android:layout_height="80dp"
-                android:layout_centerHorizontal="true"
-                android:layout_centerInParent="true"
+                android:layout_gravity="center"
                 android:visibility="invisible"
                 app:srcCompat="@drawable/ic_cone_o" />
 
@@ -87,7 +86,7 @@
                 android:id="@+id/player_info_stub"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_centerInParent="true"
+                android:layout_gravity="center"
                 android:layout_marginBottom="@dimen/default_margin"
                 android:layout="@layout/player_overlay_info" />
 
@@ -96,15 +95,13 @@
                 android:layout="@layout/player_overlay_settings"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
-                android:layout_alignParentRight="true"/>
+                android:layout_gravity="center_vertical|end"/>
 
         <androidx.appcompat.widget.ViewStubCompat
                 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="end"
                 android:layout="@layout/player_hud_right" />
 
         <androidx.appcompat.widget.ViewStubCompat
@@ -112,14 +109,13 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout="@layout/player_hud"
-                android:layout_alignParentBottom="true" />
+                android:layout_gravity="bottom" />
 
         <ImageView
                 android:id="@+id/hinge_go_left"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:layout_centerVertical="true"
+                android:layout_gravity="center_vertical"
                 android:clickable="true"
                 android:focusable="true"
                 android:visibility="gone"
@@ -130,15 +126,13 @@
                 android:id="@+id/hinge_go_right"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentRight="true"
-                android:layout_centerVertical="true"
+                android:layout_gravity="center_vertical|right"
                 android:clickable="true"
                 android:focusable="true"
                 android:visibility="gone"
                 android:foreground="?attr/selectableItemBackgroundBorderless"
                 app:srcCompat="@drawable/ic_arrow_right" />
-
-    </RelativeLayout>
+    </FrameLayout>
 
     <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 2f79f4635..9608ce066 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -32,6 +32,7 @@ import android.content.pm.ActivityInfo
 import android.content.res.Configuration
 import android.os.Build
 import android.view.View
+import android.view.ViewGroup
 import android.view.WindowManager
 import android.view.animation.AnimationUtils
 import android.widget.*
@@ -92,7 +93,7 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
     var info: TextView? = null
     var subinfo: TextView? = null
     var overlayInfo: View? = null
-    lateinit var playerUiContainer:RelativeLayout
+    lateinit var playerUiContainer: ViewGroup
 
     lateinit var hudBinding: PlayerHudBinding
     lateinit var hudRightBinding: PlayerHudRightBinding



More information about the Android mailing list