Only report unknown keycode if PlaybackService is playing
This commit is contained in:
parent
cdf663ffa5
commit
45646d4c26
|
@ -243,7 +243,7 @@
|
|||
<string name="pref_gpodnet_setlogin_information_sum">Change the login information for your gpodder.net account.</string>
|
||||
<string name="pref_playback_speed_title">Playback Speeds</string>
|
||||
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
|
||||
<string name="pref_seek_delta_title">Seek Time</string>
|
||||
<string name="pref_seek_delta_title">Seek time</string>
|
||||
<string name="pref_seek_delta_sum">Seek this many seconds when rewinding or fast-forwarding</string>
|
||||
<string name="pref_gpodnet_sethostname_title">Set hostname</string>
|
||||
<string name="pref_gpodnet_sethostname_use_default_host">Use default host</string>
|
||||
|
|
|
@ -282,7 +282,8 @@ public class PlaybackService extends Service {
|
|||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Handling keycode: " + keycode);
|
||||
|
||||
final PlayerStatus status = mediaPlayer.getPSMPInfo().playerStatus;
|
||||
final PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo();
|
||||
final PlayerStatus status = info.playerStatus;
|
||||
switch (keycode) {
|
||||
case KeyEvent.KEYCODE_HEADSETHOOK:
|
||||
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
|
||||
|
@ -319,8 +320,10 @@ public class PlaybackService extends Service {
|
|||
mediaPlayer.seekDelta(-UserPreferences.getSeekDeltaMs());
|
||||
break;
|
||||
default:
|
||||
String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
if (info.playable != null && info.playerStatus == PlayerStatus.PLAYING) { // only notify the user about an unknown key event if it is actually doing something
|
||||
String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue