android-odeon icon indicating copy to clipboard operation
android-odeon copied to clipboard

Playlist tab is not refreshed after creating a playlist

Open thibseisel opened this issue 5 years ago • 0 comments

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:

  1. Click on the "Playlists" tab
  2. Go back to "Tracks" tab
  3. In the list, select the option to add any track to a playlist
  4. In the opened dialog, select "New playlist"
  5. Give it any name, then click "OK"
  6. 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:

  1. Share Flows returned by BrowserClient.getChildren(String), so that the same subscription is reused and not replaced. ConflatedBroadcastChannel may be an option.
  2. Make both UI portions observe the same playlists LiveData.

thibseisel avatar Apr 28 '20 12:04 thibseisel