mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Rewriting classes in kotlin
This commit is contained in:
parent
74ec37cb5e
commit
103cd308de
43 changed files with 818 additions and 2325 deletions
|
|
@ -45,12 +45,12 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public void setFavorite() {
|
||||
if (album.isFavorite()) {
|
||||
if (Boolean.TRUE.equals(album.getStarred())) {
|
||||
artistRepository.unstar(album.getId());
|
||||
album.setFavorite(false);
|
||||
album.setStarred(false);
|
||||
} else {
|
||||
artistRepository.star(album.getId());
|
||||
album.setFavorite(true);
|
||||
album.setStarred(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public void setFavorite() {
|
||||
if (artist.isFavorite()) {
|
||||
if (Boolean.TRUE.equals(artist.getStarred())) {
|
||||
albumRepository.unstar(artist.getId());
|
||||
artist.setFavorite(false);
|
||||
artist.setStarred(false);
|
||||
} else {
|
||||
albumRepository.star(artist.getId());
|
||||
artist.setFavorite(true);
|
||||
artist.setStarred(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import android.app.Application;
|
|||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
|
|
@ -22,6 +24,7 @@ import com.cappielloantonio.play.util.PreferenceUtil;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "PlayerBottomSheetViewModel";
|
||||
|
||||
|
|
@ -50,7 +53,7 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
|||
|
||||
public void setFavorite(Context context, Media media) {
|
||||
if (media != null) {
|
||||
if (media.isStarred()) {
|
||||
if (Boolean.TRUE.equals(media.getStarred())) {
|
||||
songRepository.unstar(media.getId());
|
||||
media.setStarred(false);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public void setFavorite(Context context) {
|
||||
if (song.isStarred()) {
|
||||
if (Boolean.TRUE.equals(song.getStarred())) {
|
||||
songRepository.unstar(song.getId());
|
||||
song.setStarred(false);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue