Add custom rewind and fast forward for Android Auto
This commit is contained in:
parent
3e51442560
commit
3bb2e2ae17
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.service.playback;
|
|||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.app.UiModeManager;
|
||||
import android.bluetooth.BluetoothA2dp;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
|
@ -10,6 +11,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
|
@ -1094,6 +1096,20 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
|
||||
}
|
||||
|
||||
UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE);
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
|
||||
sessionState.addCustomAction(
|
||||
new PlaybackStateCompat.CustomAction.Builder(
|
||||
CUSTOM_ACTION_REWIND,
|
||||
getString(R.string.rewind_label), R.drawable.ic_notification_fast_rewind)
|
||||
.build());
|
||||
sessionState.addCustomAction(
|
||||
new PlaybackStateCompat.CustomAction.Builder(
|
||||
CUSTOM_ACTION_FAST_FORWARD,
|
||||
getString(R.string.fast_forward_label), R.drawable.ic_notification_fast_forward)
|
||||
.build());
|
||||
}
|
||||
|
||||
sessionState.setActions(capabilities);
|
||||
|
||||
flavorHelper.sessionStateAddActionForWear(sessionState,
|
||||
|
|
Loading…
Reference in New Issue