android-odeon
android-odeon copied to clipboard
Playlist tab is not refreshed after creating a playlist
Version: 2.0.3
Summary: After a playlist has been created from the "Tracks" tab, when returning to the "Playlists" tab that new playlist is not displayed. This only happens if the playlist tab has already been displayed before creating. Otherwise the new playlist will be displayed.
Reproducible steps:
- Click on the "Playlists" tab
- Go back to "Tracks" tab
- In the list, select the option to add any track to a playlist
- In the opened dialog, select "New playlist"
- Give it any name, then click "OK"
- Go back to the "Playlists" tab to notice that the new playlist is not there.
Analysis: The list of playlists is displayed twice in the application:
- under the "Playlists" tab,
- when adding a track, the user is prompted to select a target playlist.
Listing playlists results in subscribing/unsubscribing the MediaBrowserCompat in BrowserClientImpl. It seems that MediaBrowserCompat.subscribe(String, Callback) replaces the active subscription if a same media id is subscribed more than once, which is not desirable.
The solution involves one of the following:
- Share
Flows returned byBrowserClient.getChildren(String), so that the same subscription is reused and not replaced.ConflatedBroadcastChannelmay be an option. - Make both UI portions observe the same playlists
LiveData.