The viewmodels have been modified to not repeat calls to the backend during the lifecycle of the fragment

This commit is contained in:
antonio
2022-09-05 08:21:01 +02:00
parent 6817fa739e
commit 8b883c88fc
6 changed files with 87 additions and 46 deletions

View File

@@ -82,7 +82,7 @@ public class PlaylistChooserDialog extends DialogFragment {
playlistDialogHorizontalAdapter = new PlaylistDialogHorizontalAdapter(requireContext(), playlistChooserViewModel, this);
bind.playlistDialogRecyclerView.setAdapter(playlistDialogHorizontalAdapter);
playlistChooserViewModel.getPlaylistList().observe(getViewLifecycleOwner(), playlists -> {
playlistChooserViewModel.getPlaylistList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), playlists -> {
if (playlists != null) {
if (playlists.size() > 0) {
if (bind != null) bind.noPlaylistsCreatedTextView.setVisibility(View.GONE);