diff --git a/app/src/main/java/org/listenbrainz/android/ui/components/BrainzPlayerListenCard.kt b/app/src/main/java/org/listenbrainz/android/ui/components/BrainzPlayerListenCard.kt index 42703996..e7150730 100644 --- a/app/src/main/java/org/listenbrainz/android/ui/components/BrainzPlayerListenCard.kt +++ b/app/src/main/java/org/listenbrainz/android/ui/components/BrainzPlayerListenCard.kt @@ -1,11 +1,7 @@ package org.listenbrainz.android.ui.components import androidx.annotation.DrawableRes -import androidx.compose.animation.AnimatedContent -import androidx.compose.animation.core.tween -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.animation.togetherWith +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -20,8 +16,6 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Surface import androidx.compose.runtime.Composable -import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -56,7 +50,6 @@ fun BrainzPlayerListenCard( mediaId: Long? = null, viewModel: BrainzPlayerViewModel = hiltViewModel() ) { - val isPlaying by viewModel.isPlaying.collectAsState() val currentlyPlayingSong = viewModel.currentlyPlayingSong.collectAsStateWithLifecycle().value.toSong val titleColor = if (currentlyPlayingSong.mediaID == mediaId) { Color(0xFFB94FE5) @@ -66,7 +59,8 @@ fun BrainzPlayerListenCard( Surface( modifier = modifier - .fillMaxWidth(), + .fillMaxWidth() + .clickable { onPlayIconClick() }, shape = ListenBrainzTheme.shapes.listenCardSmall, shadowElevation = 4.dp, color = ListenBrainzTheme.colorScheme.level1 @@ -100,19 +94,9 @@ fun BrainzPlayerListenCard( Box(modifier = Modifier .fillMaxWidth(0.275f) .align(Alignment.CenterEnd)){ - DropdownButton (modifier = Modifier.align(Alignment.Center), onDropdownIconClick = onDropdownIconClick) + DropdownButton (modifier = Modifier.align(Alignment.CenterEnd), onDropdownIconClick = onDropdownIconClick) if(dropDownState) dropDown() - PlayButton( - modifier = Modifier.align(Alignment.CenterEnd), - isPlaying = currentlyPlayingSong.mediaID == mediaId && isPlaying, - onPlayIconClick = onPlayIconClick - ) } - - - - - } } } @@ -134,28 +118,6 @@ private fun DropdownButton(modifier: Modifier = Modifier, onDropdownIconClick: ( } } -@Composable -private fun PlayButton(modifier: Modifier = Modifier, onPlayIconClick: () -> Unit, isPlaying: Boolean) { - IconButton( - modifier = modifier, - onClick = onPlayIconClick - ) { - AnimatedContent( - targetState = isPlaying, - transitionSpec = { - fadeIn(animationSpec = tween(200)) togetherWith fadeOut(animationSpec = tween(300)) - } - ) { targetState -> - Icon( - painter = painterResource(id = if (targetState) R.drawable.ic_pause else R.drawable.brainz_player_play_button), - contentDescription = "", - tint = ListenBrainzTheme.colorScheme.hint, - modifier = Modifier.padding(horizontal = ListenBrainzTheme.paddings.insideCard) - ) - } - } -} - @Composable private fun AlbumArt( coverArtUrl: String?, @@ -178,6 +140,4 @@ private fun AlbumArt( filterQuality = FilterQuality.Low, contentDescription = "Album Cover Art" ) -} - - +} \ No newline at end of file