[Android] UI: Add resolution bellow the video title, and move the length beside it

Sébastien Toque git at videolan.org
Sun May 13 21:23:11 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun May 13 21:22:04 2012 +0200| [b6014eabf7450972fdbfa8e03401513dec5a9f80] | committer: Sébastien Toque

UI: Add resolution bellow the video title, and move the length beside it

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

 vlc-android/res/layout/video_list_item.xml         |   51 +++++++++-----------
 .../videolan/vlc/gui/video/VideoListAdapter.java   |    7 ++-
 2 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/vlc-android/res/layout/video_list_item.xml b/vlc-android/res/layout/video_list_item.xml
index cb9b873..b81cc6d 100644
--- a/vlc-android/res/layout/video_list_item.xml
+++ b/vlc-android/res/layout/video_list_item.xml
@@ -6,38 +6,33 @@
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     android:gravity="center_vertical">
-    <FrameLayout
+    <ImageView
+        android:id="@+id/ml_item_thumbnail"
         android:layout_width="120dip"
-        android:layout_height="80dip">
-        <ImageView
-            android:id="@+id/ml_item_thumbnail"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:scaleType="centerCrop" />
-        <LinearLayout
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:gravity="bottom|right"
-            android:padding="2dip">
-            <TextView
-                android:id="@+id/ml_item_length"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:background="@drawable/video_list_length_bg"
-                android:textSize="12dip"
-                android:textColor="#CCCCCC" />
-        </LinearLayout>
-    </FrameLayout>
-    <TextView
-        android:id="@+id/ml_item_title"
+        android:layout_height="80dip"
+        android:scaleType="centerCrop" />
+    <LinearLayout
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:ellipsize="end"
-        android:maxLines="2"
-        android:textSize="17dip"
-        android:textColor="@color/video_list_title"
-        android:paddingLeft="12dip" />
+        android:orientation="vertical">
+        <TextView
+            android:id="@+id/ml_item_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:ellipsize="end"
+            android:maxLines="2"
+            android:textSize="17dip"
+            android:textColor="@color/video_list_title"
+            android:paddingLeft="12dip" />
+        <TextView
+            android:id="@+id/ml_item_subtitle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="14dip"
+            android:textColor="#888888"
+            android:paddingLeft="12dip" />
+    </LinearLayout>
     <ImageView
         android:id="@+id/ml_item_more"
         android:layout_width="wrap_content"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index a575e18..1a5fdf2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -124,8 +124,8 @@ public class VideoListAdapter extends ArrayAdapter<Media>
             holder = new ViewHolder();
             holder.layout = (View) v.findViewById(R.id.layout_item);
             holder.thumbnail = (ImageView) v.findViewById(R.id.ml_item_thumbnail);
-            holder.length = (TextView) v.findViewById(R.id.ml_item_length);
             holder.title = (TextView) v.findViewById(R.id.ml_item_title);
+            holder.subtitle = (TextView) v.findViewById(R.id.ml_item_subtitle);
             holder.more = (ImageView) v.findViewById(R.id.ml_item_more);
             v.setTag(holder);
         } else
@@ -134,7 +134,6 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         Media media = getItem(position);
         Util.setItemBackground(holder.layout, position);
         holder.title.setText(media.getTitle());
-        holder.length.setText(" " + Util.millisToString(media.getLength()) + " ");
 
         Bitmap thumbnail;
         if (media.getPicture() != null) {
@@ -147,6 +146,8 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         }
 
         holder.title.setTextColor(media.getLocation().equals(mLastMRL) ? 0xFFF48B00 /* ORANGE */ : Color.WHITE);
+        holder.subtitle.setText(String.format("%s - %dx%d",
+                                Util.millisToString(media.getLength()), media.getWidth(), media.getHeight()));
         holder.more.setTag(media);
         holder.more.setOnClickListener(moreClickListener);
 
@@ -167,8 +168,8 @@ public class VideoListAdapter extends ArrayAdapter<Media>
     static class ViewHolder {
         View layout;
         ImageView thumbnail;
-        TextView length;
         TextView title;
+        TextView subtitle;
         ImageView more;
     }
 }



More information about the Android mailing list