diff --git a/app/src/main/java/com/maxrave/simpmusic/data/repository/MainRepository.kt b/app/src/main/java/com/maxrave/simpmusic/data/repository/MainRepository.kt index c30301d9..81362176 100644 --- a/app/src/main/java/com/maxrave/simpmusic/data/repository/MainRepository.kt +++ b/app/src/main/java/com/maxrave/simpmusic/data/repository/MainRepository.kt @@ -426,7 +426,7 @@ class MainRepository( localDataSource.insertSongInfo(songInfo) } - suspend fun getSongInfoEntiy(videoId: String): Flow = + suspend fun getSongInfoEntity(videoId: String): Flow = flow { emit(localDataSource.getSongInfo(videoId)) }.flowOn(Dispatchers.Main) suspend fun recoverQueue(temp: List) { @@ -2617,7 +2617,7 @@ class MainRepository( ) }.onFailure { it.printStackTrace() - emit(getSongInfoEntiy(videoId).firstOrNull()) + emit(getSongInfoEntity(videoId).firstOrNull()) } } }.flowOn(Dispatchers.IO) diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt index cd161861..86c7793c 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt @@ -61,7 +61,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter -import androidx.compose.ui.graphics.ColorMatrix import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext @@ -547,12 +546,9 @@ fun ActionButton( Modifier .fillMaxWidth() .wrapContentHeight(Alignment.CenterVertically) - .clickable { - if (enable) onClick() - } - .apply { - if (!enable) greyScale() - }, + .then( + if (enable) Modifier.clickable { onClick.invoke() } else Modifier.greyScale() + ), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -571,20 +567,14 @@ fun ActionButton( if (enable) { ColorFilter.tint(iconColor) } else { - ColorFilter.colorMatrix( - ColorMatrix().apply { - setToSaturation( - 0f, - ) - }, - ) + ColorFilter.tint(Color.Gray) }, ) Text( text = if (text != null) stringResource(text) else textString ?: "", style = typo.labelSmall, - color = textColor ?: Color.Unspecified, + color = if (enable) textColor ?: Color.Unspecified else Color.Gray, modifier = Modifier .padding(start = 10.dp) diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt b/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt index 6d261904..9417a7f9 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt @@ -109,8 +109,8 @@ import com.maxrave.simpmusic.ui.component.EndOfPage import com.maxrave.simpmusic.ui.component.LoadingDialog import com.maxrave.simpmusic.ui.component.LocalPlaylistBottomSheet import com.maxrave.simpmusic.ui.component.NowPlayingBottomSheet -import com.maxrave.simpmusic.ui.component.SongFullWidthItems import com.maxrave.simpmusic.ui.component.RippleIconButton +import com.maxrave.simpmusic.ui.component.SongFullWidthItems import com.maxrave.simpmusic.ui.component.SuggestItems import com.maxrave.simpmusic.ui.theme.md_theme_dark_background import com.maxrave.simpmusic.ui.theme.typo @@ -188,7 +188,7 @@ fun PlaylistScreen( val playingTrack by sharedViewModel.nowPlayingState .mapLatest { - it?.mediaItem + it?.songEntity }.collectAsState(initial = null) val isPlaying by sharedViewModel.controllerState.map { it.isPlaying }.collectAsState(initial = false) val suggestedTracks by viewModel.uiState.map { it.suggestions?.songs ?: emptyList() }.collectAsState(initial = emptyList()) @@ -630,7 +630,7 @@ fun PlaylistScreen( suggestedTracks.forEachIndexed { index, track -> SuggestItems( track = track, - isPlaying = playingTrack?.mediaId == track.videoId, + isPlaying = playingTrack?.videoId == track.videoId, onAddClickListener = { viewModel.addSuggestTrackToListTrack( track, @@ -754,7 +754,7 @@ fun PlaylistScreen( }) { index -> val item = trackPagingItems[index] if (item != null) { - if (playingTrack?.mediaId == item.videoId && isPlaying) { + if (playingTrack?.videoId == item.videoId && isPlaying) { SongFullWidthItems( isPlaying = true, songEntity = item,