mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Added a viewpager on the music playback screen to display the lyrics
This commit is contained in:
parent
84fc07efe7
commit
d8662820f7
15 changed files with 176 additions and 162 deletions
|
|
@ -29,7 +29,9 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
|||
private final ArtistRepository artistRepository;
|
||||
private final QueueRepository queueRepository;
|
||||
|
||||
private final MutableLiveData<String> songLyrics = new MutableLiveData<>(null);
|
||||
private final MutableLiveData<String> lyricsLiveData = new MutableLiveData<>(null);
|
||||
private final MutableLiveData<Song> songLiveData = new MutableLiveData<>(null);
|
||||
|
||||
private final LiveData<List<Queue>> queueSong;
|
||||
|
||||
public PlayerBottomSheetViewModel(@NonNull Application application) {
|
||||
|
|
@ -81,11 +83,17 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
|||
return artistRepository.getArtist(song.getArtistId());
|
||||
}
|
||||
|
||||
public LiveData<String> getLyrics() {
|
||||
return songLyrics;
|
||||
public LiveData<Song> getLiveSong() {
|
||||
return songLiveData;
|
||||
}
|
||||
|
||||
public void refreshSongLyrics(LifecycleOwner owner, Song song) {
|
||||
songRepository.getSongLyrics(song).observe(owner, songLyrics::postValue);
|
||||
public LiveData<String> getLiveLyrics() {
|
||||
return lyricsLiveData;
|
||||
}
|
||||
|
||||
public void refreshSongInfo(LifecycleOwner owner, Song song) {
|
||||
songLiveData.postValue(song);
|
||||
songRepository.getSongLyrics(song).observe(owner, lyricsLiveData::postValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue