[Android] Do not display 0x0 as size in the list

Jean-Baptiste Kempf git at videolan.org
Wed Aug 29 17:27:11 CEST 2012


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Aug 29 17:25:55 2012 +0200| [a939cfcf139d032015f064be87dabf8d97255c2e] | committer: Jean-Baptiste Kempf

Do not display 0x0 as size in the list

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

 .../org/videolan/vlc/gui/video/VideoListAdapter.java  |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

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 e5f01a5..0277952 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -153,17 +153,22 @@ public class VideoListAdapter extends ArrayAdapter<Media>
 
         holder.title.setTextColor(media.getLocation().equals(mLastMRL) ? 0xFFF48B00 /* ORANGE */ : Color.WHITE);
         long lastTime = media.getTime();
+        String text;
         if (lastTime > 0) {
-            holder.subtitle.setText(String.format("%s / %s - %dx%d",
+            text = String.format("%s / %s",
                     Util.millisToString(lastTime),
-                    Util.millisToString(media.getLength()),
-                    media.getWidth(), media.getHeight()));
+                    Util.millisToString(media.getLength()));
         }
         else {
-            holder.subtitle.setText(String.format("%s - %dx%d",
-                    Util.millisToString(media.getLength()),
-                    media.getWidth(), media.getHeight()));
+            text = String.format("%s",
+                    Util.millisToString(media.getLength()));
         }
+        
+        if (media.getWidth() > 0 && media.getHeight() > 0) {
+            text += String.format(" - %dx%d", media.getWidth(), media.getHeight());
+        }
+
+        holder.subtitle.setText(text);
 
         return v;
     }



More information about the Android mailing list