[Android] Fix video player on TV
Nicolas Pomepuy
git at videolan.org
Tue Jun 18 09:30:30 CEST 2019
vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jun 17 15:35:59 2019 +0200| [203eadaa2cc463f0dccb4dc11f12efbe26a01c68] | committer: Geoffrey Métais
Fix video player on TV
> https://code.videolan.org/videolan/vlc-android/commit/203eadaa2cc463f0dccb4dc11f12efbe26a01c68
---
vlc-android/res/layout/player.xml | 2 +-
vlc-android/res/layout/player_hud.xml | 13 ++--
vlc-android/res/layout/player_remote_control.xml | 2 +-
.../videolan/vlc/gui/video/VideoPlayerActivity.kt | 73 +++++++++++-----------
4 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index ecaba4489..3753ccf90 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -63,7 +63,7 @@
<androidx.appcompat.widget.ViewStubCompat
android:id="@+id/player_hud_stub"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/player_hud"
android:layout_marginBottom="@dimen/overlay_margin"
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 0743f0628..b17c998f7 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="800dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corners"
android:paddingTop="@dimen/overlay_padding_top"
@@ -34,10 +34,12 @@
android:layout_marginStart="@dimen/time_margin_sides"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
+ android:ellipsize="end"
+ android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
android:textSize="16sp"
tools:text="Game of Thrones S01-E01"
- vlc:layout_constraintEnd_toStartOf="@+id/orientation_toggle"
+ vlc:layout_constraintEnd_toStartOf="@+id/player_overlay_adv_function"
vlc:layout_constraintStart_toStartOf="parent"
vlc:layout_constraintTop_toTopOf="parent" />
@@ -61,14 +63,14 @@
android:id="@+id/player_overlay_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/seek_margin_sides"
+ android:layout_marginEnd="@dimen/seek_margin_sides"
android:focusable="true"
android:layoutDirection="ltr"
android:maxHeight="@dimen/seekbar_height"
android:minHeight="@dimen/seekbar_height"
android:paddingStart="8dp"
android:paddingEnd="8dp"
- android:layout_marginStart="@dimen/seek_margin_sides"
- android:layout_marginEnd="@dimen/seek_margin_sides"
android:progress="@{(int)progress.time}"
android:progressDrawable="@drawable/po_seekbar_video"
android:splitTrack="false"
@@ -85,8 +87,9 @@
android:layout_marginStart="@dimen/time_margin_sides"
android:layout_marginBottom="8dp"
vlc:layout_constraintBottom_toBottomOf="parent"
- vlc:layout_constraintStart_toStartOf="parent"
vlc:layout_constraintEnd_toStartOf="@+id/lock_overlay_button"
+ vlc:layout_constraintHorizontal_chainStyle="spread_inside"
+ vlc:layout_constraintStart_toStartOf="parent"
vlc:layout_constraintTop_toBottomOf="@+id/player_overlay_seekbar">
<TextView
diff --git a/vlc-android/res/layout/player_remote_control.xml b/vlc-android/res/layout/player_remote_control.xml
index 7cae0c3e1..51ff0f6f6 100644
--- a/vlc-android/res/layout/player_remote_control.xml
+++ b/vlc-android/res/layout/player_remote_control.xml
@@ -66,7 +66,7 @@
<androidx.appcompat.widget.ViewStubCompat
android:id="@+id/player_hud_stub"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/overlay_margin"
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 b169f305d..600cb91ee 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1826,25 +1826,25 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
}
if (!isFinishing) alertDialog = AlertDialog.Builder(this at VideoPlayerActivity)
- .setTitle(titleId)
- .setSingleChoiceItems(nameList, listPosition) { dialog, listPosition ->
- var trackID = -1
- // Reverse map search...
- for (track in tracks) {
- if (idList[listPosition] == track.id) {
- trackID = track.id
- break
+ .setTitle(titleId)
+ .setSingleChoiceItems(nameList, listPosition) { dialog, listPosition ->
+ var trackID = -1
+ // Reverse map search...
+ for (track in tracks) {
+ if (idList[listPosition] == track.id) {
+ trackID = track.id
+ break
+ }
}
+ listener.onTrackSelected(trackID)
+ dialog.dismiss()
+ }
+ .setOnDismissListener { this.dimStatusBar(true) }
+ .create().apply {
+ setCanceledOnTouchOutside(true)
+ ownerActivity = this at VideoPlayerActivity
+ show()
}
- listener.onTrackSelected(trackID)
- dialog.dismiss()
- }
- .setOnDismissListener { this.dimStatusBar(true) }
- .create().apply {
- setCanceledOnTouchOutside(true)
- ownerActivity = this at VideoPlayerActivity
- show()
- }
}
fun selectVideoTrack() {
@@ -2180,12 +2180,9 @@ 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
- if (AndroidDevices.isPhone || !AndroidDevices.hasNavBar)
- layoutParams.width = LayoutParams.MATCH_PARENT
- else
- layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE)
- hudBinding.progressOverlay.layoutParams = layoutParams
+// val layoutParams = hudBinding.progressOverlay.layoutParams as RelativeLayout.LayoutParams
+// layoutParams.width = LayoutParams.MATCH_PARENT
+// hudBinding.progressOverlay.layoutParams = layoutParams
overlayBackground = findViewById(R.id.player_overlay_background)
navMenu = findViewById(R.id.player_overlay_navmenu)
if (!AndroidDevices.isChromeBook && !isTv
@@ -2669,21 +2666,21 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
service?.pause()
/* Encountered Error, exit player with a message */
alertDialog = AlertDialog.Builder(this at VideoPlayerActivity)
- .setMessage(R.string.confirm_resume)
- .setPositiveButton(R.string.resume_from_position) { _, _ -> loadMedia(false) }
- .setNegativeButton(R.string.play_from_start) { _, _ -> loadMedia(true) }
- .create().apply {
- setCancelable(false)
- setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, _ ->
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- dialog.dismiss()
- finish()
- return at OnKeyListener true
- }
- false
- })
- show()
- }
+ .setMessage(R.string.confirm_resume)
+ .setPositiveButton(R.string.resume_from_position) { _, _ -> loadMedia(false) }
+ .setNegativeButton(R.string.play_from_start) { _, _ -> loadMedia(true) }
+ .create().apply {
+ setCancelable(false)
+ setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, _ ->
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+ dialog.dismiss()
+ finish()
+ return at OnKeyListener true
+ }
+ false
+ })
+ show()
+ }
}
fun showAdvancedOptions() {
More information about the Android
mailing list