[Android] Use 'fromUser' hint for progress action

Geoffrey Métais git at videolan.org
Fri Jun 10 15:56:29 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jun 10 15:47:32 2016 +0200| [1cdc5bb70b0bdf3bea47140edeab84f425d55871] | committer: Geoffrey Métais

Use 'fromUser' hint for progress action

(cherry picked from commit 0c81a1d34934f346bb7b51e4100169a79653aa31)

> https://code.videolan.org/videolan/vlc-android/commit/1cdc5bb70b0bdf3bea47140edeab84f425d55871
---

 .../vlc/gui/dialogs/PlaybackSpeedDialog.java       | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.java
index ecea3b8..5ebcebd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.java
@@ -38,7 +38,7 @@ import org.videolan.vlc.gui.PlaybackServiceFragment;
 import org.videolan.vlc.gui.helpers.UiTools;
 import org.videolan.vlc.util.Strings;
 
-public class PlaybackSpeedDialog extends DialogFragment implements PlaybackService.Client.Callback, View.OnFocusChangeListener {
+public class PlaybackSpeedDialog extends DialogFragment implements PlaybackService.Client.Callback {
 
     public final static String TAG = "VLC/PlaybackSpeedDialog";
 
@@ -48,7 +48,6 @@ public class PlaybackSpeedDialog extends DialogFragment implements PlaybackServi
     private ImageView mPlaybackSpeedPlus;
     private ImageView mPlaybackSpeedMinus;
 
-    private boolean mSeekBarAction = false;
     protected PlaybackService mService;
     protected int mTextColor;
 
@@ -82,7 +81,6 @@ public class PlaybackSpeedDialog extends DialogFragment implements PlaybackServi
         mPlaybackSpeedMinus = (ImageView) view.findViewById(R.id.playback_speed_minus);
 
         mSeekSpeed.setOnSeekBarChangeListener(mSeekBarListener);
-        mSeekSpeed.setOnFocusChangeListener(this);
         mPlaybackSpeedIcon.setOnClickListener(mResetListener);
         mPlaybackSpeedPlus.setOnClickListener(mSpeedUpListener);
         mPlaybackSpeedMinus.setOnClickListener(mSpeedDownListener);
@@ -112,20 +110,18 @@ public class PlaybackSpeedDialog extends DialogFragment implements PlaybackServi
         public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
             if (mService == null)
                 return;
-            if (mSeekBarAction == true) {
+            if (fromUser) {
                 float rate = (float) Math.pow(4, ((double) progress / (double) 100) - 1);
                 mService.setRate(rate);
                 updateInterface();
             }
         }
 
-        public void onStartTrackingTouch(SeekBar seekBar) {
-            mSeekBarAction = true;
-        }
+        @Override
+        public void onStartTrackingTouch(SeekBar seekBar) {}
 
-        public void onStopTrackingTouch(SeekBar seekBar) {
-            mSeekBarAction = false;
-        }
+        @Override
+        public void onStopTrackingTouch(SeekBar seekBar) {}
     };
 
     private View.OnClickListener mResetListener = new View.OnClickListener() {
@@ -209,11 +205,4 @@ public class PlaybackSpeedDialog extends DialogFragment implements PlaybackServi
     public void onDisconnected() {
         mService = null;
     }
-
-    @Override
-    public void onFocusChange(View v, boolean hasFocus) {
-        if (v.getId() == R.id.playback_speed_seek) {
-            mSeekBarAction = hasFocus;
-        }
-    }
 }



More information about the Android mailing list