[Android] UI : smaller video player HUD
Alexandre Perraud
git at videolan.org
Tue Apr 28 17:31:20 CEST 2015
vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Tue Apr 28 17:22:15 2015 +0200| [055bbe270f67debcb723799bf0b38ee9c777da3f] | committer: Alexandre Perraud
UI : smaller video player HUD
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=055bbe270f67debcb723799bf0b38ee9c777da3f
---
NEWS | 1 +
vlc-android/res/layout/player_hud.xml | 7 +++++--
vlc-android/res/values/dimens.xml | 4 ++--
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 18 ++++++++++++++++++
4 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 32dd426..2a11486 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Application:
* Fix back button behavior on VideoPlayer
* Improve Material look, Ripple effect on Lollipop
* Activate the Audio Delay control
+ * Smaller Video Player HUD
* Fix crashes, focus
JNI:
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 7f27b04..482e669 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -19,8 +19,8 @@
android:minHeight="@dimen/seekbar_height"
android:paddingLeft="@dimen/time_margin_sides"
android:paddingRight="@dimen/time_margin_sides"
- android:paddingTop="5dp"
- android:paddingBottom="5dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
android:layout_alignParentTop="true"
android:progressDrawable="@drawable/po_seekbar"
android:thumb="@drawable/seekbar_thumb"
@@ -35,6 +35,7 @@
android:layout_alignLeft="@+id/player_overlay_seekbar"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/time_margin_sides"
+ android:text="00:00"
android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
android:textColor="@color/orange500"
android:textSize="16sp"/>
@@ -47,11 +48,13 @@
android:layout_alignParentRight="true"
android:layout_alignRight="@+id/player_overlay_seekbar"
android:layout_marginRight="@dimen/time_margin_sides"
+ android:text="00:00"
android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
android:textSize="16sp" />
<!-- Media control buttons -->
<LinearLayout
+ android:id="@+id/player_overlay_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/player_overlay_length"
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index bc5c8ba..34b4804 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -15,14 +15,14 @@
<dimen name="tab_layout_horizontal_padding">5dp</dimen>
<!-- Video Player -->
- <dimen name="overlay_padding_bottom">15dip</dimen>
+ <dimen name="overlay_padding_bottom">8dip</dimen>
<dimen name="overlay_padding_top">10dip</dimen>
<dimen name="overlay_padding_sides">5dp</dimen>
<dimen name="overlay_margin">2dp</dimen>
<dimen name="seekbar_height">2dip</dimen>
<dimen name="images_margin_sides">10dp</dimen>
- <dimen name="time_margin_sides">10dp</dimen>
+ <dimen name="time_margin_sides">12dp</dimen>
<dimen name="media_ctrl_margin_top">20dp</dimen>
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 fa139ef..ec47ad8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -180,6 +180,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay
private ActionBar mActionBar;
private View mOverlayProgress;
private View mOverlayBackground;
+ private View mOverlayButtons;
private static final int OVERLAY_TIMEOUT = 4000;
private static final int OVERLAY_INFINITE = -1;
private static final int FADE_OUT = 1;
@@ -401,6 +402,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay
}
mOverlayProgress.setLayoutParams(layoutParams);
mOverlayBackground = findViewById(R.id.player_overlay_background);
+ mOverlayButtons = findViewById(R.id.player_overlay_buttons);
// Position and remaining time
mTime = (TextView) findViewById(R.id.player_overlay_time);
@@ -511,6 +513,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay
} else
setRequestedOrientation(getScreenOrientation());
+ rearrangeVideoPlayerHud();
updateNavStatus();
mDetector = new GestureDetectorCompat(this, mGestureListener);
mDetector.setOnDoubleTapListener(this);
@@ -554,6 +557,21 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay
if (!LibVlcUtil.isHoneycombOrLater())
setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);
super.onConfigurationChanged(newConfig);
+ rearrangeVideoPlayerHud();
+ }
+
+ public void rearrangeVideoPlayerHud() {
+ RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)mOverlayButtons.getLayoutParams();
+ if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
+ layoutParams.addRule(RelativeLayout.BELOW, R.id.player_overlay_length);
+ layoutParams.addRule(RelativeLayout.RIGHT_OF, 0);
+ layoutParams.addRule(RelativeLayout.LEFT_OF, 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);
+ }
+ mOverlayButtons.setLayoutParams(layoutParams);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
More information about the Android
mailing list