[Android] Add a clock in the TV video player

Nicolas Pomepuy git at videolan.org
Thu Feb 16 16:01:26 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Feb 16 08:57:12 2023 +0100| [7ac5dc76b92c9acc2c59513c23fb95096731b11e] | committer: Duncan McNamara

Add a clock in the TV video player

Fixes #2828

> https://code.videolan.org/videolan/vlc-android/commit/7ac5dc76b92c9acc2c59513c23fb95096731b11e
---

 .../vlc-android/res/layout/player_hud_right.xml    | 47 ++++++++++++++--------
 .../vlc/gui/video/VideoPlayerOverlayDelegate.kt    |  1 +
 2 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/application/vlc-android/res/layout/player_hud_right.xml b/application/vlc-android/res/layout/player_hud_right.xml
index 64660412a8..5a0760d810 100644
--- a/application/vlc-android/res/layout/player_hud_right.xml
+++ b/application/vlc-android/res/layout/player_hud_right.xml
@@ -16,6 +16,20 @@
             android:visibility="invisible"
             tools:visibility="visible">
 
+        <TextClock
+            android:id="@+id/clock"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="16dp"
+            android:layout_marginEnd="16dp"
+            android:textSize="18sp"
+            android:shadowColor="@color/blacktransparent"
+            android:shadowDx="0"
+            android:shadowDy="2"
+            android:shadowRadius="11"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            tools:text="88:88AM" />
 
         <ImageView
                 android:id="@+id/player_overlay_navmenu"
@@ -74,22 +88,23 @@
                 tools:text="Game of Thrones S01-E01" />
 
         <ImageView
-                android:id="@+id/playlist_toggle"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
-                android:layout_marginTop="8dp"
-                android:layout_marginEnd="16dp"
-                android:background="?attr/selectableItemBackgroundBorderless"
-                android:contentDescription="@string/show_playlist"
-                android:focusable="true"
-                android:padding="6dp"
-                android:visibility="gone"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintTop_toTopOf="parent"
-                app:layout_constraintVertical_chainStyle="packed"
-                app:srcCompat="@drawable/ic_player_playqueue"
-                tools:visibility="visible" />
+            android:id="@+id/playlist_toggle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:layout_marginTop="8dp"
+            android:layout_marginEnd="16dp"
+            android:background="?attr/selectableItemBackgroundBorderless"
+            android:contentDescription="@string/show_playlist"
+            android:focusable="true"
+            android:padding="6dp"
+            android:visibility="gone"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintEnd_toStartOf="@+id/clock"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintVertical_chainStyle="packed"
+            app:srcCompat="@drawable/ic_player_playqueue"
+            tools:visibility="visible" />
 
         <ImageView
                 android:id="@+id/video_secondary_display"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 7a1e832b37..0d9d0f64fb 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -856,6 +856,7 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
             hudRightBinding.playbackSpeedQuickAction.visibility = if (show && player.service?.rate != 1.0F) View.VISIBLE else View.GONE
             hudRightBinding.spuDelayQuickAction.visibility = if (show && player.service?.spuDelay != 0L) View.VISIBLE else View.GONE
             hudRightBinding.audioDelayQuickAction.visibility = if (show && player.service?.audioDelay != 0L) View.VISIBLE else View.GONE
+            hudRightBinding.clock.visibility = if (Settings.showTvUi) View.VISIBLE else View.GONE
 
             hudRightBinding.playbackSpeedQuickAction.text = player.service?.rate?.formatRateString()
             hudRightBinding.playbackSpeedQuickAction.contentDescription = player.getString(R.string.playback_speed)+ ". " + player.service?.rate?.formatRateString()



More information about the Android mailing list