Change the status icon when paused
This commit is contained in:
parent
1cb8c398ce
commit
00aedee9ad
BIN
res/drawable/status_icon_paused.png
Normal file
BIN
res/drawable/status_icon_paused.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -509,17 +509,21 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
|
|||||||
}
|
}
|
||||||
|
|
||||||
String title = song.title;
|
String title = song.title;
|
||||||
if (mState != STATE_PLAYING)
|
int statusIcon = R.drawable.status_icon;
|
||||||
|
|
||||||
|
if (mState != STATE_PLAYING) {
|
||||||
title += ' ' + getResources().getString(R.string.paused);
|
title += ' ' + getResources().getString(R.string.paused);
|
||||||
|
statusIcon = R.drawable.status_icon_paused;
|
||||||
|
}
|
||||||
|
|
||||||
RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
|
RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
|
||||||
views.setImageViewResource(R.id.icon, R.drawable.status_icon);
|
views.setImageViewResource(R.id.icon, statusIcon);
|
||||||
views.setTextViewText(R.id.title, title);
|
views.setTextViewText(R.id.title, title);
|
||||||
views.setTextViewText(R.id.artist, song.artist);
|
views.setTextViewText(R.id.artist, song.artist);
|
||||||
|
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
notification.contentView = views;
|
notification.contentView = views;
|
||||||
notification.icon = R.drawable.status_icon;
|
notification.icon = statusIcon;
|
||||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||||
Intent intent = new Intent(this, mUseRemotePlayer ? RemoteActivity.class : NowPlayingActivity.class);
|
Intent intent = new Intent(this, mUseRemotePlayer ? RemoteActivity.class : NowPlayingActivity.class);
|
||||||
notification.contentIntent = PendingIntent.getActivity(ContextApplication.getContext(), 0, intent, 0);
|
notification.contentIntent = PendingIntent.getActivity(ContextApplication.getContext(), 0, intent, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user