add an icon to the Android Auto queue

This commit is contained in:
Tony Tam 2020-11-25 16:52:20 -08:00
parent 4b252250c0
commit a8fbb97cfe
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import android.app.UiModeManager;
import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothA2dp;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
@ -370,7 +371,14 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} }
private MediaBrowserCompat.MediaItem createBrowsableMediaItemForRoot() { private MediaBrowserCompat.MediaItem createBrowsableMediaItemForRoot() {
Uri uri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
.authority(getResources().getResourcePackageName(R.drawable.ic_playlist_black))
.appendPath(getResources().getResourceTypeName(R.drawable.ic_playlist_black))
.appendPath(getResources().getResourceEntryName(R.drawable.ic_playlist_black))
.build();
MediaDescriptionCompat description = new MediaDescriptionCompat.Builder() MediaDescriptionCompat description = new MediaDescriptionCompat.Builder()
.setMediaUri(uri)
.setMediaId(getResources().getString(R.string.queue_label)) .setMediaId(getResources().getString(R.string.queue_label))
.setTitle(getResources().getString(R.string.queue_label)) .setTitle(getResources().getString(R.string.queue_label))
.build(); .build();