[Android] Fix millisToString helper method

Geoffrey Métais git at videolan.org
Thu Jun 8 14:12:51 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun  8 10:15:03 2017 +0200| [6f27220c8a5d25c2d3a8dd3cd8e805f095c7487d] | committer: Geoffrey Métais

Fix millisToString helper method

> https://code.videolan.org/videolan/vlc-android/commit/6f27220c8a5d25c2d3a8dd3cd8e805f095c7487d
---

 medialibrary/src/org/videolan/medialibrary/Tools.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java
index a82b85cd8..cd8c2c76d 100644
--- a/medialibrary/src/org/videolan/medialibrary/Tools.java
+++ b/medialibrary/src/org/videolan/medialibrary/Tools.java
@@ -16,6 +16,7 @@ import java.util.Locale;
 
 public class Tools {
 
+    private static final String TAG = "VLC/Tools";
     private static StringBuilder sb = new StringBuilder();
     private static DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US);
     static {
@@ -109,14 +110,14 @@ public class Tools {
         int hours = (int) millis;
 
         if (text) {
-            if (millis > 0)
-                sb.append(hours).append('h').append(format.format(min)).append("min");
-            else if (min > 0)
+            if (hours > 0)
+                sb.append(hours).append('h');
+            if (min > 0)
                 sb.append(min).append("min");
-            else
+            if (sec > 0)
                 sb.append(sec).append("s");
         } else {
-            if (millis > 0)
+            if (hours > 0)
                 sb.append(hours).append(':').append(format.format(min)).append(':').append(format.format(sec));
             else
                 sb.append(min).append(':').append(format.format(sec));



More information about the Android mailing list