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:
parent
8436b8572c
commit
13d0a3570b
|
@ -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
|
* Returns true if notifications are persistent
|
||||||
*
|
*
|
||||||
|
|
|
@ -867,7 +867,13 @@ public class PlaybackService extends Service {
|
||||||
notificationBuilder.addAction(android.R.drawable.ic_media_rew,
|
notificationBuilder.addAction(android.R.drawable.ic_media_rew,
|
||||||
getString(R.string.rewind_label),
|
getString(R.string.rewind_label),
|
||||||
rewindButtonPendingIntent);
|
rewindButtonPendingIntent);
|
||||||
|
if(UserPreferences.showAdditionalNotificationButtons()) {
|
||||||
|
// always show the rewind button (even on the lockscreen)
|
||||||
|
compactActionList.add(numActions++);
|
||||||
|
} else {
|
||||||
numActions++;
|
numActions++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (playerStatus == PlayerStatus.PLAYING) {
|
if (playerStatus == PlayerStatus.PLAYING) {
|
||||||
PendingIntent pauseButtonPendingIntent = getPendingIntentForMediaAction(
|
PendingIntent pauseButtonPendingIntent = getPendingIntentForMediaAction(
|
||||||
|
@ -891,7 +897,12 @@ public class PlaybackService extends Service {
|
||||||
notificationBuilder.addAction(android.R.drawable.ic_media_ff,
|
notificationBuilder.addAction(android.R.drawable.ic_media_ff,
|
||||||
getString(R.string.fast_forward_label),
|
getString(R.string.fast_forward_label),
|
||||||
ffButtonPendingIntent);
|
ffButtonPendingIntent);
|
||||||
|
if(UserPreferences.showAdditionalNotificationButtons()) {
|
||||||
|
// always show the ff button (even on the lockscreen)
|
||||||
|
compactActionList.add(numActions++);
|
||||||
|
} else {
|
||||||
numActions++;
|
numActions++;
|
||||||
|
}
|
||||||
|
|
||||||
if (UserPreferences.isFollowQueue()) {
|
if (UserPreferences.isFollowQueue()) {
|
||||||
PendingIntent skipButtonPendingIntent = getPendingIntentForMediaAction(
|
PendingIntent skipButtonPendingIntent = getPendingIntentForMediaAction(
|
||||||
|
|
Loading…
Reference in New Issue