[Android] Fix video player width on TV
Nicolas Pomepuy
git at videolan.org
Tue Jun 18 09:30:31 CEST 2019
vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jun 17 15:59:09 2019 +0200| [008a1f12c670775d2a465bc6c6193540210175c9] | committer: Geoffrey Métais
Fix video player width on TV
> https://code.videolan.org/videolan/vlc-android/commit/008a1f12c670775d2a465bc6c6193540210175c9
---
vlc-android/res/layout/player_hud.xml | 2 +-
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index b17c998f7..a30d02ef1 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -19,7 +19,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progress_overlay"
- android:layout_width="match_parent"
+ android:layout_width="800dp"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corners"
android:paddingTop="@dimen/overlay_padding_top"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 600cb91ee..d2c8219cf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -2180,9 +2180,12 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
hudBinding.player = this
hudBinding.progress = service.playlistManager.player.progress
hudBinding.lifecycleOwner = this
-// val layoutParams = hudBinding.progressOverlay.layoutParams as RelativeLayout.LayoutParams
-// layoutParams.width = LayoutParams.MATCH_PARENT
-// hudBinding.progressOverlay.layoutParams = layoutParams
+ val layoutParams = hudBinding.progressOverlay.layoutParams as RelativeLayout.LayoutParams
+ if (AndroidDevices.isPhone || !AndroidDevices.hasNavBar)
+ layoutParams.width = LayoutParams.MATCH_PARENT
+ else
+ layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE)
+ hudBinding.progressOverlay.layoutParams = layoutParams
overlayBackground = findViewById(R.id.player_overlay_background)
navMenu = findViewById(R.id.player_overlay_navmenu)
if (!AndroidDevices.isChromeBook && !isTv
More information about the Android
mailing list