[Android] Fix Play controls overlay centering/fitssystem

Geoffrey Métais git at videolan.org
Fri Dec 19 19:02:08 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 19 19:00:43 2014 +0100| [2f3389806b1ead592547724e4823a6efa43e160b] | committer: Geoffrey Métais

Fix Play controls overlay centering/fitssystem

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=2f3389806b1ead592547724e4823a6efa43e160b
---

 vlc-android/res/layout/player_hud.xml                         |    1 -
 vlc-android/res/values-sw600dp/booleans.xml                   |    4 ----
 vlc-android/res/values/booleans.xml                           |    1 -
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java   |    9 +++++++++
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 94d5bd0..78cc39e 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -3,7 +3,6 @@
     android:id="@+id/progress_overlay"
     android:layout_width="800dp"
     android:layout_height="wrap_content"
-    android:layout_centerInParent="@bool/center_hud"
     android:layout_alignParentBottom="true"
     android:background="@drawable/rounded_corners"
     android:paddingTop="@dimen/overlay_padding_top"
diff --git a/vlc-android/res/values-sw600dp/booleans.xml b/vlc-android/res/values-sw600dp/booleans.xml
deleted file mode 100644
index bfb7ef7..0000000
--- a/vlc-android/res/values-sw600dp/booleans.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <bool name="center_hud">true</bool>
-</resources>
\ No newline at end of file
diff --git a/vlc-android/res/values/booleans.xml b/vlc-android/res/values/booleans.xml
index 8e55c8d..9d519cd 100644
--- a/vlc-android/res/values/booleans.xml
+++ b/vlc-android/res/values/booleans.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <bool name="list_mode">true</bool>
-    <bool name="center_hud">false</bool>
 </resources>
\ No newline at end of file
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 63736e2..932c47c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -122,6 +122,7 @@ import android.view.animation.DecelerateInterpolator;
 import android.view.animation.RotateAnimation;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
+import android.widget.RelativeLayout;
 import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
 import android.widget.TextView;
@@ -330,6 +331,14 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         mSysTime = (TextView) findViewById(R.id.player_overlay_systime);
         mBattery = (TextView) findViewById(R.id.player_overlay_battery);
         mOverlayProgress = findViewById(R.id.progress_overlay);
+        RelativeLayout.LayoutParams layoutParams =
+                (RelativeLayout.LayoutParams)mOverlayProgress.getLayoutParams();
+        if (AndroidDevices.isPhone() || !AndroidDevices.hasNavBar()) {
+            layoutParams.width = LayoutParams.MATCH_PARENT;
+        } else {
+            layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
+        }
+        mOverlayProgress.setLayoutParams(layoutParams);
         mOverlayBackground = findViewById(R.id.player_overlay_background);
 
         // Position and remaining time



More information about the Android mailing list