[Android] Fix video player control icon alignments

Nicolas Pomepuy git at videolan.org
Tue Sep 7 07:36:37 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Sep  3 08:57:19 2021 +0200| [2f0dc4c4b42a6ccd75bf720763cab19f5a67cef0] | committer: Nicolas Pomepuy

Fix video player control icon alignments

Fixes #2158

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

 application/vlc-android/res/layout/player_hud.xml   |  4 +---
 .../vlc/gui/video/VideoPlayerOverlayDelegate.kt     | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/application/vlc-android/res/layout/player_hud.xml b/application/vlc-android/res/layout/player_hud.xml
index 416263ab7..5141130ff 100644
--- a/application/vlc-android/res/layout/player_hud.xml
+++ b/application/vlc-android/res/layout/player_hud.xml
@@ -345,10 +345,9 @@
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_vertical"
                     android:layout_marginStart="@dimen/small_margins_sides"
-                    android:layout_marginEnd="8dp"
                     android:background="?attr/selectableItemBackgroundBorderless"
                     android:focusable="true"
-                    android:visibility="invisible"
+                    android:visibility="visible"
                     tools:visibility="visible"
                     vlc:layout_constraintBottom_toBottomOf="@+id/player_overlay_play"
                     vlc:layout_constraintEnd_toStartOf="@+id/player_space_left"
@@ -473,7 +472,6 @@
                     android:id="@+id/player_resize"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="8dp"
                     android:layout_marginEnd="@dimen/small_margins_sides"
                     android:background="?attr/selectableItemBackgroundBorderless"
                     android:clickable="true"
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 60edc63da..673963565 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
@@ -575,14 +575,9 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
         if (::hudBinding.isInitialized) {
             val largeMargin = player.resources.getDimension(R.dimen.large_margins_center)
             val smallMargin = player.resources.getDimension(R.dimen.small_margins_sides)
-            applyMargin(hudBinding.playlistPrevious, largeMargin.toInt(), true)
-            applyMargin(hudBinding.playerOverlayRewind, largeMargin.toInt(), true)
-            applyMargin(hudBinding.playlistNext, largeMargin.toInt(), false)
-            applyMargin(hudBinding.playerOverlayForward, largeMargin.toInt(), false)
+
 
             applyMargin(hudBinding.playerOverlayTracks, if (!player.isTv) smallMargin.toInt() else overscanHorizontal, false)
-            applyMargin(hudBinding.orientationToggle, smallMargin.toInt(), false)
-            applyMargin(hudBinding.playerResize, smallMargin.toInt(), true)
             applyMargin(hudBinding.playerOverlayAdvFunction, if (!player.isTv) smallMargin.toInt() else overscanHorizontal, true)
 
             hudBinding.playerOverlaySeekbar.setPadding(overscanHorizontal, 0, overscanHorizontal, 0)
@@ -598,11 +593,25 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
                 hudBinding.playerSpaceRight.setGone()
                 applyMargin(hudBinding.playerOverlaySeekbar, 0, true)
                 applyMargin(hudBinding.playerOverlaySeekbar, 0, false)
+
+                applyMargin(hudBinding.playlistPrevious, 0, true)
+                applyMargin(hudBinding.playerOverlayRewind, 0, true)
+                applyMargin(hudBinding.playlistNext, 0, false)
+                applyMargin(hudBinding.playerOverlayForward, 0, false)
+                applyMargin(hudBinding.orientationToggle, 0, false)
+                applyMargin(hudBinding.playerResize, 0, true)
             } else {
                 hudBinding.playerSpaceLeft.setVisible()
                 hudBinding.playerSpaceRight.setVisible()
                 applyMargin(hudBinding.playerOverlaySeekbar, 20.dp, true)
                 applyMargin(hudBinding.playerOverlaySeekbar, 20.dp, false)
+
+                applyMargin(hudBinding.playlistPrevious, largeMargin.toInt(), true)
+                applyMargin(hudBinding.playerOverlayRewind, largeMargin.toInt(), true)
+                applyMargin(hudBinding.playlistNext, largeMargin.toInt(), false)
+                applyMargin(hudBinding.playerOverlayForward, largeMargin.toInt(), false)
+                applyMargin(hudBinding.orientationToggle, smallMargin.toInt(), false)
+                applyMargin(hudBinding.playerResize, smallMargin.toInt(), true)
             }
         }
         if (::hudRightBinding.isInitialized) {



More information about the Android mailing list