[Android] Fix videoplayer controls visibility on RTL devices
Geoffrey Métais
git at videolan.org
Thu Feb 15 10:53:32 CET 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 15 10:52:33 2018 +0100| [350d5a6df816dc0e628561821766174c33f1bee2] | committer: Geoffrey Métais
Fix videoplayer controls visibility on RTL devices
(cherry picked from commit f31e7c3658e5b73de0117ca5e41907886a8160fe)
> https://code.videolan.org/videolan/vlc-android/commit/350d5a6df816dc0e628561821766174c33f1bee2
---
vlc-android/res/layout/player_hud.xml | 6 ++++--
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 15 ++++++++-------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 27aec9d6b..427552dde 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:vlc="http://schemas.android.com/apk/res-auto">
+ xmlns:vlc="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="org.videolan.medialibrary.Tools" />
<variable
@@ -20,7 +21,8 @@
android:background="@drawable/rounded_corners"
android:paddingTop="@dimen/overlay_padding_top"
android:paddingBottom="@dimen/overlay_padding_bottom"
- android:visibility="invisible" >
+ android:visibility="invisible"
+ tools:visibility="visible" >
<SeekBar
android:id="@+id/player_overlay_seekbar"
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 81169f275..6be6c9a5b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -33,7 +33,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.databinding.BindingAdapter;
@@ -620,17 +619,19 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
public void resetHudLayout() {
if (mHudBinding == null) return;
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)mHudBinding.playerOverlayButtons.getLayoutParams();
- int orientation = getScreenOrientation(100);
- boolean portrait = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
+ final int orientation = getScreenOrientation(100);
+ final boolean portrait = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
+ final int endOf = AndroidUtil.isHoneycombMr1OrLater ? RelativeLayout.END_OF : RelativeLayout.RIGHT_OF;
+ final int startOf = AndroidUtil.isHoneycombMr1OrLater ? RelativeLayout.START_OF : RelativeLayout.LEFT_OF;
if (portrait) {
layoutParams.addRule(RelativeLayout.BELOW, R.id.player_overlay_length);
- layoutParams.addRule(RelativeLayout.RIGHT_OF, 0);
- layoutParams.addRule(RelativeLayout.LEFT_OF, 0);
+ layoutParams.addRule(endOf, 0);
+ layoutParams.addRule(startOf, 0);
} else {
layoutParams.addRule(RelativeLayout.BELOW, R.id.player_overlay_seekbar);
- layoutParams.addRule(RelativeLayout.RIGHT_OF, R.id.player_overlay_time);
- layoutParams.addRule(RelativeLayout.LEFT_OF, R.id.player_overlay_length);
+ layoutParams.addRule(endOf, R.id.player_overlay_time);
+ layoutParams.addRule(startOf, R.id.player_overlay_length);
}
mHudBinding.playerOverlayButtons.setLayoutParams(layoutParams);
}
More information about the Android
mailing list