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