summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2015-11-07 14:55:38 -0500
committerTom Hennen <tom.hennen@gmail.com>2015-11-07 14:55:38 -0500
commitd25899d858f3d217e5ecf21146d13dfac59b4329 (patch)
treef1171728fb8334ec5d91468bf684fe14f44331e6 /core
parent87dffd45e1963475ea01fb85abdb9e3d03c6b068 (diff)
downloadAntennaPod-d25899d858f3d217e5ecf21146d13dfac59b4329.zip
make action handling make somewhat more sense
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index 0e306b452..115e7730a 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -864,44 +864,45 @@ public class PlaybackService extends Service {
.setSmallIcon(smallIcon)
.setWhen(0) // we don't need the time
.setPriority(UserPreferences.getNotifyPriority()); // set notification priority
- IntList actionList = new IntList();
+ IntList compactActionList = new IntList();
+ int numActions = 0; // we start and 0 and then increment by 1 for each call to addAction
+
// always let them rewind
notificationBuilder.addAction(android.R.drawable.ic_media_rew,
getString(R.string.rewind_label),
rewindButtonPendingIntent);
-
- int numActions = 0; // we start and 0 and then increment by 1 for each call to addAction
+ numActions++;
if (playerStatus == PlayerStatus.PLAYING) {
notificationBuilder.addAction(android.R.drawable.ic_media_pause, //pause action
getString(R.string.pause_label),
pauseButtonPendingIntent);
- actionList.add(++numActions);
+ compactActionList.add(numActions++);
} else {
notificationBuilder.addAction(android.R.drawable.ic_media_play, //play action
getString(R.string.play_label),
playButtonPendingIntent);
- actionList.add(++numActions);
+ compactActionList.add(numActions++);
}
// ff follows play, then we have skip (if it's present)
notificationBuilder.addAction(android.R.drawable.ic_media_ff,
getString(R.string.fast_forward_label),
ffButtonPendingIntent);
- ++numActions;
+ numActions++;
if (UserPreferences.isFollowQueue()) {
notificationBuilder.addAction(android.R.drawable.ic_media_next,
getString(R.string.skip_episode_label),
skipButtonPendingIntent);
- actionList.add(++numActions);
+ compactActionList.add(numActions++);
}
notificationBuilder.setStyle(new android.support.v7.app.NotificationCompat.MediaStyle()
.setMediaSession(mediaPlayer.getSessionToken())
- .setShowActionsInCompactView(actionList.toArray())
+ .setShowActionsInCompactView(compactActionList.toArray())
.setShowCancelButton(true)
.setCancelButtonIntent(stopButtonPendingIntent))
.setVisibility(Notification.VISIBILITY_PUBLIC)