Optionally show rewind/ff buttons on lockscreen

Show additional playback buttons (rewind and fast forward) in the
notification on the lockscreen if the option "Expand Notification" is
enabled.

Fixes #337
Fixes #571
This commit is contained in:
saqura 2016-04-01 18:05:58 +02:00
parent 8436b8572c
commit 13d0a3570b
2 changed files with 23 additions and 2 deletions

View File

@ -193,6 +193,16 @@ public class UserPreferences {
}
}
/**
* Returns true if additional playback buttons should be shown in the notification even when
* on the lockscreen
*
* @return {@code true} if additional playback buttons should be shown, {@code false} otherwise
*/
public static boolean showAdditionalNotificationButtons() {
return prefs.getBoolean(PREF_EXPANDED_NOTIFICATION, false);
}
/**
* Returns true if notifications are persistent
*

View File

@ -867,7 +867,13 @@ public class PlaybackService extends Service {
notificationBuilder.addAction(android.R.drawable.ic_media_rew,
getString(R.string.rewind_label),
rewindButtonPendingIntent);
numActions++;
if(UserPreferences.showAdditionalNotificationButtons()) {
// always show the rewind button (even on the lockscreen)
compactActionList.add(numActions++);
} else {
numActions++;
}
if (playerStatus == PlayerStatus.PLAYING) {
PendingIntent pauseButtonPendingIntent = getPendingIntentForMediaAction(
@ -891,7 +897,12 @@ public class PlaybackService extends Service {
notificationBuilder.addAction(android.R.drawable.ic_media_ff,
getString(R.string.fast_forward_label),
ffButtonPendingIntent);
numActions++;
if(UserPreferences.showAdditionalNotificationButtons()) {
// always show the ff button (even on the lockscreen)
compactActionList.add(numActions++);
} else {
numActions++;
}
if (UserPreferences.isFollowQueue()) {
PendingIntent skipButtonPendingIntent = getPendingIntentForMediaAction(