[Android] Fix TV album text sizing when audio metadata are really long

Nicolas Pomepuy git at videolan.org
Wed Feb 9 14:56:37 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jan 17 08:08:20 2022 +0100| [9ef14d8a2508bcb68b5d0d83f7116d63da7c2e4b] | committer: Nicolas Pomepuy

Fix TV album text sizing when audio metadata are really long

Fixes #2323

> https://code.videolan.org/videolan/vlc-android/commit/9ef14d8a2508bcb68b5d0d83f7116d63da7c2e4b
---

 .../src/main/res/layout/activity_media_list_tv.xml | 51 +++++++++----------
 .../res/layout/activity_media_list_tv_item.xml     | 59 ++++++++++++----------
 2 files changed, 57 insertions(+), 53 deletions(-)

diff --git a/application/television/src/main/res/layout/activity_media_list_tv.xml b/application/television/src/main/res/layout/activity_media_list_tv.xml
index 47e279ba6..56667d9e5 100644
--- a/application/television/src/main/res/layout/activity_media_list_tv.xml
+++ b/application/television/src/main/res/layout/activity_media_list_tv.xml
@@ -62,26 +62,32 @@
                 tools:srcCompat="@tools:sample/avatars"/>
 
         <TextView
-            android:id="@+id/albumTitle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="16dp"
-            android:text="@{title}"
-            android:textColor="@color/white"
-            android:textSize="18sp"
-            app:layout_constraintStart_toEndOf="@+id/cover"
-            app:layout_constraintTop_toTopOf="@+id/cover"
-            tools:text="Symphony No. 1" />
+                android:id="@+id/albumTitle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="16dp"
+                android:text="@{title}"
+                android:textColor="@color/white"
+                android:maxLines="1"
+                android:ellipsize="end"
+                android:textSize="18sp"
+                app:layout_constraintEnd_toStartOf="@+id/horizontalScrollView"
+                app:layout_constraintStart_toEndOf="@+id/cover"
+                app:layout_constraintTop_toTopOf="@+id/cover"
+                tools:text="Symphony No. 1" />
 
         <TextView
-            android:id="@+id/albumSubtitle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="16dp"
-            android:text="@{subtitle}"
-            app:layout_constraintStart_toEndOf="@+id/cover"
-            app:layout_constraintTop_toBottomOf="@+id/albumTitle"
-            tools:text="Ludwig van Beethoven" />
+                android:id="@+id/albumSubtitle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="16dp"
+                android:text="@{subtitle}"
+                android:maxLines="1"
+                android:ellipsize="end"
+                app:layout_constraintEnd_toStartOf="@+id/horizontalScrollView"
+                app:layout_constraintStart_toEndOf="@+id/cover"
+                app:layout_constraintTop_toBottomOf="@+id/albumTitle"
+                tools:text="Ludwig van Beethoven" />
 
         <TextView
             android:id="@+id/albumTotalTime"
@@ -93,15 +99,8 @@
             app:layout_constraintTop_toBottomOf="@+id/albumSubtitle"
             tools:text="01:38:27" />
 
-        <androidx.constraintlayout.widget.Barrier
-            android:id="@+id/barrier2"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            app:barrierDirection="end"
-            app:constraint_referenced_ids="albumSubtitle,albumTitle"
-            tools:layout_editor_absoluteX="960dp" />
-
         <HorizontalScrollView
+                android:id="@+id/horizontalScrollView"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginBottom="8dp"
diff --git a/application/television/src/main/res/layout/activity_media_list_tv_item.xml b/application/television/src/main/res/layout/activity_media_list_tv_item.xml
index a12aef194..6fa59cf6f 100644
--- a/application/television/src/main/res/layout/activity_media_list_tv_item.xml
+++ b/application/television/src/main/res/layout/activity_media_list_tv_item.xml
@@ -49,6 +49,7 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
             app:media="@{item}"
+                app:tv="@{true}"
             tools:srcCompat="@tools:sample/avatars" />
 
         <androidx.appcompat.widget.AppCompatImageView
@@ -64,35 +65,39 @@
             app:srcCompat="@drawable/ic_tv_list_play_big" />
 
         <TextView
-            android:id="@+id/title"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginEnd="8dp"
-            android:text="@{item.title}"
-            android:textColor="@color/white"
-            android:textSize="16sp"
-            app:layout_constraintBottom_toTopOf="@+id/textView16"
-            app:layout_constraintEnd_toStartOf="@+id/swipe_text"
-            app:layout_constraintHorizontal_bias="0.5"
-            app:layout_constraintStart_toEndOf="@+id/item_play"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintVertical_chainStyle="packed"
-            tools:text="Symphony No. 1" />
+                android:id="@+id/title"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="8dp"
+                android:layout_marginEnd="16dp"
+                android:text="@{item.title}"
+                android:textColor="@color/white"
+                android:textSize="16sp"
+                android:maxLines="1"
+                android:ellipsize="end"
+                app:layout_constraintBottom_toTopOf="@+id/textView16"
+                app:layout_constraintEnd_toStartOf="@+id/textView17"
+                app:layout_constraintHorizontal_bias="0.5"
+                app:layout_constraintStart_toEndOf="@+id/item_play"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_chainStyle="packed"
+                tools:text="Symphony No. 1" />
 
         <TextView
-            android:id="@+id/textView16"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginEnd="8dp"
-            android:text="@{item.artist}"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@+id/swipe_text"
-            app:layout_constraintHorizontal_bias="0.5"
-            app:layout_constraintStart_toEndOf="@+id/item_play"
-            app:layout_constraintTop_toBottomOf="@+id/title"
-            tools:text="Ludwig van Beethoven" />
+                android:id="@+id/textView16"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="8dp"
+                android:layout_marginEnd="16dp"
+                android:text="@{item.artist}"
+                android:maxLines="1"
+                android:ellipsize="end"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/textView17"
+                app:layout_constraintHorizontal_bias="0.5"
+                app:layout_constraintStart_toEndOf="@+id/item_play"
+                app:layout_constraintTop_toBottomOf="@+id/title"
+                tools:text="Ludwig van Beethoven" />
 
         <TextView
             android:id="@+id/textView17"



More information about the Android mailing list