[Android] Add media length in playlist

Geoffrey Métais git at videolan.org
Mon Nov 9 17:15:17 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov  9 17:12:08 2015 +0100| [f35053576e924bb524c93f1b5c49fccdcc022df5] | committer: Geoffrey Métais

Add media length in playlist

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f35053576e924bb524c93f1b5c49fccdcc022df5
---

 vlc-android/res/layout/playlist_item.xml |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/playlist_item.xml b/vlc-android/res/layout/playlist_item.xml
index 348eaab..b48f2b8 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="org.videolan.vlc.util.Strings"/>
         <variable
             name="handler"
             type="org.videolan.vlc.gui.audio.PlaylistAdapter.ClickHandler"/>
@@ -33,7 +34,7 @@
             android:layout_marginTop="5dip"
             android:layout_alignParentLeft="true"
             android:layout_alignParentTop="true"
-            android:layout_toLeftOf="@+id/item_more"
+            android:layout_toLeftOf="@+id/length"
             android:singleLine="true"
             android:ellipsize="middle"
             android:text="@{media.title}"
@@ -53,7 +54,7 @@
             android:layout_alignParentLeft="true"
             android:layout_alignParentBottom="true"
             android:layout_below="@+id/audio_item_title"
-            android:layout_toLeftOf="@+id/item_more"
+            android:layout_toLeftOf="@+id/length"
             android:singleLine="true"
             android:ellipsize="middle"
             android:textColor="?attr/list_subtitle"
@@ -61,6 +62,16 @@
             android:textSize="12sp"
             android:tag="@{position}"
             android:onClick="@{handler.onClick}" />
+        <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_marginRight="5dip"
+            android:gravity="center_vertical"
+            android:text="@{Strings.millisToString(media.length)}"
+            android:layout_toLeftOf="@+id/item_more" />
 
         <ImageView
             android:id="@+id/item_more"
@@ -70,7 +81,9 @@
             android:paddingRight="10dp"
             android:paddingLeft="10dp"
             android:layout_alignParentRight="true"
-            android:layout_alignParentTop="true"
+            android:layout_alignBottom="@id/audio_item_subtitle"
+            android:layout_alignTop="@id/audio_item_title"
+            android:scaleType="fitCenter"
             android:background="@drawable/ic_more"
             android:tag="@{position}"
             android:onClick="@{handler.onMoreClick}"



More information about the Android mailing list