[Android] Invert video player next and previous in RTL mode

Geoffrey Métais git at videolan.org
Wed Apr 20 17:33:44 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Apr 20 17:31:36 2016 +0200| [240d90554143ba8fa7180d924a512f648e3583be] | committer: Geoffrey Métais

Invert video player next and previous in RTL mode

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 29804f3..ef3b0c9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -130,6 +130,7 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.Callback,
         GestureDetector.OnDoubleTapListener, IPlaybackSettingsController,
@@ -713,7 +714,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             mMediaRouter.removeCallback(mMediaRouterCallback);
     }
 
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
     private void startPlayback() {
         /* start playback only when audio service and both surfaces are ready */
         if (mPlaybackStarted || mService == null)
@@ -763,7 +764,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             ItemTouchHelper.Callback callback =  new SwipeDragItemTouchHelperCallback(mPlaylistAdapter);
             ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
             touchHelper.attachToRecyclerView(mPlaylist);
+            if (AndroidUtil.isJellyBeanMR1OrLater() && TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
+                mPlaylistPrevious.setImageResource(R.drawable.ic_playlist_next_circle);
+                mPlaylistNext.setImageResource(R.drawable.ic_playlist_previous_circle);
+            }
         }
+
     }
 
     private void initUI() {



More information about the Android mailing list