[Android] Fix playlist items appearence

Geoffrey Métais git at videolan.org
Tue Jan 12 16:51:35 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 12 16:51:14 2016 +0100| [3ec0ce92c65774a0db395bae8fd0ccf6cd5f1e79] | committer: Geoffrey Métais

Fix playlist items appearence

> https://code.videolan.org/videolan/vlc-android/commit/3ec0ce92c65774a0db395bae8fd0ccf6cd5f1e79
---

 vlc-android/res/layout/playlist_item.xml | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/vlc-android/res/layout/playlist_item.xml b/vlc-android/res/layout/playlist_item.xml
index b36b9b3..5db01ae 100644
--- a/vlc-android/res/layout/playlist_item.xml
+++ b/vlc-android/res/layout/playlist_item.xml
@@ -3,6 +3,7 @@
 
     <data>
         <import type="android.view.View"/>
+        <import type="android.text.TextUtils"/>
         <import type="org.videolan.vlc.util.Strings"/>
         <variable
             name="holder"
@@ -20,8 +21,9 @@
     </data>
 
     <RelativeLayout
-        android:orientation="vertical" android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
         android:layout_marginTop="3dip"
         android:layout_marginBottom="3dip"
         android:layout_marginLeft="5dip"
@@ -30,17 +32,19 @@
         <TextView
             android:id="@+id/audio_item_title"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_marginLeft="5dip"
             android:layout_marginRight="5dip"
             android:layout_alignParentLeft="true"
             android:layout_alignParentTop="true"
             android:layout_toLeftOf="@+id/length"
-            android:singleLine="true"
+            android:layout_above="@+id/audio_item_subtitle"
+            android:maxLines="@{TextUtils.isEmpty(subTitle) ? 2 : 1}"
             android:ellipsize="middle"
             android:text="@{media.title}"
             android:textColor="@{titleColor}"
             android:fontFamily="sans-serif-light"
+            android:gravity="center_vertical"
             android:textSize="16sp" />
         <TextView
             android:id="@+id/audio_item_subtitle"
@@ -51,35 +55,33 @@
             android:layout_marginRight="5dip"
             android:layout_alignParentLeft="true"
             android:layout_alignParentBottom="true"
-            android:layout_below="@+id/audio_item_title"
             android:layout_toLeftOf="@+id/length"
             android:singleLine="true"
             android:ellipsize="middle"
             android:textColor="?attr/list_subtitle"
             android:fontFamily="sans-serif-light"
-            android:textSize="12sp" />
+            android:textSize="12sp"
+            android:visibility="@{TextUtils.isEmpty(subTitle) ? View.GONE : View.VISIBLE}"/>
         <TextView
             android:id="@+id/length"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:layout_alignBottom="@id/audio_item_subtitle"
-            android:layout_alignTop="@id/audio_item_title"
+            android:layout_toLeftOf="@+id/item_more"
             android:layout_marginRight="5dip"
             android:gravity="center_vertical"
-            android:text="@{Strings.millisToString(media.length)}"
-            android:layout_toLeftOf="@+id/item_more" />
+            android:text="@{Strings.millisToString(media.length)}" />
 
         <ImageView
             android:id="@+id/item_more"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_gravity="center"
             android:paddingRight="10dp"
             android:paddingLeft="10dp"
             android:layout_alignParentRight="true"
             android:layout_alignBottom="@id/audio_item_subtitle"
             android:layout_alignTop="@id/audio_item_title"
-            android:scaleType="fitCenter"
+            android:scaleType="center"
             android:background="@drawable/ic_more"
             android:onClick="@{holder.onMoreClick}"
             android:clickable="true" />



More information about the Android mailing list