Skip to content

Commit 6e41337

Browse files
author
Chris Bellew
committed
[Wear] Remove title and subtitle when receiving media stopped event.
1 parent 65aa771 commit 6e41337

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wear/src/main/java/com/atomjack/wear/WearListenerService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ public void onMessageReceived(MessageEvent messageEvent) {
101101
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
102102
startActivity(intent);
103103
} else if(message.equals(WearConstants.MEDIA_STOPPED)) {
104+
nowPlayingMedia = new DataMap();
104105
mNotifyMgr.cancel(NOTIFICATION_ID);
105106
} else if(message.equals(WearConstants.MEDIA_PLAYING) || message.equals(WearConstants.MEDIA_PAUSED)) {
106107
if(dataMap.getBoolean(WearConstants.LAUNCHED, false)) {
107108
finishMain();
108109
}
110+
// First, remove previous title and subtitle, if there are any
111+
nowPlayingMedia.remove(WearConstants.MEDIA_TITLE);
112+
nowPlayingMedia.remove(WearConstants.MEDIA_SUBTITLE);
109113
nowPlayingMedia = WearApplication.getInstance().nowPlayingMedia;
110114
nowPlayingMedia.putAll(dataMap);
111115
nowPlayingMedia.putString(WearConstants.PLAYBACK_STATE, message.equals(WearConstants.MEDIA_PLAYING) ? PlayerState.PLAYING.name() : PlayerState.PAUSED.name());

0 commit comments

Comments
 (0)