[Android] Add margins to video player seekbar

Nicolas Pomepuy git at videolan.org
Fri Jul 31 09:24:37 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jul 31 09:20:34 2020 +0200| [0e2431b68000c94834010635c0f23ac55bd4ecc7] | committer: Nicolas Pomepuy

Add margins to video player seekbar

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

 application/vlc-android/res/layout/player_hud.xml                 | 5 +++--
 .../src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt  | 8 ++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/res/layout/player_hud.xml b/application/vlc-android/res/layout/player_hud.xml
index ade8a30d6..f8318b34b 100644
--- a/application/vlc-android/res/layout/player_hud.xml
+++ b/application/vlc-android/res/layout/player_hud.xml
@@ -229,6 +229,7 @@
                         vlc:time="@{progress.time}" />
             </FrameLayout>
 
+<!--           ⚠️ margin are set in code!!!-->
             <SeekBar
                     android:id="@+id/player_overlay_seekbar"
                     android:layout_width="0dp"
@@ -305,9 +306,9 @@
                     android:contentDescription="@string/tracks"
                     android:focusable="true"
                     android:onClick="@{player::onAudioSubClick}"
+                    android:padding="4dp"
                     android:scaleType="center"
                     tools:visibility="visible"
-                    android:padding="4dp"
                     vlc:layout_constraintBottom_toBottomOf="@+id/player_overlay_play"
                     vlc:layout_constraintEnd_toStartOf="@+id/orientation_toggle"
                     vlc:layout_constraintHorizontal_chainStyle="spread_inside"
@@ -481,9 +482,9 @@
                     android:contentDescription="@string/advanced"
                     android:focusable="true"
                     android:onClick="@{(v) -> player.showAdvancedOptions()}"
+                    android:padding="4dp"
                     android:scaleType="center"
                     tools:visibility="visible"
-                    android:padding="4dp"
                     vlc:layout_constraintBottom_toBottomOf="@+id/player_overlay_play"
                     vlc:layout_constraintEnd_toEndOf="parent"
                     vlc:layout_constraintStart_toEndOf="@+id/player_resize"
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 ea7f4ac95..30ccd9da2 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
@@ -514,8 +514,8 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
 
     fun updateHudMargins() {
         //here, we override the default Android overscan
-        val overscanHorizontal = if (player.isTv) 32.dp else 0
-        val overscanVertical = if (player.isTv) player.resources.getDimension(R.dimen.tv_overscan_vertical).toInt() else 0
+        val overscanHorizontal = if (player.isTv) 32.dp else 8.dp
+        val overscanVertical = if (player.isTv) player.resources.getDimension(R.dimen.tv_overscan_vertical).toInt() else 8.dp
         if (::hudBinding.isInitialized) {
             val largeMargin = player.resources.getDimension(R.dimen.large_margins_center)
             val smallMargin = player.resources.getDimension(R.dimen.small_margins_sides)
@@ -539,9 +539,13 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
             if (player.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
                 hudBinding.playerSpaceLeft.setGone()
                 hudBinding.playerSpaceRight.setGone()
+                applyMargin(hudBinding.playerOverlaySeekbar, 0, true)
+                applyMargin(hudBinding.playerOverlaySeekbar, 0, false)
             } else {
                 hudBinding.playerSpaceLeft.setVisible()
                 hudBinding.playerSpaceRight.setVisible()
+                applyMargin(hudBinding.playerOverlaySeekbar, 20.dp, true)
+                applyMargin(hudBinding.playerOverlaySeekbar, 20.dp, false)
             }
         }
         if (::hudRightBinding.isInitialized) {



More information about the Android mailing list