diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-07-07 15:22:31 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-07-07 15:22:31 -0700 |
commit | 03468d819ca2bf3fc921a87c8f412de1243e6796 (patch) | |
tree | 645a90784fa217a4d40d39e55f75d49f2ec592c7 | |
parent | 8ebb8adfa0a07dabf97dd9d1e6aaaa46161c0bef (diff) | |
download | dsub-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.java | 10 |
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: |