mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Add settings to pin and unpin playlist in toolbar menu
This commit is contained in:
parent
afe0e0751c
commit
e29b96d905
11 changed files with 170 additions and 5 deletions
|
|
@ -57,4 +57,18 @@ public class PlaylistPageViewModel extends AndroidViewModel {
|
|||
public boolean isOffline() {
|
||||
return isOffline;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> isPinned(FragmentActivity activity) {
|
||||
MutableLiveData<Boolean> isPinnedLive = new MutableLiveData<>();
|
||||
playlistRepository.getPinnedPlaylists().observe(activity, playlists -> isPinnedLive.postValue(playlists.contains(playlist)));
|
||||
return isPinnedLive;
|
||||
}
|
||||
|
||||
public void setPinned(boolean isNowPinned) {
|
||||
if(isNowPinned) {
|
||||
playlistRepository.insert(playlist);
|
||||
} else {
|
||||
playlistRepository.delete(playlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue