mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 07:03:35 +00:00
Add settings to pin and unpin playlist in toolbar menu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user