added link to artist page
Clicking on the artist name in the song player below the title of the song will navigate to the artist page more similar to the player on youtube music
This commit is contained in:
parent
964fa42a0f
commit
d9dc30a760
1 changed files with 17 additions and 3 deletions
|
@ -38,10 +38,12 @@ import androidx.media3.common.Player
|
||||||
import it.vfsfitvnm.vimusic.Database
|
import it.vfsfitvnm.vimusic.Database
|
||||||
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
|
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
|
||||||
import it.vfsfitvnm.vimusic.R
|
import it.vfsfitvnm.vimusic.R
|
||||||
|
import it.vfsfitvnm.vimusic.models.Info
|
||||||
import it.vfsfitvnm.vimusic.models.Song
|
import it.vfsfitvnm.vimusic.models.Song
|
||||||
import it.vfsfitvnm.vimusic.query
|
import it.vfsfitvnm.vimusic.query
|
||||||
import it.vfsfitvnm.vimusic.ui.components.SeekBar
|
import it.vfsfitvnm.vimusic.ui.components.SeekBar
|
||||||
import it.vfsfitvnm.vimusic.ui.components.themed.IconButton
|
import it.vfsfitvnm.vimusic.ui.components.themed.IconButton
|
||||||
|
import it.vfsfitvnm.vimusic.ui.screens.artistRoute
|
||||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||||
import it.vfsfitvnm.vimusic.ui.styling.favoritesIcon
|
import it.vfsfitvnm.vimusic.ui.styling.favoritesIcon
|
||||||
import it.vfsfitvnm.vimusic.utils.bold
|
import it.vfsfitvnm.vimusic.utils.bold
|
||||||
|
@ -52,7 +54,9 @@ import it.vfsfitvnm.vimusic.utils.rememberPreference
|
||||||
import it.vfsfitvnm.vimusic.utils.secondary
|
import it.vfsfitvnm.vimusic.utils.secondary
|
||||||
import it.vfsfitvnm.vimusic.utils.semiBold
|
import it.vfsfitvnm.vimusic.utils.semiBold
|
||||||
import it.vfsfitvnm.vimusic.utils.trackLoopEnabledKey
|
import it.vfsfitvnm.vimusic.utils.trackLoopEnabledKey
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Controls(
|
fun Controls(
|
||||||
|
@ -79,9 +83,15 @@ fun Controls(
|
||||||
mutableStateOf<Long?>(null)
|
mutableStateOf<Long?>(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(mediaId) {
|
var artistsInfo: List<Info>? by remember { mutableStateOf(null) }
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
if (artistsInfo == null) artistsInfo = Database.songArtistInfo(mediaId)
|
||||||
|
|
||||||
Database.likedAt(mediaId).distinctUntilChanged().collect { likedAt = it }
|
Database.likedAt(mediaId).distinctUntilChanged().collect { likedAt = it }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val shouldBePlayingTransition = updateTransition(shouldBePlaying, label = "shouldBePlaying")
|
val shouldBePlayingTransition = updateTransition(shouldBePlaying, label = "shouldBePlaying")
|
||||||
|
|
||||||
|
@ -113,7 +123,11 @@ fun Controls(
|
||||||
text = artist ?: "",
|
text = artist ?: "",
|
||||||
style = typography.s.semiBold.secondary,
|
style = typography.s.semiBold.secondary,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = Modifier.clickable {
|
||||||
|
val goTo = artistRoute::global
|
||||||
|
goTo(artistsInfo?.get(0)?.id)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(
|
Spacer(
|
||||||
|
|
Loading…
Reference in a new issue