reset song data on Unbind
This commit is contained in:
parent
745dc3cb94
commit
a28f8cc53e
2 changed files with 11 additions and 3 deletions
|
@ -219,6 +219,9 @@ public class MusicService extends Service
|
|||
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
bus.post(new Events.SongChanged(null));
|
||||
songStateChanged(false);
|
||||
|
||||
if (player != null && !player.isPlaying()) {
|
||||
destroyPlayer();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class MyWidgetProvider extends AppWidgetProvider {
|
|||
|
||||
intent = new Intent(context, MyWidgetProvider.class);
|
||||
setupButtons(appWidgetManager);
|
||||
updateSongInfo();
|
||||
}
|
||||
|
||||
private void setupIntent(String action, int id) {
|
||||
|
@ -65,11 +66,15 @@ public class MyWidgetProvider extends AppWidgetProvider {
|
|||
}
|
||||
|
||||
private void updateSongInfo() {
|
||||
String title = "";
|
||||
String artist = "";
|
||||
if (currSong != null) {
|
||||
remoteViews.setTextViewText(R.id.songTitle, currSong.getTitle());
|
||||
remoteViews.setTextViewText(R.id.songArtist, currSong.getArtist());
|
||||
updateWidget();
|
||||
title = currSong.getTitle();
|
||||
artist = currSong.getArtist();
|
||||
}
|
||||
remoteViews.setTextViewText(R.id.songTitle, title);
|
||||
remoteViews.setTextViewText(R.id.songArtist, artist);
|
||||
updateWidget();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
Loading…
Reference in a new issue