aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github/daneren2005/dsub/util
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-06-08 17:37:11 -0700
committerScott Jackson <daneren2005@gmail.com>2016-06-08 17:37:11 -0700
commit6ac63bba55d94a335889207adb5e0f9c806a0a92 (patch)
treed41f30663af6c7d4327324403d549f6e38cb43b2 /app/src/main/java/github/daneren2005/dsub/util
parent9fac439fd85487a165132431f4af74507218332e (diff)
downloaddsub-6ac63bba55d94a335889207adb5e0f9c806a0a92.tar.gz
dsub-6ac63bba55d94a335889207adb5e0f9c806a0a92.tar.bz2
dsub-6ac63bba55d94a335889207adb5e0f9c806a0a92.zip
Fixes #704: Allow rewind/fast forward in Auto + Bluetooth controls
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/util')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
index d210fbb0..d97a859b 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
@@ -145,11 +145,17 @@ public class RemoteControlClientLP extends RemoteControlClientBase {
position = downloadService.getPlayerPosition();
}
builder.setState(newState, position, 1.0f);
- builder.setActions(getPlaybackActions());
-
DownloadFile downloadFile = downloadService.getCurrentPlaying();
+ Entry entry = null;
+ boolean isSong = true;
if(downloadFile != null) {
- Entry entry = downloadFile.getSong();
+ entry = downloadFile.getSong();
+ isSong = entry.isSong();
+ }
+
+ builder.setActions(getPlaybackActions(isSong));
+
+ if(entry != null) {
addCustomActions(entry, builder);
builder.setActiveQueueItemId(entry.getId().hashCode());
}
@@ -231,7 +237,7 @@ public class RemoteControlClientLP extends RemoteControlClientBase {
return mediaSession;
}
- protected long getPlaybackActions() {
+ protected long getPlaybackActions(boolean isSong) {
long actions = PlaybackState.ACTION_PLAY |
PlaybackState.ACTION_PAUSE |
PlaybackState.ACTION_SEEK_TO |
@@ -239,10 +245,15 @@ public class RemoteControlClientLP extends RemoteControlClientBase {
int currentIndex = downloadService.getCurrentPlayingIndex();
int size = downloadService.size();
- if(currentIndex > 0) {
+ if(isSong) {
+ if (currentIndex > 0) {
+ actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
+ }
+ if (currentIndex < size - 1) {
+ actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
+ }
+ } else {
actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
- }
- if(currentIndex < size - 1) {
actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
}
@@ -311,7 +322,7 @@ public class RemoteControlClientLP extends RemoteControlClientBase {
return null;
}
-
+
private void playFromParent(Entry parent) throws Exception {
List<Entry> songs = new ArrayList<>();
getSongsRecursively(parent, songs);