Show a toast when an unknown media key is pressed

This is just an idea.  If people want more media keys supported, they
will be able to use this toast to report exactly what key codes their
hardware is generating.

If you don't want to include this, just let me know and I can remove it
from the pull request.
This commit is contained in:
David Reiss 2014-06-07 16:24:03 -07:00
parent 12660478a8
commit a78c5173dc
2 changed files with 6 additions and 0 deletions

View File

@ -147,6 +147,7 @@
<string name="position_default_label">00:00:00</string>
<string name="player_buffering_msg">Buffering</string>
<string name="playbackservice_notification_title">Playing podcast</string>
<string name="unknown_media_key">AntennaPod - Unknown media key: %1$d</string>
<!-- Queue operations -->
<string name="clear_queue_label">Clear queue</string>

View File

@ -22,6 +22,7 @@ import android.util.Log;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.widget.Toast;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
@ -318,6 +319,10 @@ public class PlaybackService extends Service {
case KeyEvent.KEYCODE_MEDIA_REWIND:
mediaPlayer.seekDelta(-PlaybackController.DEFAULT_SEEK_DELTA);
break;
default:
String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
break;
}
}