mirror of
https://github.com/LucasVbr/Queezer.git
synced 2026-05-13 17:11:55 +00:00
feat: Use ressources to store strings
This commit is contained in:
@@ -286,8 +286,9 @@ fun FinishScreen(gameManager: GameManager, context: Context, navController: NavH
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
){
|
||||
Text("Partie terminée !", fontSize = 24.sp)
|
||||
Text( context.resources.getString(R.string.party_end), fontSize = 24.sp)
|
||||
Text("Score : ${gameManager.score}", fontSize = 20.sp)
|
||||
|
||||
TrackCardItemList(gameManager.playlist.tracks)
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -26,6 +27,8 @@ import fr.univpau.queezer.ui.theme.Purple40
|
||||
|
||||
@Composable
|
||||
fun HomeScreen(navController: NavHostController) {
|
||||
val context = LocalContext.current;
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
@@ -42,7 +45,7 @@ fun HomeScreen(navController: NavHostController) {
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Queezer",
|
||||
text = context.resources.getString(R.string.app_name),
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Purple40
|
||||
@@ -59,7 +62,7 @@ fun HomeScreen(navController: NavHostController) {
|
||||
.padding(vertical = 8.dp)
|
||||
) {
|
||||
Text(
|
||||
"Partie rapide",
|
||||
context.resources.getString(R.string.quick_play),
|
||||
fontSize = 18.sp
|
||||
)
|
||||
}
|
||||
@@ -73,7 +76,7 @@ fun HomeScreen(navController: NavHostController) {
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp)
|
||||
) {
|
||||
Text("Partie personnalisée", fontSize = 18.sp)
|
||||
Text(context.resources.getString(R.string.custom_play), fontSize = 18.sp)
|
||||
}
|
||||
|
||||
Button(
|
||||
@@ -83,7 +86,7 @@ fun HomeScreen(navController: NavHostController) {
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp)
|
||||
) {
|
||||
Text("Paramètres", fontSize = 18.sp)
|
||||
Text( context.resources.getString(R.string.settings), fontSize = 18.sp)
|
||||
}
|
||||
|
||||
Button(
|
||||
@@ -92,7 +95,7 @@ fun HomeScreen(navController: NavHostController) {
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
Text("Scores", fontSize = 18.sp)
|
||||
Text(context.resources.getString(R.string.score), fontSize = 18.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package fr.univpau.queezer.view.screens
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
@@ -12,8 +11,6 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FilterChip
|
||||
@@ -48,7 +45,6 @@ import fr.univpau.queezer.data.filterGames
|
||||
import fr.univpau.queezer.view.components.GameCardItemList
|
||||
import fr.univpau.queezer.viewmodel.GameViewModel
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.Flow
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
@@ -98,11 +94,11 @@ fun ScoreScreen(navController: NavHostController, gameViewModel: GameViewModel)
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(text = "$nbGames", fontSize = 24.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold)
|
||||
Text(text = "Parties jouées", fontSize = 14.sp)
|
||||
Text(text = context.resources.getString(R.string.games_played), fontSize = 14.sp)
|
||||
}
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(text = "${String.format(Locale.getDefault(), "%.02f", averageSuccessRate)}%", fontSize = 24.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Bold)
|
||||
Text(text = "De réussite", fontSize = 14.sp)
|
||||
Text(text = context.resources.getString(R.string.average_success_rate), fontSize = 14.sp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +113,7 @@ fun ScoreScreen(navController: NavHostController, gameViewModel: GameViewModel)
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
Text("Mode de jeu", fontSize = 16.sp)
|
||||
Text(context.resources.getString(R.string.game_mode_label), fontSize = 16.sp)
|
||||
FlowRow(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
@@ -155,13 +151,13 @@ fun ScoreScreen(navController: NavHostController, gameViewModel: GameViewModel)
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
Text("Filtrer par", fontSize = 16.sp)
|
||||
Text(context.resources.getString(R.string.filter_by), fontSize = 16.sp)
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text("Date")
|
||||
Text(context.resources.getString(R.string.date), fontSize = 14.sp)
|
||||
|
||||
Switch(
|
||||
checked = filter.orderByNbTitle,
|
||||
@@ -170,7 +166,7 @@ fun ScoreScreen(navController: NavHostController, gameViewModel: GameViewModel)
|
||||
}
|
||||
)
|
||||
|
||||
Text("Nombre de titres")
|
||||
Text(context.resources.getString(R.string.title_count), fontSize = 14.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +176,7 @@ fun ScoreScreen(navController: NavHostController, gameViewModel: GameViewModel)
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(text = "Aucune partie trouvée... (。•́︿•̀。)", fontSize = 16.sp, color = MaterialTheme.colorScheme.onSurface)
|
||||
Text(text = context.resources.getString(R.string.games_not_found), fontSize = 16.sp, color = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
} else {
|
||||
GameCardItemList(filteredGames)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
<string name="quick_play">Partie rapide</string>
|
||||
<string name="custom_play">Partie personnalisée</string>
|
||||
<string name="settings">Paramètre</string>
|
||||
<string name="score">Score</string>
|
||||
<string name="settings">Paramètres</string>
|
||||
<string name="score">Scores</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="playlist_url_label">URL de la playlist</string>
|
||||
@@ -29,12 +29,18 @@
|
||||
<string name="give_up">Abandonner</string>
|
||||
<string name="submit">Valider</string>
|
||||
|
||||
<string name="games_played">Nombre de parties jouées</string>
|
||||
<string name="average_success_rate">Taux de réussite moyen</string>
|
||||
<string name="filters">Filtrer par</string>
|
||||
<string name="games_played">Partie jouées</string>
|
||||
<string name="average_success_rate">De réussite</string>
|
||||
<string name="filter_by">Filtrer par</string>
|
||||
<string name="date">Date</string>
|
||||
<string name="title_count">Nombre de titres</string>
|
||||
<string name="error_playlist_not_found">La playlist n\'as pas été trouvée</string>
|
||||
<string name="error_tracks_count_too_high">Le nombre de titres et trop grand</string>
|
||||
<string name="playlist_too_short">La playlist est trop petite pour le nombre de titres demandés</string>
|
||||
<string name="games_not_found">Aucune partie trouvée... (。•́︿•̀。)</string>
|
||||
|
||||
<string name="party_end">Partie terminée !</string>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user