diff options
author | saqura <saqura@saqura.xyz> | 2016-04-01 18:05:58 +0200 |
---|---|---|
committer | saqura <saqura@saqura.xyz> | 2016-04-01 18:11:45 +0200 |
commit | 13d0a3570b3634da777a791e89008ad7cef5bd29 (patch) | |
tree | e285447467f90a241110f6c4820d67c05f602fe0 | |
parent | 8436b8572c9eab3211b93e63b05c561c22afdc85 (diff) | |
download | AntennaPod-13d0a3570b3634da777a791e89008ad7cef5bd29.zip |
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
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java | 10 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 58caedc3e..222c69a1d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -194,6 +194,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 * * @return {@code true} if notifications are persistent, {@code false} otherwise 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 729ea9e7a..9b37ce76d 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 @@ -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( |