aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorKevin T. Berstene <kberstene@gmail.com>2017-06-11 21:24:37 -0400
committerKevin T. Berstene <kberstene@gmail.com>2017-06-11 21:24:37 -0400
commitcbe2f2058f391cef78315253dbea3524aba7d81a (patch)
tree40eac6332043b923f97267da7bed010dda3cfc05 /app/src/main/java/github
parentdf7e77a3e658a3a41b2066dec81c06bb51c41daf (diff)
downloaddsub-cbe2f2058f391cef78315253dbea3524aba7d81a.tar.gz
dsub-cbe2f2058f391cef78315253dbea3524aba7d81a.tar.bz2
dsub-cbe2f2058f391cef78315253dbea3524aba7d81a.zip
Fixed previous and next button behavior while long song is paused
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Notifications.java46
2 files changed, 29 insertions, 21 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
index 636745d6..4d3107b3 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -1202,7 +1202,7 @@ public class DownloadService extends Service {
}
// If only one song, just skip within song
- if(size() == 1 || (currentPlaying != null && !currentPlaying.isSong())) {
+ if(size() == 1) {
rewind();
return;
}
@@ -1228,7 +1228,7 @@ public class DownloadService extends Service {
}
public synchronized void next(boolean forceCutoff, boolean forceStart) {
// If only one song, just skip within song
- if(size() == 1 || (currentPlaying != null && !currentPlaying.isSong())) {
+ if(size() == 1) {
fastForward();
return;
} else if(playerState == PREPARING || playerState == PREPARED) {
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
index d6a92b07..7444911f 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
@@ -200,31 +200,38 @@ public final class Notifications {
}
// Create actions for media buttons
- PendingIntent pendingIntent;
int previous = 0, pause = 0, next = 0, close = 0, rewind = 0, fastForward = 0;
- if(persistent && !expanded) {
- pause = R.id.control_previous;
- if(isLongFile && playing) {
- fastForward = R.id.control_pause;
+ if (expanded) {
+ if (isLongFile && playing) {
+ rewind = R.id.control_previous;
+ pause = R.id.control_pause;
+ fastForward = R.id.control_next;
} else {
- next = R.id.control_pause;
+ previous = R.id.control_previous;
+ pause = R.id.control_pause;
+ next = R.id.control_next;
+ }
+
+ if (remote || persistent) {
+ close = R.id.notification_close;
+ rv.setViewVisibility(close, View.VISIBLE);
}
- close = R.id.control_next;
- } else if(isLongFile && (!persistent || (expanded && playing))) {
- rewind = R.id.control_previous;
- pause = R.id.control_pause;
- fastForward = R.id.control_next;
} else {
- previous = R.id.control_previous;
- pause = R.id.control_pause;
- next = R.id.control_next;
+ if (persistent) {
+ pause = R.id.control_previous;
+ if(isLongFile && playing) {
+ fastForward = R.id.control_pause;
+ } else {
+ next = R.id.control_pause;
+ }
+ close = R.id.control_next;
+ } else {
+ rewind = R.id.control_previous;
+ pause = R.id.control_pause;
+ fastForward = R.id.control_next;
+ }
}
- if((remote || persistent) && close == 0 && expanded) {
- close = R.id.notification_close;
- rv.setViewVisibility(close, View.VISIBLE);
- }
-
if(isSingleFile) {
if(previous > 0) {
rv.setViewVisibility(previous, View.GONE);
@@ -246,6 +253,7 @@ public final class Notifications {
}
}
+ PendingIntent pendingIntent;
if(previous > 0) {
Intent prevIntent = new Intent("KEYCODE_MEDIA_PREVIOUS");
prevIntent.setComponent(new ComponentName(context, DownloadService.class));