[Android] Force LTR to fix VerticalSeekBar background problem with RTL layout

habib kazemi git at videolan.org
Fri Jun 16 11:25:04 CEST 2017


vlc-android | branch: master | habib kazemi <kazemihabib1996 at gmail.com> | Fri Jun 16 01:18:12 2017 +0430| [696b472feef3c08c57d53cd339d9a1e84e471b8a] | committer: Geoffrey Métais

Force LTR to fix VerticalSeekBar background problem with RTL layout

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

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

 vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.java b/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.java
index 0ec66a66c..c1a96a8d8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.java
+++ b/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.java
@@ -20,7 +20,9 @@
 
 package org.videolan.vlc.gui.view;
 
+import android.annotation.TargetApi;
 import android.content.Context;
+import android.os.Build;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.widget.LinearLayout;
@@ -28,6 +30,7 @@ import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
 import android.widget.TextView;
 
+import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.vlc.R;
 import org.videolan.vlc.interfaces.OnEqualizerBarChangeListener;
 
@@ -51,10 +54,15 @@ public class EqualizerBar extends LinearLayout {
         init(context, 0);
     }
 
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
     private void init(Context context, float band) {
         LayoutInflater.from(context).inflate(R.layout.equalizer_bar, this, true);
 
         mSeek = (VerticalSeekBar) findViewById(R.id.equalizer_seek);
+        //Force LTR to fix VerticalSeekBar background problem with RTL layout
+        if (AndroidUtil.isJellyBeanMR1OrLater){
+            mSeek.setLayoutDirection(LAYOUT_DIRECTION_LTR);
+        }
         mSeek.setMax(2 * RANGE);
         mSeek.setProgress(RANGE);
         mSeek.setOnSeekBarChangeListener(mSeekListener);



More information about the Android mailing list