Merge pull request #1424 from TomHennen/optional_hardware_skip

allow users to optionally have hardware forward button skip
This commit is contained in:
Tom Hennen 2015-11-27 10:47:18 -05:00
commit 4b926b44f7
4 changed files with 15 additions and 1 deletions

View File

@ -89,6 +89,12 @@
android:key="prefUnpauseOnBluetoothReconnect"
android:summary="@string/pref_unpauseOnBluetoothReconnect_sum"
android:title="@string/pref_unpauseOnBluetoothReconnect_title"/>
<CheckBoxPreference
android:defaultValue="false"
android:enabled="true"
android:key="prefHardwareForwardButtonSkips"
android:summary="@string/pref_hardwareForwardButtonSkips_sum"
android:title="@string/pref_hardwareForwardButtonSkips_title"/>
<CheckBoxPreference
android:defaultValue="true"
android:enabled="true"

View File

@ -60,6 +60,7 @@ public class UserPreferences {
public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect";
public static final String PREF_UNPAUSE_ON_HEADSET_RECONNECT = "prefUnpauseOnHeadsetReconnect";
public static final String PREF_UNPAUSE_ON_BLUETOOTH_RECONNECT = "prefUnpauseOnBluetoothReconnect";
public static final String PREF_HARDWARE_FOWARD_BUTTON_SKIPS = "prefHardwareForwardButtonSkips";
public static final String PREF_FOLLOW_QUEUE = "prefFollowQueue";
public static final String PREF_SKIP_KEEPS_EPISODE = "prefSkipKeepsEpisode";
public static final String PREF_AUTO_DELETE = "prefAutoDelete";
@ -225,6 +226,10 @@ public class UserPreferences {
return prefs.getBoolean(PREF_UNPAUSE_ON_BLUETOOTH_RECONNECT, false);
}
public static boolean shouldHardwareButtonSkip() {
return prefs.getBoolean(PREF_HARDWARE_FOWARD_BUTTON_SKIPS, false);
}
public static boolean isFollowQueue() {
return prefs.getBoolean(PREF_FOLLOW_QUEUE, true);

View File

@ -1260,7 +1260,8 @@ public class PlaybackServiceMediaPlayer implements SharedPreferences.OnSharedPre
return true;
}
case KeyEvent.KEYCODE_MEDIA_NEXT: {
if(event.getSource() == InputDevice.SOURCE_CLASS_NONE) {
if(event.getSource() == InputDevice.SOURCE_CLASS_NONE ||
UserPreferences.shouldHardwareButtonSkip()) {
// assume the skip command comes from a notification or the lockscreen
// a >| skip button should actually skip
endPlayback(true);

View File

@ -280,6 +280,8 @@
<string name="pref_pauseOnDisconnect_sum">Pause playback when headphones or bluetooth are disconnected</string>
<string name="pref_unpauseOnHeadsetReconnect_sum">Resume playback when the headphones are reconnected</string>
<string name="pref_unpauseOnBluetoothReconnect_sum">Resume playback when bluetooth reconnects</string>
<string name="pref_hardwareForwardButtonSkips_title">Forward button skips</string>
<string name="pref_hardwareForwardButtonSkips_sum">When pressing a hardware forward button skip to the next track instead of fast-forwarding</string>
<string name="pref_followQueue_sum">Jump to next queue item when playback completes</string>
<string name="pref_auto_delete_sum">Delete episode when playback completes</string>
<string name="pref_auto_delete_title">Auto Delete</string>