mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Implementation of the display of song lyrics where present
This commit is contained in:
parent
12ce97836d
commit
40cbf289af
8 changed files with 148 additions and 14 deletions
|
|
@ -5,7 +5,9 @@ import android.content.Context;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
|
|
@ -27,6 +29,7 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
|||
private final ArtistRepository artistRepository;
|
||||
private final QueueRepository queueRepository;
|
||||
|
||||
private final MutableLiveData<String> songLyrics = new MutableLiveData<>(null);
|
||||
private final LiveData<List<Queue>> queueSong;
|
||||
|
||||
public PlayerBottomSheetViewModel(@NonNull Application application) {
|
||||
|
|
@ -77,4 +80,12 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
|||
Song song = getCurrentSong();
|
||||
return artistRepository.getArtist(song.getArtistId());
|
||||
}
|
||||
|
||||
public LiveData<String> getLyrics() {
|
||||
return songLyrics;
|
||||
}
|
||||
|
||||
public void refreshSongLyrics(LifecycleOwner owner, Song song) {
|
||||
songRepository.getSongLyrics(song).observe(owner, songLyrics::postValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue