[Android] Fix RTL for the video player

Nicolas Pomepuy git at videolan.org
Fri Nov 22 13:53:24 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 13 15:03:04 2024 +0100| [14b00506deb3d3917c8a165bb885b4cae09746b2] | committer: Nicolas Pomepuy

Fix RTL for the video player

Fixes #3103

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

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

diff --git a/application/vlc-android/res/layout/player_hud.xml b/application/vlc-android/res/layout/player_hud.xml
index a902c7e2ab..e45dfee2b9 100644
--- a/application/vlc-android/res/layout/player_hud.xml
+++ b/application/vlc-android/res/layout/player_hud.xml
@@ -193,14 +193,15 @@
                 android:clickable="true"
                 android:focusable="true"
                 android:importantForAccessibility="no"
+                android:gravity="left"
                 android:nextFocusUp="@+id/ab_repeat_add_marker"
                 android:onClick="@{(v) -> player.toggleTimeDisplay()}"
                 android:text="@{Tools.millisToString(progress.time)}"
                 tools:text="0:32"
                 vlc:layout_constraintBottom_toTopOf="@+id/player_overlay_seekbar"
-                vlc:layout_constraintEnd_toStartOf="@+id/player_overlay_length"
+                vlc:layout_constraintRight_toLeftOf="@+id/player_overlay_length"
                 vlc:layout_constraintHorizontal_chainStyle="spread"
-                vlc:layout_constraintStart_toStartOf="parent" />
+                vlc:layout_constraintLeft_toLeftOf="parent" />
 
 
         <org.videolan.vlc.gui.view.FocusableTextView
@@ -217,8 +218,8 @@
                 android:onClick="@{(v) -> player.toggleTimeDisplay()}"
                 tools:text="56:37"
                 vlc:layout_constraintBottom_toTopOf="@+id/player_overlay_seekbar"
-                vlc:layout_constraintEnd_toEndOf="parent"
-                vlc:layout_constraintStart_toEndOf="@+id/player_overlay_time"
+                vlc:layout_constraintRight_toRightOf="parent"
+                vlc:layout_constraintLeft_toRightOf="@+id/player_overlay_time"
                 vlc:length="@{progress.length}"
                 vlc:time="@{progress.time}" />
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 8884ede5a0..af3ce5635b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1937,8 +1937,8 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
         when (v.id) {
             R.id.orientation_toggle -> toggleOrientationLock()
             R.id.playlist_toggle -> overlayDelegate.togglePlaylist()
-            R.id.player_overlay_forward -> touchDelegate.seekDelta(Settings.videoJumpDelay * 1000)
-            R.id.player_overlay_rewind -> touchDelegate.seekDelta(-Settings.videoJumpDelay * 1000)
+            R.id.player_overlay_forward -> touchDelegate.seekDelta(if (LocaleUtil.isRtl()) -Settings.videoJumpDelay * 1000  else Settings.videoJumpDelay * 1000)
+            R.id.player_overlay_rewind -> touchDelegate.seekDelta(if (LocaleUtil.isRtl()) Settings.videoJumpDelay * 1000  else -Settings.videoJumpDelay * 1000)
             R.id.ab_repeat_add_marker -> service?.playlistManager?.setABRepeatValue(
                 service?.playlistManager?.getCurrentMedia(), overlayDelegate.hudBinding.playerOverlaySeekbar.progress.toLong())
             R.id.ab_repeat_reset -> service?.playlistManager?.resetABRepeatValues(service?.playlistManager?.getCurrentMedia())
@@ -1988,11 +1988,11 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
                 return true
             }
             R.id.player_overlay_forward -> {
-                touchDelegate.seekDelta(Settings.videoLongJumpDelay * 1000)
+                touchDelegate.seekDelta(if (LocaleUtil.isRtl()) -Settings.videoLongJumpDelay * 1000  else Settings.videoLongJumpDelay * 1000)
                 return true
             }
             R.id.player_overlay_rewind -> {
-                touchDelegate.seekDelta(-Settings.videoLongJumpDelay * 1000)
+                touchDelegate.seekDelta(if (LocaleUtil.isRtl()) Settings.videoLongJumpDelay * 1000  else -Settings.videoLongJumpDelay * 1000)
                 return true
             }
         }



More information about the Android mailing list