diff options
author | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-15 20:54:40 +0100 |
---|---|---|
committer | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-15 20:58:54 +0100 |
commit | 6262f98e39badde997d3e5793411a398cc062e09 (patch) | |
tree | bca46514bec4d1c0ea8ba9f2a86fc0cd0bf4ff79 /core | |
parent | b3fbb0ec7574cf1090bfb410589753ba8ef51bbb (diff) | |
download | AntennaPod-6262f98e39badde997d3e5793411a398cc062e09.zip |
Add go to page option
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java | 22 | ||||
-rw-r--r-- | core/src/main/res/values/arrays.xml | 8 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 4 |
3 files changed, 31 insertions, 3 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 c80cfacba..f964fd23a 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 @@ -52,7 +52,8 @@ public class UserPreferences { public static final String PREF_COMPACT_NOTIFICATION_BUTTONS = "prefCompactNotificationButtons"; public static final String PREF_LOCKSCREEN_BACKGROUND = "prefLockscreenBackground"; private static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport"; - private static final String PREF_BACK_BUTTON_BEHAVIOR = "prefBackButtonBehavior"; + public static final String PREF_BACK_BUTTON_BEHAVIOR = "prefBackButtonBehavior"; + private static final String PREF_BACK_BUTTON_GO_TO_PAGE = "prefBackButtonGoToPage"; // Queue private static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront"; @@ -812,7 +813,7 @@ public class UserPreferences { } public enum BackButtonBehavior { - DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT + DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_QUEUE, GO_TO_EPISODES, GO_TO_SUBSCRIPTIONS } public static BackButtonBehavior getBackButtonBehavior() { @@ -821,7 +822,24 @@ public class UserPreferences { case "drawer": return BackButtonBehavior.OPEN_DRAWER; case "doubletap": return BackButtonBehavior.DOUBLE_TAP; case "prompt": return BackButtonBehavior.SHOW_PROMPT; + case "page": + switch (UserPreferences.getBackButtonGoToPage()) { + case 0: return BackButtonBehavior.GO_TO_QUEUE; + case 1: return BackButtonBehavior.GO_TO_EPISODES; + case 2: return BackButtonBehavior.GO_TO_SUBSCRIPTIONS; + default: return BackButtonBehavior.GO_TO_QUEUE; + } default: return BackButtonBehavior.DEFAULT; } } + + public static int getBackButtonGoToPage() { + return prefs.getInt(PREF_BACK_BUTTON_GO_TO_PAGE, 0); + } + + public static void setBackButtonGoToPage(int page) { + prefs.edit() + .putInt(PREF_BACK_BUTTON_GO_TO_PAGE, page) + .apply(); + } } diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml index 2d84cbd70..3a618b8c2 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -280,6 +280,7 @@ <string-array name="back_button_behavior_options"> <item>@string/back_button_default</item> + <item>@string/back_button_go_to_page</item> <item>@string/back_button_open_drawer</item> <item>@string/back_button_double_tap</item> <item>@string/back_button_show_prompt</item> @@ -287,8 +288,15 @@ <string-array name="back_button_behavior_values"> <item>default</item> + <item>page</item> <item>drawer</item> <item>doubletap</item> <item>prompt</item> </string-array> + + <string-array name="back_button_go_to_pages"> + <item>@string/queue_label</item> + <item>@string/episodes_label</item> + <item>@string/subscriptions_label</item> + </string-array> </resources> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index fd5535462..1a3c2373c 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -471,7 +471,7 @@ <string name="stop_playback">Stop playback</string> <string name="continue_playback">Continue audio playback</string> <string name="behavior">Behavior</string> - <string name="pref_back_button_behavior_title">Back button behavior</string> + <string name="pref_back_button_behavior_title">Back Button Behavior</string> <string name="pref_back_button_behavior_sum">Change behavior of the back button.</string> <string name="back_button_default">Default</string> <string name="back_button_open_drawer">Open navigation drawer</string> @@ -479,6 +479,8 @@ <string name="back_button_show_prompt">Confirm to exit</string> <string name="close_prompt">Are you sure you want to close AntennaPod?</string> <string name="double_tap_toast">Tap back button again to exit</string> + <string name="back_button_go_to_page">Go to page</string> + <string name="back_button_go_to_page_title">Select page</string> <!-- Auto-Flattr dialog --> <string name="auto_flattr_enable">Enable automatic flattring</string> |