[Android] Fix video track options layout issue

Nicolas Pomepuy git at videolan.org
Thu Apr 15 07:54:11 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Apr 14 14:01:03 2021 +0200| [8ab5d99f364eff212f0adb2f28a8091b048f3780] | committer: Nicolas Pomepuy

Fix video track options layout issue

Fixes #1991

> https://code.videolan.org/videolan/vlc-android/commit/8ab5d99f364eff212f0adb2f28a8091b048f3780
---

 .../res/layout/player_overlay_track_option_item.xml    | 18 ++++++++++++------
 .../vlc/gui/video/VideoPlayerOverlayDelegate.kt        | 12 ++++++------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/application/vlc-android/res/layout/player_overlay_track_option_item.xml b/application/vlc-android/res/layout/player_overlay_track_option_item.xml
index 9e841d653..d3f6b3ed5 100644
--- a/application/vlc-android/res/layout/player_overlay_track_option_item.xml
+++ b/application/vlc-android/res/layout/player_overlay_track_option_item.xml
@@ -21,10 +21,12 @@
   ~
   ~
   -->
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
+        xmlns:tools="http://schemas.android.com/tools"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_height="48dp"
         android:background="?android:attr/selectableItemBackground"
         android:focusable="true">
 
@@ -36,20 +38,24 @@
             android:layout_marginTop="8dp"
             android:layout_marginEnd="16dp"
             android:layout_marginBottom="8dp"
+            android:layout_gravity="center_vertical"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@+id/option_title"
             app:layout_constraintHorizontal_bias="0.5"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent"/>
+            app:layout_constraintTop_toTopOf="parent"
+            tools:srcCompat="@drawable/ic_delay" />
 
     <TextView
             android:id="@+id/option_title"
-            android:layout_width="0dp"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
+            android:layout_gravity="center_vertical"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_bias="0.5"
             app:layout_constraintStart_toEndOf="@+id/option_icon"
-            app:layout_constraintTop_toTopOf="parent" />
-</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
+            app:layout_constraintTop_toTopOf="parent"
+            tools:text="@string/audio_delay" />
+</LinearLayout>
\ No newline at end of file
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 ae4a00706..9d1d951de 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
@@ -136,29 +136,29 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
                 VideoTracksDialog.TrackType.AUDIO -> {
                     player.service?.let { service ->
                         service.setAudioTrack(trackID)
-                        runIO(Runnable {
+                        runIO {
                             val mw = player.medialibrary.findMedia(service.currentMediaWrapper)
                             if (mw != null && mw.id != 0L) mw.setLongMeta(MediaWrapper.META_AUDIOTRACK, trackID.toLong())
-                        })
+                        }
                     }
                 }
                 VideoTracksDialog.TrackType.SPU -> {
                     player.service?.let { service ->
                         service.setSpuTrack(trackID)
-                        runIO(Runnable {
+                        runIO {
                             val mw = player.medialibrary.findMedia(service.currentMediaWrapper)
                             if (mw != null && mw.id != 0L) mw.setLongMeta(MediaWrapper.META_SUBTITLE_TRACK, trackID.toLong())
-                        })
+                        }
                     }
                 }
                 VideoTracksDialog.TrackType.VIDEO -> {
                     player.service?.let { service ->
                         player.seek(service.time)
                         service.setVideoTrack(trackID)
-                        runIO(Runnable {
+                        runIO {
                             val mw = player.medialibrary.findMedia(service.currentMediaWrapper)
                             if (mw != null && mw.id != 0L) mw.setLongMeta(MediaWrapper.META_VIDEOTRACK, trackID.toLong())
-                        })
+                        }
                     }
                 }
             }



More information about the Android mailing list