[Android] Set video player margins for TV overscan
Geoffrey Métais
git at videolan.org
Sun Jan 24 11:25:58 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Sun Jan 24 11:25:21 2016 +0100| [82ee58f928643db42b71af25f006e3fcae87fdb5] | committer: Geoffrey Métais
Set video player margins for TV overscan
> https://code.videolan.org/videolan/vlc-android/commit/82ee58f928643db42b71af25f006e3fcae87fdb5
---
vlc-android/res/layout-v16/player_action_bar.xml | 1 -
vlc-android/res/layout/player.xml | 4 +---
vlc-android/res/values/dimens.xml | 4 ++--
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 15 +++++++++++++++
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/vlc-android/res/layout-v16/player_action_bar.xml b/vlc-android/res/layout-v16/player_action_bar.xml
index df53986..e56b033 100644
--- a/vlc-android/res/layout-v16/player_action_bar.xml
+++ b/vlc-android/res/layout-v16/player_action_bar.xml
@@ -9,7 +9,6 @@
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/playlist_toggle"
android:gravity="center_horizontal"
- android:layout_marginTop="@dimen/tv_overscan_vertical"
android:layout_gravity="top"
android:background="?attr/status_bar_overlay"
android:text="@string/title"
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 266891b..c2c114c 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -37,11 +37,9 @@
</FrameLayout>
<RelativeLayout
+ android:id="@+id/player_ui_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginBottom="@dimen/tv_overscan_vertical"
- android:layout_marginLeft="@dimen/tv_overscan_horizontal"
- android:layout_marginRight="@dimen/tv_overscan_horizontal"
android:fitsSystemWindows="true" >
<include
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index 20a6547..1d31e71 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -26,8 +26,8 @@
<dimen name="media_ctrl_margin_top">20dp</dimen>
- <dimen name="tv_overscan_vertical">0dp</dimen>
- <dimen name="tv_overscan_horizontal">0dp</dimen>
+ <dimen name="tv_overscan_vertical">27dp</dimen>
+ <dimen name="tv_overscan_horizontal">48dp</dimen>
<!-- Adv options -->
<dimen name="option_width">64dp</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 d34600f..c547740 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -486,6 +486,21 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mOverlayTips.bringToFront();
mOverlayTips.invalidate();
}
+
+ //Set margins for TV overscan
+ if (VLCApplication.showTvUi()) {
+ int hm = getResources().getDimensionPixelSize(R.dimen.tv_overscan_horizontal);
+ int vm = getResources().getDimensionPixelSize(R.dimen.tv_overscan_vertical);
+
+ RelativeLayout uiContainer = (RelativeLayout) findViewById(R.id.player_ui_container);
+ RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) uiContainer.getLayoutParams();
+ lp.setMargins(hm, 0, hm, vm);
+ uiContainer.setLayoutParams(lp);
+
+ lp = (RelativeLayout.LayoutParams) mTitle.getLayoutParams();
+ lp.setMargins(0, vm, 0, 0);
+ mTitle.setLayoutParams(lp);
+ }
} else
setRequestedOrientation(getScreenOrientation());
More information about the Android
mailing list