diff options
author | Tim Schumacher <tim@timakro.de> | 2021-02-03 12:50:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 12:50:01 +0100 |
commit | 1297a168507d691a29092c89f46000736a753a04 (patch) | |
tree | 13576e693ea67242d90c1c73abbd51c153e19243 /app/src/main | |
parent | 4ff6ff4fb73614de6498f9562bbbf392f69a6fae (diff) | |
download | AntennaPod-1297a168507d691a29092c89f46000736a753a04.zip |
Allow remapping hardware buttons (#4881)
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java | 12 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences_playback.xml | 29 |
2 files changed, 29 insertions, 12 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java index 311f44881..03a8edbf0 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.preferences; import android.content.Context; import android.content.SharedPreferences; +import android.view.KeyEvent; import androidx.preference.PreferenceManager; import de.danoeh.antennapod.BuildConfig; @@ -92,5 +93,16 @@ public class PreferenceUpgrader { if (oldVersion < 1080100) { prefs.edit().putString(UserPreferences.PREF_VIDEO_BEHAVIOR, "pip").apply(); } + if (oldVersion < 2010300) { + // Migrate hardware button preferences + if (prefs.getBoolean("prefHardwareForwardButtonSkips", false)) { + prefs.edit().putString(UserPreferences.PREF_HARDWARE_FORWARD_BUTTON, + String.valueOf(KeyEvent.KEYCODE_MEDIA_NEXT)).apply(); + } + if (prefs.getBoolean("prefHardwarePreviousButtonRestarts", false)) { + prefs.edit().putString(UserPreferences.PREF_HARDWARE_PREVIOUS_BUTTON, + String.valueOf(KeyEvent.KEYCODE_MEDIA_PREVIOUS)).apply(); + } + } } } diff --git a/app/src/main/res/xml/preferences_playback.xml b/app/src/main/res/xml/preferences_playback.xml index d2999c59d..2be8492eb 100644 --- a/app/src/main/res/xml/preferences_playback.xml +++ b/app/src/main/res/xml/preferences_playback.xml @@ -44,18 +44,6 @@ </PreferenceCategory> <PreferenceCategory android:title="@string/playback_control"> - <SwitchPreferenceCompat - android:defaultValue="false" - android:enabled="true" - android:key="prefHardwareForwardButtonSkips" - android:summary="@string/pref_hardwareForwardButtonSkips_sum" - android:title="@string/pref_hardwareForwardButtonSkips_title"/> - <SwitchPreferenceCompat - android:defaultValue="false" - android:enabled="true" - android:key="prefHardwarePreviousButtonRestarts" - android:summary="@string/pref_hardwarePreviousButtonRestarts_sum" - android:title="@string/pref_hardwarePreviousButtonRestarts_title"/> <Preference android:key="prefPlaybackFastForwardDeltaLauncher" android:summary="@string/pref_fast_forward_sum" @@ -80,6 +68,23 @@ android:title="@string/pref_stream_over_download_title"/> </PreferenceCategory> + <PreferenceCategory android:title="@string/reassign_hardware_buttons"> + <ListPreference + android:defaultValue="@string/keycode_media_fast_forward" + android:entries="@array/button_action_options" + android:entryValues="@array/button_action_values" + android:key="prefHardwareForwardButton" + android:title="@string/pref_hardware_forward_button_title" + android:summary="@string/pref_hardware_forward_button_summary"/> + <ListPreference + android:defaultValue="@string/keycode_media_rewind" + android:entries="@array/button_action_options" + android:entryValues="@array/button_action_values" + android:key="prefHardwarePreviousButton" + android:title="@string/pref_hardware_previous_button_title" + android:summary="@string/pref_hardware_previous_button_summary"/> + </PreferenceCategory> + <PreferenceCategory android:title="@string/queue_label"> <SwitchPreferenceCompat android:defaultValue="true" |