mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 07:03:35 +00:00
Implementation of the display of song lyrics where present
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user