reset song data on Unbind

This commit is contained in:
tibbi 2016-01-24 16:04:46 +01:00
parent 745dc3cb94
commit a28f8cc53e
2 changed files with 11 additions and 3 deletions

View file

@ -219,6 +219,9 @@ public class MusicService extends Service
@Override @Override
public boolean onUnbind(Intent intent) { public boolean onUnbind(Intent intent) {
bus.post(new Events.SongChanged(null));
songStateChanged(false);
if (player != null && !player.isPlaying()) { if (player != null && !player.isPlaying()) {
destroyPlayer(); destroyPlayer();
} }

View file

@ -34,6 +34,7 @@ public class MyWidgetProvider extends AppWidgetProvider {
intent = new Intent(context, MyWidgetProvider.class); intent = new Intent(context, MyWidgetProvider.class);
setupButtons(appWidgetManager); setupButtons(appWidgetManager);
updateSongInfo();
} }
private void setupIntent(String action, int id) { private void setupIntent(String action, int id) {
@ -65,11 +66,15 @@ public class MyWidgetProvider extends AppWidgetProvider {
} }
private void updateSongInfo() { private void updateSongInfo() {
String title = "";
String artist = "";
if (currSong != null) { if (currSong != null) {
remoteViews.setTextViewText(R.id.songTitle, currSong.getTitle()); title = currSong.getTitle();
remoteViews.setTextViewText(R.id.songArtist, currSong.getArtist()); artist = currSong.getArtist();
updateWidget();
} }
remoteViews.setTextViewText(R.id.songTitle, title);
remoteViews.setTextViewText(R.id.songArtist, artist);
updateWidget();
} }
@Subscribe @Subscribe