[Android] Set constants for headsets clicks delays

Geoffrey Métais git at videolan.org
Tue Dec 13 18:14:22 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Dec 13 17:41:42 2016 +0100| [22294536a4478d3e83b2c968784772e9c5f3a056] | committer: Geoffrey Métais

Set constants for headsets clicks delays

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index bf4b3e5..59be718 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -122,6 +122,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
     public static final String ACTION_REMOTE_LAST_VIDEO_PLAYLIST = ACTION_REMOTE_GENERIC+"LastVideoPlaylist";
     public static final String ACTION_REMOTE_SWITCH_VIDEO = ACTION_REMOTE_GENERIC+"SwitchToVideo";
 
+    private static final int DELAY_DOUBLE_CLICK = 800;
+    private static final int DELAY_LONG_CLICK = 1000;
+
     public interface Callback {
         void update();
         void updateProgress();
@@ -1061,11 +1064,11 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                             break;
                         case KeyEvent.ACTION_UP:
                             if (AndroidDevices.hasTsp()) { //no backward/forward on TV
-                                if (time - mHeadsetDownTime >= 1000) { // long click
+                                if (time - mHeadsetDownTime >= DELAY_LONG_CLICK) { // long click
                                     mHeadsetUpTime = time;
                                     previous(false);
                                     return true;
-                                } else if (time - mHeadsetUpTime <= 500) { // double click
+                                } else if (time - mHeadsetUpTime <= DELAY_DOUBLE_CLICK) { // double click
                                     mHeadsetUpTime = time;
                                     next();
                                     return true;



More information about the Android mailing list