mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Order pinned playlists in playlist catalogue
This commit is contained in:
parent
e29b96d905
commit
e2f1212e58
4 changed files with 59 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue