mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 07:03:35 +00:00
Order pinned playlists in playlist catalogue
This commit is contained in:
@@ -23,6 +23,7 @@ public class PlaylistCatalogueViewModel extends AndroidViewModel {
|
||||
private String type;
|
||||
|
||||
private MutableLiveData<List<Playlist>> playlistList;
|
||||
private MutableLiveData<List<Playlist>> pinnedPlaylistList;
|
||||
|
||||
public PlaylistCatalogueViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
@@ -48,6 +49,20 @@ public class PlaylistCatalogueViewModel extends AndroidViewModel {
|
||||
return playlistList;
|
||||
}
|
||||
|
||||
public LiveData<List<Playlist>> getPinnedPlaylistList(FragmentActivity activity) {
|
||||
pinnedPlaylistList = new MutableLiveData<>(new ArrayList<>());
|
||||
playlistRepository.getPinnedPlaylists().observe(activity, playlists -> pinnedPlaylistList.postValue(playlists));
|
||||
return pinnedPlaylistList;
|
||||
}
|
||||
|
||||
public void unpinPlaylist(List<Playlist> playlists) {
|
||||
if(type.equals(Playlist.ALL)) {
|
||||
for(Playlist playlist: playlists) {
|
||||
playlistRepository.delete(playlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user