Code Cleanup
This commit is contained in:
parent
e4a6906231
commit
8f56663059
1 changed files with 6 additions and 11 deletions
|
@ -52,7 +52,6 @@ import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import code.name.monkey.retromusic.util.logD
|
import code.name.monkey.retromusic.util.logD
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
|
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
|
||||||
ViewPager.OnPageChangeListener, MusicProgressViewUpdateHelper.Callback,
|
ViewPager.OnPageChangeListener, MusicProgressViewUpdateHelper.Callback,
|
||||||
|
@ -86,22 +85,18 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLyrics() {
|
private fun updateLyrics() {
|
||||||
binding.lyricsView.setLabel(context?.getString(R.string.no_lyrics_found))
|
|
||||||
val song = MusicPlayerRemote.currentSong
|
val song = MusicPlayerRemote.currentSong
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
||||||
if (lrcFile != null) {
|
if (lrcFile != null) {
|
||||||
withContext(Dispatchers.Main) {
|
binding.lyricsView.loadLrc(lrcFile)
|
||||||
binding.lyricsView.loadLrc(lrcFile)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
val embeddedLyrics = LyricUtil.getEmbeddedSyncedLyrics(song.data)
|
val embeddedLyrics = LyricUtil.getEmbeddedSyncedLyrics(song.data)
|
||||||
withContext(Dispatchers.Main) {
|
if (embeddedLyrics != null) {
|
||||||
if (embeddedLyrics != null) {
|
binding.lyricsView.loadLrc(embeddedLyrics)
|
||||||
binding.lyricsView.loadLrc(embeddedLyrics)
|
} else {
|
||||||
} else {
|
binding.lyricsView.reset()
|
||||||
binding.lyricsView.reset()
|
binding.lyricsView.setLabel(context?.getString(R.string.no_lyrics_found))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue