summaryrefslogtreecommitdiff
path: root/storage/preferences/src
diff options
context:
space:
mode:
authorMatej Drobnič <matej@matejdro.com>2024-02-04 19:54:46 +0100
committerGitHub <noreply@github.com>2024-02-04 19:54:46 +0100
commit0f5600932d5894d5653993d48d925df437fe6d00 (patch)
treeee34151ac28bbe55dcec9c45de1cb5dbe92ad299 /storage/preferences/src
parentf0e96a269233e85a452eabcbfe09899157024ab3 (diff)
downloadAntennaPod-0f5600932d5894d5653993d48d925df437fe6d00.zip
Add next chapter button to notification (#6276)
Diffstat (limited to 'storage/preferences/src')
-rw-r--r--storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
index 7b15584ba..b454ee5a1 100644
--- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
+++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
@@ -54,7 +54,7 @@ public class UserPreferences {
public static final String PREF_USE_EPISODE_COVER = "prefEpisodeCover";
public static final String PREF_SHOW_TIME_LEFT = "showTimeLeft";
private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
- public static final String PREF_COMPACT_NOTIFICATION_BUTTONS = "prefCompactNotificationButtons";
+ public static final String PREF_FULL_NOTIFICATION_BUTTONS = "prefFullNotificationButtons";
private static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport";
public static final String PREF_DEFAULT_PAGE = "prefDefaultPage";
public static final String PREF_FILTER_FEED = "prefSubscriptionsFilter";
@@ -127,9 +127,12 @@ public class UserPreferences {
public static final int EPISODE_CLEANUP_DEFAULT = 0;
// Constants
- private static final int NOTIFICATION_BUTTON_REWIND = 0;
- private static final int NOTIFICATION_BUTTON_FAST_FORWARD = 1;
- private static final int NOTIFICATION_BUTTON_SKIP = 2;
+ public static final int NOTIFICATION_BUTTON_REWIND = 0;
+ public static final int NOTIFICATION_BUTTON_FAST_FORWARD = 1;
+ public static final int NOTIFICATION_BUTTON_SKIP = 2;
+
+ public static final int NOTIFICATION_BUTTON_NEXT_CHAPTER = 3;
+ public static final int NOTIFICATION_BUTTON_PLAYBACK_SPEED = 4;
public static final int EPISODE_CACHE_SIZE_UNLIMITED = -1;
public static final int FEED_ORDER_COUNTER = 0;
public static final int FEED_ORDER_ALPHABETICAL = 1;
@@ -195,11 +198,11 @@ public class UserPreferences {
return new ArrayList<>(Arrays.asList(TextUtils.split(hiddenItems, ",")));
}
- public static List<Integer> getCompactNotificationButtons() {
+ public static List<Integer> getFullNotificationButtons() {
String[] buttons = TextUtils.split(
- prefs.getString(PREF_COMPACT_NOTIFICATION_BUTTONS,
- NOTIFICATION_BUTTON_REWIND + "," + NOTIFICATION_BUTTON_FAST_FORWARD),
- ",");
+ prefs.getString(PREF_FULL_NOTIFICATION_BUTTONS,
+ NOTIFICATION_BUTTON_SKIP + "," + NOTIFICATION_BUTTON_PLAYBACK_SPEED), ",");
+
List<Integer> notificationButtons = new ArrayList<>();
for (String button : buttons) {
notificationButtons.add(Integer.parseInt(button));
@@ -208,27 +211,28 @@ public class UserPreferences {
}
/**
- * Helper function to return whether the specified button should be shown on compact
+ * Helper function to return whether the specified button should be shown on full
* notifications.
*
- * @param buttonId Either NOTIFICATION_BUTTON_REWIND, NOTIFICATION_BUTTON_FAST_FORWARD or
- * NOTIFICATION_BUTTON_SKIP.
+ * @param buttonId Either NOTIFICATION_BUTTON_REWIND, NOTIFICATION_BUTTON_FAST_FORWARD,
+ * NOTIFICATION_BUTTON_SKIP, NOTIFICATION_BUTTON_PLAYBACK_SPEED
+ * or NOTIFICATION_BUTTON_NEXT_CHAPTER.
* @return {@code true} if button should be shown, {@code false} otherwise
*/
- private static boolean showButtonOnCompactNotification(int buttonId) {
- return getCompactNotificationButtons().contains(buttonId);
+ private static boolean showButtonOnFullNotification(int buttonId) {
+ return getFullNotificationButtons().contains(buttonId);
}
- public static boolean showRewindOnCompactNotification() {
- return showButtonOnCompactNotification(NOTIFICATION_BUTTON_REWIND);
+ public static boolean showSkipOnFullNotification() {
+ return showButtonOnFullNotification(NOTIFICATION_BUTTON_SKIP);
}
- public static boolean showFastForwardOnCompactNotification() {
- return showButtonOnCompactNotification(NOTIFICATION_BUTTON_FAST_FORWARD);
+ public static boolean showNextChapterOnFullNotification() {
+ return showButtonOnFullNotification(NOTIFICATION_BUTTON_NEXT_CHAPTER);
}
- public static boolean showSkipOnCompactNotification() {
- return showButtonOnCompactNotification(NOTIFICATION_BUTTON_SKIP);
+ public static boolean showPlaybackSpeedOnFullNotification() {
+ return showButtonOnFullNotification(NOTIFICATION_BUTTON_PLAYBACK_SPEED);
}
public static int getFeedOrder() {
@@ -653,10 +657,10 @@ public class UserPreferences {
.apply();
}
- public static void setCompactNotificationButtons(List<Integer> items) {
+ public static void setFullNotificationButtons(List<Integer> items) {
String str = TextUtils.join(",", items);
prefs.edit()
- .putString(PREF_COMPACT_NOTIFICATION_BUTTONS, str)
+ .putString(PREF_FULL_NOTIFICATION_BUTTONS, str)
.apply();
}