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
|
@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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue