use persistant notification option for persistant lockscreen controls

This commit is contained in:
Mike Chelen 2014-09-28 22:57:54 -04:00
parent b43037c958
commit ab59b83d21
2 changed files with 17 additions and 2 deletions

View File

@ -254,7 +254,7 @@
<string name="pref_expandNotify_title">Expand Notification</string>
<string name="pref_expandNotify_sum">Always expand the notification to show playback buttons.</string>
<string name="pref_persistNotify_title">Persistent Notification</string>
<string name="pref_persistNotify_sum">Keep notification when playback is paused.</string>
<string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused.</string>
<string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string>
<!-- Auto-Flattr dialog -->

View File

@ -292,7 +292,12 @@ public class PlaybackService extends Service {
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
if (status == PlayerStatus.PLAYING) {
mediaPlayer.pause(true, true);
if (UserPreferences.isPersistNotify()) {
mediaPlayer.pause(false, true);
}
else {
mediaPlayer.pause(true, true);
}
} else if (status == PlayerStatus.PAUSED || status == PlayerStatus.PREPARED) {
mediaPlayer.resume();
} else if (status == PlayerStatus.PREPARING) {
@ -312,7 +317,12 @@ public class PlaybackService extends Service {
break;
case KeyEvent.KEYCODE_MEDIA_PAUSE:
if (status == PlayerStatus.PLAYING) {
if (UserPreferences.isPersistNotify()) {
mediaPlayer.pause(false, true);
}
else {
mediaPlayer.pause(true, true);
}
}
break;
case KeyEvent.KEYCODE_MEDIA_NEXT:
@ -975,7 +985,12 @@ public class PlaybackService extends Service {
*/
private void pauseIfPauseOnDisconnect() {
if (UserPreferences.isPauseOnHeadsetDisconnect()) {
if (UserPreferences.isPersistNotify()) {
mediaPlayer.pause(false, true);
}
else {
mediaPlayer.pause(true, true);
}
}
}