new: add emoji associated with records in records and player UI

This commit is contained in:
2026-07-03 14:28:59 +02:00
parent b0a18814b5
commit f90552ed62
7 changed files with 58 additions and 36 deletions
@@ -9,104 +9,105 @@ import kotlinx.coroutines.flow.flowOf
internal class InMemoryRecordRepository : RecordRepository {
private val records =
listOf(
Phrase(
"🙏" to Phrase(
transcription = "An onestiz",
translation = "La politesse",
),
Phrase(
"👋" to Phrase(
transcription = "En em brezantiñ",
translation = "Se présenter",
),
Phrase(
"🌦️" to Phrase(
transcription = "An amzer a ra",
translation = "Le temps qu'il fait",
),
Phrase(
"💬" to Phrase(
transcription = "E komz get unan arall",
translation = "Parler avec quelqu'un d'autre",
),
Phrase(
"📖" to Phrase(
transcription = "Me hag ar brezhoneg",
translation = "Moi et le breton",
),
Phrase(
"🩺" to Phrase(
transcription = "Ar yec'hed",
translation = "La santé",
),
Phrase(
"🔍" to Phrase(
transcription = "Deskriviñ",
translation = "Décrire",
),
Phrase(
"❤️" to Phrase(
transcription = "Me 'gar / Ne garan ket",
translation = "J'aime / Je n'aime pas",
),
Phrase(
"" to Phrase(
transcription = "C'hoantoù",
translation = "Les envies",
),
Phrase(
"🤔" to Phrase(
transcription = "Penaos 'peus kavet...?",
translation = "Comment as-tu trouvé... ?",
),
Phrase(
"🎨" to Phrase(
transcription = "Oberiantizoù",
translation = "Les activités",
),
Phrase(
"🍽️" to Phrase(
transcription = "Debriñ hag evet",
translation = "Manger et boire",
),
Phrase(
"🚶🏻" to Phrase(
transcription = "Bale, pourmen ha beajiñ",
translation = "Marcher, se promener et voyager",
),
Phrase(
"🧍🏼‍♀️" to Phrase(
transcription = "Ma c'horf (1)",
translation = "Mon corps (1)",
),
Phrase(
"👦🏾" to Phrase(
transcription = "Ma c'horf (2)",
translation = "Mon corps (2)",
),
Phrase(
"" to Phrase(
transcription = "Dle eo / ret eo / dav eo / mall eo...",
translation = "Il faut que... / Il est temps que (de) ...",
),
Phrase(
"📅" to Phrase(
transcription = "Deizioù ar sizhun",
translation = "Les jours de la semaine",
),
Phrase(
"🍁" to Phrase(
transcription = "Mizioù ha kourzoù ar blez",
translation = "Les mois et les saisons de l'année",
),
Phrase(
"📦" to Phrase(
transcription = "Bez'zo / N'eus ket...",
translation = "Il y a / Il n'y a pas...",
),
Phrase(
"🤏" to Phrase(
transcription = "Banne.../Tamm...",
translation = "Un peu...",
),
Phrase(
"🏠" to Phrase(
transcription = "Stad a vuhez (1)",
translation = "Situation de vie (1)",
),
Phrase(
"🧑🏻‍❤️‍💋‍🧑🏽" to Phrase(
transcription = "Stad a vuhez (2)",
translation = "Situation de vie (2)",
),
Phrase(
"🧭" to Phrase(
transcription = "Lec'hiiñ",
translation = "Situer",
),
).mapIndexed { index, phrase ->
).mapIndexed { index, (emoji, phrase) ->
val number = index + 1
val paddedNumber = number.toString().padStart(2, '0')
Record(
id = number,
index = number,
emoji = emoji,
title = phrase,
audioResourcePath = "files/Chom_bev_$paddedNumber.m4a",
subtitleResourcePath = "files/Chom_bev_${paddedNumber}_st_bzh.lrc",
@@ -5,6 +5,7 @@ import fr.ajaury.gwenedeg.core.model.Phrase
data class Record(
val id: Int,
val index: Int,
val emoji: String,
val title: Phrase,
val audioResourcePath: String,
val subtitleResourcePath: String,
+2 -2
View File
@@ -1,8 +1,8 @@
[versions]
agp = "9.2.1"
androidCompileSdk = "36"
androidCompileSdk = "37"
androidMinSdk = "24"
androidTargetSdk = "36"
androidTargetSdk = "37"
androidxActivity = "1.13.0"
androidxLifecycle = "2.11.0-rc01"
media3 = "1.10.1"
@@ -1,6 +1,8 @@
package fr.ajaury.gwenedeg.player.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
@@ -32,7 +34,6 @@ import fr.ajaury.gwenedeg.player.model.PlaybackTiming
import fr.ajaury.gwenedeg.player.model.PlayerState
import fr.ajaury.gwenedeg.player.ui.viewmodel.PlayerUiState
import fr.ajaury.gwenedeg.player.ui.viewmodel.PlayerViewModel
import fr.ajaury.gwenedeg.preferences.model.PlaybackPreferences
import fr.ajaury.gwenedeg.preferences.ui.SubtitlePreferencesBottomSheet
import fr.ajaury.gwenedeg.subtitle.model.SubtitleLine
import fr.ajaury.gwenedeg.theme.GwenedegTheme
@@ -93,21 +94,31 @@ fun PlayerScreen(
topBar = {
TopAppBar(
title = {
Column {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = uiState.recordTitle.transcription,
text = uiState.recordEmoji,
style = MaterialTheme.typography.headlineSmall,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
uiState.recordTitle.translation?.let { translation ->
Column {
Text(
text = translation,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
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,
)
}
}
}
},
@@ -214,6 +225,7 @@ private fun PlayerScreenPlayingPreview() {
GwenedegTheme {
PlayerScreen(
uiState = PlayerUiState(
recordEmoji = "🙏",
recordTitle = Phrase(
transcription = "Demat",
translation = "Bonjour",
@@ -238,6 +250,7 @@ private fun PlayerScreenPausedPreview() {
GwenedegTheme {
PlayerScreen(
uiState = PlayerUiState(
recordEmoji = "🙏",
recordTitle = Phrase(
transcription = "Demat",
translation = "Bonjour",
@@ -262,6 +275,7 @@ private fun PlayerScreenEndedPreview() {
GwenedegTheme {
PlayerScreen(
uiState = PlayerUiState(
recordEmoji = "🙏",
recordTitle = Phrase(
transcription = "Demat",
translation = "Bonjour",
@@ -7,6 +7,7 @@ import fr.ajaury.gwenedeg.preferences.model.SubtitlePreferences
import kotlin.time.Duration.Companion.seconds
data class PlayerUiState(
val recordEmoji: String = "",
val recordTitle: Phrase = Phrase(transcription = ""),
val playerState: PlayerState = PlayerState(),
val subtitlePreferences: SubtitlePreferences = SubtitlePreferences(),
@@ -40,6 +40,7 @@ class PlayerViewModel(
preferencesRepository.playbackPreferences,
) { record, playerState, subtitlePreferences, playbackPreferences ->
PlayerUiState(
recordEmoji = record?.emoji ?: "",
recordTitle = record?.title ?: Phrase(transcription = ""),
playerState = playerState,
subtitlePreferences = subtitlePreferences,
@@ -29,14 +29,17 @@ fun RecordView(
.clickable { onClick() }
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = record.index.toString().padStart(2),
fontFamily = FontFamily.Monospace,
)
Text(text = record.emoji)
Column {
Text(text = record.title.transcription)
record.title.translation?.let { translation ->
Text(
text = translation,
@@ -56,6 +59,7 @@ private fun RecordViewPreview() {
Record(
id = 1,
index = 1,
emoji = "🙏",
title = Phrase(
transcription = "Sample Record",
translation = "Exemple d'enregistrement",