show number in queue

This commit is contained in:
Tony Tam 2020-11-25 17:10:47 -08:00
parent a8fbb97cfe
commit 8f0cbb2a88
2 changed files with 16 additions and 1 deletions

View File

@ -377,10 +377,20 @@ public class PlaybackService extends MediaBrowserServiceCompat {
.appendPath(getResources().getResourceTypeName(R.drawable.ic_playlist_black))
.appendPath(getResources().getResourceEntryName(R.drawable.ic_playlist_black))
.build();
String subtitle = "";
try {
int count = taskManager.getQueue().size();
subtitle = getResources().getQuantityString(R.plurals.num_episodes, count, count);
} catch (InterruptedException e) {
e.printStackTrace();
}
MediaDescriptionCompat description = new MediaDescriptionCompat.Builder()
.setMediaUri(uri)
.setIconUri(uri)
.setMediaId(getResources().getString(R.string.queue_label))
.setTitle(getResources().getString(R.string.queue_label))
.setSubtitle(subtitle)
.build();
return new MediaBrowserCompat.MediaItem(description,
MediaBrowserCompat.MediaItem.FLAG_BROWSABLE);

View File

@ -125,6 +125,11 @@
<item quantity="one">%d selected</item>
<item quantity="other">%d selected</item>
</plurals>
<plurals name="num_episodes">
<item quantity="zero">no episodes</item>
<item quantity="one">%d episode</item>
<item quantity="other">%d episodes</item>
</plurals>
<string name="loading_more">Loading more…</string>
<!-- Actions on feeds -->