From 03468d819ca2bf3fc921a87c8f412de1243e6796 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 7 Jul 2013 15:22:31 -0700 Subject: Double press pause to skip to next song --- .../dsub/service/DownloadServiceLifecycleSupport.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'subsonic-android/src/github/daneren2005') diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 33c45a02..ae378865 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -60,6 +60,7 @@ public class DownloadServiceLifecycleSupport { private boolean externalStorageAvailable= true; private ReentrantLock lock = new ReentrantLock(); private final AtomicBoolean setup = new AtomicBoolean(false); + private long lastPressTime = 0; /** * This receiver manages the intent that could come from other applications. @@ -245,9 +246,16 @@ public class DownloadServiceLifecycleSupport { } else if(event.getAction() == KeyEvent.ACTION_UP) { switch (event.getKeyCode()) { case RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE: + downloadService.togglePlayPause(); + break; case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_HEADSETHOOK: - downloadService.togglePlayPause(); + if(lastPressTime < (System.currentTimeMillis() - 500)) { + lastPressTime = System.currentTimeMillis(); + downloadService.togglePlayPause(); + } else { + downloadService.next(); + } break; case RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: -- cgit v1.2.3