diff --git a/feature/records/src/commonMain/kotlin/bzh/ajaury/chombev/player/ui/PlayerScreen.kt b/feature/records/src/commonMain/kotlin/bzh/ajaury/chombev/player/ui/PlayerScreen.kt index b8d6091..ecb4558 100644 --- a/feature/records/src/commonMain/kotlin/bzh/ajaury/chombev/player/ui/PlayerScreen.kt +++ b/feature/records/src/commonMain/kotlin/bzh/ajaury/chombev/player/ui/PlayerScreen.kt @@ -104,53 +104,10 @@ fun PlayerScreen( Scaffold( topBar = { - TopAppBar( - modifier = Modifier.shadow(elevation = 2.dp), - title = { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text( - text = uiState.recordEmoji, - style = MaterialTheme.typography.headlineSmall, - ) - Column { - Text( - text = uiState.recordTitle.transcription, - style = MaterialTheme.typography.headlineSmall, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - - uiState.recordTitle.translation?.let { translation -> - Text( - text = translation, - style = MaterialTheme.typography.titleSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - } - } - } - }, - navigationIcon = { - IconButton(onClick = onBackClicked) { - Icon( - imageVector = Icons.AutoMirrored.Filled.ArrowBack, - contentDescription = stringResource(Res.string.player_back), - ) - } - }, - actions = { - IconButton(onClick = { showPreferences = true }) { - Icon( - imageVector = Icons.Filled.Subtitles, - contentDescription = stringResource(Res.string.subtitle_preferences_action), - ) - } - }, + PlayerTopBar( + uiState = uiState, + onBackClicked = onBackClicked, + showPreferences = { showPreferences = true }, ) }, ) { innerPadding -> @@ -212,6 +169,62 @@ fun PlayerScreen( } } +@Composable +private fun PlayerTopBar( + uiState: PlayerUiState, + onBackClicked: () -> Unit, + showPreferences: () -> Unit, +) { + TopAppBar( + modifier = Modifier.shadow(elevation = 2.dp), + title = { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text( + text = uiState.recordEmoji, + style = MaterialTheme.typography.headlineSmall, + ) + Column { + Text( + text = uiState.recordTitle.transcription, + style = MaterialTheme.typography.headlineSmall, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + + uiState.recordTitle.translation?.let { translation -> + Text( + text = translation, + style = MaterialTheme.typography.titleSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + } + } + } + }, + navigationIcon = { + IconButton(onClick = onBackClicked) { + Icon( + imageVector = Icons.AutoMirrored.Filled.ArrowBack, + contentDescription = stringResource(Res.string.player_back), + ) + } + }, + actions = { + IconButton(onClick = showPreferences) { + Icon( + imageVector = Icons.Filled.Subtitles, + contentDescription = stringResource(Res.string.subtitle_preferences_action), + ) + } + }, + ) +} + private val previewSubtitleLines = listOf( SubtitleLine(