[Android] Set players progress bar LTR

Geoffrey Métais git at videolan.org
Tue Dec 18 11:02:25 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 17 16:47:41 2018 +0100| [ac3a824a1af80c336160b24826a1c2947ae04d53] | committer: Geoffrey Métais

Set players progress bar LTR

Fix #690

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

 vlc-android/res/layout-land/audio_player.xml                       | 1 +
 vlc-android/res/layout/audio_player.xml                            | 1 +
 vlc-android/res/layout/player_hud.xml                              | 1 +
 vlc-android/res/layout/tv_audio_player.xml                         | 1 +
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        | 3 +--
 vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt   | 7 +++----
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/vlc-android/res/layout-land/audio_player.xml b/vlc-android/res/layout-land/audio_player.xml
index 19c57dac0..c2d1f50f4 100644
--- a/vlc-android/res/layout-land/audio_player.xml
+++ b/vlc-android/res/layout-land/audio_player.xml
@@ -39,6 +39,7 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintTop_toTopOf="parent"
+            android:layoutDirection="ltr"
             android:focusable="false"
             android:indeterminate="false"
             android:maxHeight="1dip"
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index bb8af28be..b04d8fa56 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -39,6 +39,7 @@
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toTopOf="parent"
+            android:layoutDirection="ltr"
             android:focusable="false"
             android:indeterminate="false"
             android:maxHeight="1dip"
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index de78391d7..e4bfc50f8 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -31,6 +31,7 @@
         android:paddingRight="@dimen/time_margin_sides"
         android:paddingTop="4dp"
         android:paddingBottom="4dp"
+        android:layoutDirection="ltr"
         android:layout_alignParentTop="true"
         android:progressDrawable="@drawable/po_seekbar"
         android:thumb="@drawable/seekbar_thumb"
diff --git a/vlc-android/res/layout/tv_audio_player.xml b/vlc-android/res/layout/tv_audio_player.xml
index f9500c04e..df9e87fe9 100644
--- a/vlc-android/res/layout/tv_audio_player.xml
+++ b/vlc-android/res/layout/tv_audio_player.xml
@@ -79,6 +79,7 @@
             app:layout_constraintTop_toBottomOf="@+id/media_artist"
             app:layout_constraintRight_toLeftOf="@+id/media_length"
             app:layout_constraintBottom_toTopOf="@+id/button_play"
+            android:layoutDirection="ltr"
             android:progress="@{(int)progress.time}"
             android:max="@{(int)progress.length}"
             android:focusable="true"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d97f9e983..58b512fa5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -384,13 +384,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
         } else touch = 0;
         mCurrentScreenOrientation = getResources().getConfiguration().orientation;
         if (touch != 0) {
-            boolean isRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
             final DisplayMetrics dm = new DisplayMetrics();
             getWindowManager().getDefaultDisplay().getMetrics(dm);
             int yRange = Math.min(dm.widthPixels, dm.heightPixels);
             int xRange = Math.max(dm.widthPixels, dm.heightPixels);
             final ScreenConfig sc = new ScreenConfig(dm, xRange, yRange, mCurrentScreenOrientation);
-            mTouchDelegate = new VideoTouchDelegate(this, touch, sc, isRtl, mIsTv);
+            mTouchDelegate = new VideoTouchDelegate(this, touch, sc, mIsTv);
         }
         UiTools.setRotationAnimation(this);
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
index 498078c64..869b74c3e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
@@ -30,7 +30,6 @@ private const val JOYSTICK_INPUT_DELAY = 300
 class VideoTouchDelegate(private val player: VideoPlayerActivity,
                          private val mTouchControls : Int,
                          var screenConfig : ScreenConfig,
-                         private val rtl: Boolean,
                          private val tv : Boolean) {
 
     private var mTouchAction = TOUCH_NONE
@@ -132,7 +131,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
                                 doVerticalTouchAction(yChanged)
                             } else if (mInitTouchX < screenConfig.metrics.widthPixels * 0.95) {
                                 // Seek (Right or Left move)
-                                doSeekTouch(Math.round(deltaY), if (rtl) -xgesturesize else xgesturesize, false)
+                                doSeekTouch(Math.round(deltaY), xgesturesize, false)
                             }
                         } else {
                             mTouchY = event.rawY
@@ -148,7 +147,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
                         // Mouse events for the core
                         player.sendMouseEvent(MotionEvent.ACTION_UP, xTouch, yTouch)
                         // Seek
-                        if (mTouchAction == TOUCH_SEEK) doSeekTouch(Math.round(deltaY), if (rtl) -xgesturesize else xgesturesize, true)
+                        if (mTouchAction == TOUCH_SEEK) doSeekTouch(Math.round(deltaY), xgesturesize, true)
                         mTouchX = -1f
                         mTouchY = -1f
                     }
@@ -214,7 +213,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
         val brightness = mTouchControls and TOUCH_FLAG_BRIGHTNESS != 0
         if (!audio && !brightness)
             return
-        if (rightAction xor rtl) {
+        if (rightAction) {
             if (audio) doVolumeTouch(y_changed)
             else doBrightnessTouch(y_changed)
         } else {



More information about the Android mailing list