Code refactor
This commit is contained in:
parent
34b5d01e8d
commit
9da8cb99ce
2 changed files with 20 additions and 29 deletions
|
@ -197,7 +197,8 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
|
||||
fun updateIsFavorite() {
|
||||
lifecycleScope.launch(IO) {
|
||||
val playlist: PlaylistEntity = libraryViewModel.favoritePlaylist().first()
|
||||
val playlist: PlaylistEntity? = libraryViewModel.favoritePlaylist().firstOrNull()
|
||||
if (playlist != null) {
|
||||
val song = MusicPlayerRemote.currentSong.toSongEntity(playlist.playListId)
|
||||
val isFavorite = libraryViewModel.isFavoriteSong(song).isNotEmpty()
|
||||
withContext(Main) {
|
||||
|
@ -218,6 +219,7 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLyrics() {
|
||||
setLyrics(null)
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
android:id="@+id/retro_graph"
|
||||
app:startDestination="@id/libraryFragment">
|
||||
|
||||
<include app:graph="@navigation/settings_graph" />
|
||||
|
||||
<include app:graph="@navigation/library_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/genreDetailsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.genres.GenreDetailsFragment"
|
||||
|
@ -53,14 +49,7 @@
|
|||
android:id="@+id/libraryFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.library.LibraryFragment"
|
||||
android:label=""
|
||||
tools:layout="@layout/fragment_library">
|
||||
<action
|
||||
android:id="@+id/action_main_to_library"
|
||||
app:destination="@id/library_graph" />
|
||||
<action
|
||||
android:id="@+id/action_main_to_settings"
|
||||
app:destination="@id/settings_graph" />
|
||||
</fragment>
|
||||
tools:layout="@layout/fragment_library" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/detailListFragment"
|
||||
|
|
Loading…
Reference in a new issue