[Android] Browser cards: make text centered if there is only one line

Nicolas Pomepuy git at videolan.org
Thu May 14 15:04:07 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 12 14:07:27 2020 +0200| [5ef1103fc77d97df897265f9b968b989eaaa7548] | committer: Nicolas Pomepuy

Browser cards: make text centered if there is only one line

> https://code.videolan.org/videolan/vlc-android/commit/5ef1103fc77d97df897265f9b968b989eaaa7548
---

 application/vlc-android/res/layout/card_browser_item.xml | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/res/layout/card_browser_item.xml b/application/vlc-android/res/layout/card_browser_item.xml
index 54a7f4881..6365b5568 100644
--- a/application/vlc-android/res/layout/card_browser_item.xml
+++ b/application/vlc-android/res/layout/card_browser_item.xml
@@ -125,6 +125,14 @@
                     app:layout_constraintStart_toStartOf="@+id/item_icon"
                     app:layout_constraintTop_toTopOf="@+id/item_icon" />
 
+<!--            This is a placeholder in case @+id/text is gone-->
+            <Space
+                    android:layout_width="wrap_content"
+                    android:layout_height="42dp"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/item_icon" />
+
             <TextView
                     android:id="@+id/title"
                     android:layout_width="0dp"
@@ -140,6 +148,7 @@
                     android:textColor="?attr/list_title"
                     android:textSize="14sp"
                     app:ellipsizeMode="@{true}"
+                    app:layout_constraintHorizontal_chainStyle="packed"
                     app:layout_constraintBottom_toTopOf="@+id/text"
                     app:layout_constraintEnd_toStartOf="@+id/item_more"
                     app:layout_constraintStart_toStartOf="parent"
@@ -157,7 +166,7 @@
                     app:asyncText="@{item}"
                     android:textColor="?attr/list_subtitle"
                     android:textSize="12sp"
-                    android:visibility="@{TextUtils.isEmpty(item.description) ? View.INVISIBLE : View.VISIBLE}"
+                    android:visibility="@{TextUtils.isEmpty(item.description) ? View.GONE : View.VISIBLE}"
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toStartOf="@+id/item_more"
                     app:layout_constraintStart_toStartOf="parent"



More information about the Android mailing list