[Android] init speed text with the current rate

Sébastien Toque git at videolan.org
Sun Dec 30 19:40:53 CET 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun Dec 30 19:40:49 2012 +0100| [e698a3a56300345438a1898f9a801440578f0c72] | committer: Sébastien Toque

init speed text with the current rate

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

 .../src/org/videolan/vlc/gui/AdvFuncDialog.java      |   18 +++++++++++++++---
 .../org/videolan/vlc/gui/SpeedSelectorDialog.java    |   12 ------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AdvFuncDialog.java b/vlc-android/src/org/videolan/vlc/gui/AdvFuncDialog.java
index 7bf6b38..0c106af 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AdvFuncDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AdvFuncDialog.java
@@ -21,7 +21,9 @@ package org.videolan.vlc.gui;
 
 import java.util.Calendar;
 
+import org.videolan.vlc.LibVLC;
 import org.videolan.vlc.R;
+import org.videolan.vlc.Util;
 import org.videolan.vlc.gui.SpeedSelectorDialog;
 import org.videolan.vlc.gui.TimeSleepDialog;
 
@@ -68,10 +70,10 @@ public class AdvFuncDialog extends Dialog {
         mSpeed = (ImageButton) mAdvFuncView.findViewById(R.id.adv_func_speed);
         mSpeed.setOnClickListener(mSpeedLabelListener);
         mSpeedInfo = (TextView) mAdvFuncView.findViewById(R.id.adv_func_speed_info);
+        mSpeedInfo.setText(getSpeedInfo());
     }
 
     private final View.OnClickListener mSleepListener = new View.OnClickListener() {
-
         @Override
         public void onClick(View v) {
             final Calendar c = Calendar.getInstance();
@@ -86,16 +88,26 @@ public class AdvFuncDialog extends Dialog {
         public void onClick(View v) {
             mSpeedSelectorDialog = new SpeedSelectorDialog(getOwnerActivity());
             mSpeedSelectorDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
-
                 @Override
                 public void onDismiss(DialogInterface dialog) {
-                    mSpeedInfo.setText(mSpeedSelectorDialog.getSpeedInfo());
+                    mSpeedInfo.setText(getSpeedInfo());
                 }
             });
             mSpeedSelectorDialog.show();
         }
     };
 
+    /**
+     * Return play speed
+     */
+    private String getSpeedInfo() {
+        LibVLC libVLC = LibVLC.getExistingInstance();
+        if (libVLC != null)
+            return Util.formatRateString(libVLC.getRate());
+        else
+            return "";
+    }
+
     public void destroyAdvFuncDialog() {
 
         // Dismiss secondary window
diff --git a/vlc-android/src/org/videolan/vlc/gui/SpeedSelectorDialog.java b/vlc-android/src/org/videolan/vlc/gui/SpeedSelectorDialog.java
index 11d64b9..fc125a4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SpeedSelectorDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SpeedSelectorDialog.java
@@ -22,7 +22,6 @@ package org.videolan.vlc.gui;
 
 import org.videolan.vlc.LibVLC;
 import org.videolan.vlc.R;
-import org.videolan.vlc.Util;
 import org.videolan.vlc.VLCApplication;
 
 import android.app.Dialog;
@@ -80,15 +79,4 @@ public class SpeedSelectorDialog extends Dialog {
             }
         });
     }
-
-    /**
-     * Return play speed
-     */
-    public String getSpeedInfo () {
-        LibVLC libVLC = LibVLC.getExistingInstance();
-        if (libVLC != null)
-            return Util.formatRateString(libVLC.getRate());
-        else
-            return "";
-    }
 }



More information about the Android mailing list