[Android] Improve playback speed dialog for DPAD navigation

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


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jun 10 15:30:32 2016 +0200| [f569167abf282957f22da76c6bd5d444161070ea] | committer: Geoffrey Métais

Improve playback speed dialog for DPAD navigation

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

 vlc-android/res/layout/dialog_playback_speed.xml                 | 1 +
 .../src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.java    | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/vlc-android/res/layout/dialog_playback_speed.xml b/vlc-android/res/layout/dialog_playback_speed.xml
index aaf5f8d..3b41e0a 100644
--- a/vlc-android/res/layout/dialog_playback_speed.xml
+++ b/vlc-android/res/layout/dialog_playback_speed.xml
@@ -24,6 +24,7 @@
                 android:id="@+id/playback_speed_icon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:focusable="true"
                 android:src="?attr/ic_speed_normal_style" />
 
             <TextView
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 dea9979..ecea3b8 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 {
+public class PlaybackSpeedDialog extends DialogFragment implements PlaybackService.Client.Callback, View.OnFocusChangeListener {
 
     public final static String TAG = "VLC/PlaybackSpeedDialog";
 
@@ -82,6 +82,7 @@ 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);
@@ -209,4 +210,10 @@ public class PlaybackSpeedDialog extends DialogFragment implements PlaybackServi
         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