aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-07 15:22:31 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-07 15:22:31 -0700
commit03468d819ca2bf3fc921a87c8f412de1243e6796 (patch)
tree645a90784fa217a4d40d39e55f75d49f2ec592c7
parent8ebb8adfa0a07dabf97dd9d1e6aaaa46161c0bef (diff)
downloaddsub-03468d819ca2bf3fc921a87c8f412de1243e6796.tar.gz
dsub-03468d819ca2bf3fc921a87c8f412de1243e6796.tar.bz2
dsub-03468d819ca2bf3fc921a87c8f412de1243e6796.zip
Double press pause to skip to next song
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java10
1 files changed, 9 insertions, 1 deletions
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: