diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt
index ea5af26..0dba709 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt
@@ -30,8 +30,8 @@ class MainActivity : ComponentActivity() {
)
}
}
- AppNavigator() // Accès à la page login et SingUp (pour le moment)
- //ProfilPage() //Accès à la page profil
+ //AppNavigator() // Accès à la page login et SingUp (pour le moment)
+ ProfilPage() //Accès à la page profil
}
}
}
diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt
index 7c5358b..2596711 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt
@@ -35,6 +35,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -46,6 +47,8 @@ import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
+import com.example.what_the_fantasy.R
+
@Composable
fun LoginPage(navController : NavController) {
@@ -71,13 +74,13 @@ fun LoginPage(navController : NavController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
- TitleLogin("Connexion au compte", 20,Color.White)
- IdentifiantTextField("Identifiant*")
- PassWdTextField("Mot de passe*")
+ TitlePage(R.string.titleLogin, 20,Color.White)
+ IdentifiantTextField(R.string.IdentifiantLogin)
+ PassWdTextField(R.string.PasswdLogin)
Space(16)
- ConnexionButtonLogin("Connexion",18, Color.White, Color.Black)
+ ConnexionButtonLogin(R.string.ButtonLogin,18, Color.White, Color.Black)
Space(16)
- CreateAccountButton("Créer un compte",12, Color.White, navController)
+ CreateAccountButton(R.string.ButtonCreateLogin,12, Color.White, navController)
}
}
@@ -92,7 +95,8 @@ fun Space(height : Int){
@Composable
-fun IdentifiantTextField(textIdentifiant : String){
+fun IdentifiantTextField(textIdentifiantResId : Int){
+ val textIdentifiant = stringResource(id = textIdentifiantResId)
var identifiant by remember { mutableStateOf("") } // Stocke la valeur du champ
Column(modifier = Modifier.padding(top = 16.dp)) {
OutlinedTextField(
@@ -109,7 +113,8 @@ fun IdentifiantTextField(textIdentifiant : String){
}
@Composable
-fun PassWdTextField(textpasswd : String){
+fun PassWdTextField(textpasswdResId : Int){
+ val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@@ -132,7 +137,8 @@ fun PassWdTextField(textpasswd : String){
}
@Composable
-fun TitleLogin(title : String, size : Int, color : Color){
+fun TitlePage(titleResId : Int, size : Int, color : Color){
+ val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
@@ -142,7 +148,8 @@ fun TitleLogin(title : String, size : Int, color : Color){
}
@Composable
-fun ConnexionButtonLogin(title : String, size : Int, colorButton : Color, colorText : Color){
+fun ConnexionButtonLogin(titleResId : Int, size : Int, colorButton : Color, colorText : Color){
+ val title = stringResource(id = titleResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
@@ -154,7 +161,8 @@ fun ConnexionButtonLogin(title : String, size : Int, colorButton : Color, colorT
}
@Composable
-fun CreateAccountButton(title : String, size : Int, color : Color, navController: NavController){
+fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: NavController){
+ val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt
index 6d8d60e..ea753fd 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt
@@ -43,6 +43,7 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
@@ -81,7 +82,7 @@ fun ProfilPage() {
) {
// Titre
- TitleProfil("Profil", 20, Color.White)
+ TitleProfil(R.string.titleProfile, 20, Color.White)
SpaceProfil(16)
// Image de profil
@@ -101,11 +102,11 @@ fun ProfilPage() {
SpaceProfil(16)
// Bouton
- ButtonProfile("Ajouter une citation",18, Color.Black, Color.White)
+ ButtonProfile(R.string.ButtonAddQuoteprofile,18, Color.Black, Color.White)
SpaceProfil(16)
- ButtonProfile("Langue",18, Color.Black, Color.White)
+ ButtonProfile(R.string.ButtonLanguageprofile,18, Color.Black, Color.White)
SpaceProfil(16)
- ButtonProfile("Déconnexion", 18, Color.Black, Color.White)
+ ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White)
}
}
@@ -121,7 +122,8 @@ fun SpaceProfil(height : Int){
@Composable
-fun TitleProfil(title : String, size : Int, color : Color){
+fun TitleProfil(titleResId : Int, size : Int, color : Color){
+ val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
@@ -174,8 +176,9 @@ fun EditEmail(){
isError = emailError // ✅ Afficher l'erreur si l'email est invalide
)
if (emailError) {
+ val text = stringResource(id = R.string.ErrorEmailprofile)
Text(
- text = "Adresse e-mail invalide",
+ text = text,
color = Color.Red,
fontSize = 12.sp,
modifier = Modifier.padding(top = 4.dp)
@@ -259,10 +262,11 @@ fun EditPasswd(){
var passwordError by remember { mutableStateOf(false) }
if (isEditingPassword) {
Column {
+ val text = stringResource(id = R.string.NewPasswdprofile)
OutlinedTextField(
value = newPassword,
onValueChange = { newPassword = it },
- label = { Text("Nouveau mot de passe") },
+ label = { Text(text) },
modifier = Modifier.fillMaxWidth(),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
singleLine = true,
@@ -279,14 +283,15 @@ fun EditPasswd(){
)
Spacer(modifier = Modifier.height(8.dp))
-
+ val textConfirm = stringResource(id = R.string.ConfirmNewPasswdprofile)
OutlinedTextField(
value = confirmPassword,
onValueChange = {
confirmPassword = it
passwordError = newPassword != it
},
- label = { Text("Confirmer le mot de passe") },
+
+ label = { Text(textConfirm) },
modifier = Modifier.fillMaxWidth(),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
singleLine = true,
@@ -310,8 +315,9 @@ fun EditPasswd(){
)
if (passwordError) {
+ val text = stringResource(id = R.string.Errorpasswdprofile)
Text(
- text = "Les mots de passe ne correspondent pas",
+ text = text,
color = Color.Red,
fontSize = 12.sp,
modifier = Modifier.padding(top = 4.dp)
@@ -330,7 +336,8 @@ fun EditPasswd(){
colors = ButtonDefaults.buttonColors(containerColor = Color.White),
modifier = Modifier.fillMaxWidth()
) {
- Text("Valider", fontSize = 18.sp, color = Color.Black)
+ val text = stringResource(id = R.string.ButtonSaveprofile)
+ Text(text, fontSize = 18.sp, color = Color.Black)
}
}
} else {
@@ -356,7 +363,8 @@ fun EditPasswd(){
@Composable
-fun ButtonProfile(text : String, size :Int, colorTexte : Color, colorButton : Color){
+fun ButtonProfile(textResId : Int, size :Int, colorTexte : Color, colorButton : Color){
+ val text = stringResource(id = textResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt
index cc4f679..7ed5121 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SignUpPage.kt
@@ -31,6 +31,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -38,6 +39,7 @@ import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
+import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
@Composable
@@ -64,15 +66,15 @@ fun SignUpPage(navController: NavController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
- TitleSign("Inscription", 20,Color.White)
- IdentifiantTextFieldSign("Identifiant*")
+ TitlePage(R.string.titleSignUp, 20,Color.White)
+ IdentifiantTextFieldSign(R.string.IdentifiantLogin)
EmailTextFieldSign("Email*")
- PassWdTextFieldSign("Mot de passe*")
- PassWdConfirmTextFieldSign("Confirmer mot de passe*")
+ PassWdTextFieldSign(R.string.PasswdLogin)
+ PassWdConfirmTextFieldSign(R.string.ConfirmPassWdSignUp)
SpaceSign(16)
- ConnexionButtonSign("S'incrire",18, Color.White, Color.Black)
+ ConnexionButtonSign(R.string.ButtonSignUp,18, Color.White, Color.Black)
SpaceSign(16)
- CreateAccountButtonSign("Se connecter",12, Color.White, navController = navController)
+ CreateAccountButtonSign(R.string.ButtonLogin,12, Color.White, navController = navController)
}
}
@@ -87,8 +89,10 @@ fun SpaceSign(height : Int){
@Composable
-fun IdentifiantTextFieldSign(textIdentifiant : String){
+fun IdentifiantTextFieldSign(textIdentifiantResId : Int){
+ val textIdentifiant = stringResource(id = textIdentifiantResId)
var identifiant by remember { mutableStateOf("") } // Stocke la valeur du champ
+
Column(modifier = Modifier.padding(top = 16.dp)) {
OutlinedTextField(
value = identifiant,
@@ -121,7 +125,8 @@ fun EmailTextFieldSign(textIdentifiant : String){
}
@Composable
-fun PassWdTextFieldSign(textpasswd : String){
+fun PassWdTextFieldSign(textpasswdResId : Int){
+ val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@@ -144,7 +149,8 @@ fun PassWdTextFieldSign(textpasswd : String){
}
@Composable
-fun PassWdConfirmTextFieldSign(textpasswd : String){
+fun PassWdConfirmTextFieldSign(textpasswdResId : Int){
+ val textpasswd = stringResource(id = textpasswdResId)
var passwd by remember { mutableStateOf("") } // Stocke la valeur du champ
var passwordVisible by remember { mutableStateOf(false) } // État pour afficher/masquer
Column(modifier = Modifier.padding(top = 10.dp)) {
@@ -166,18 +172,19 @@ fun PassWdConfirmTextFieldSign(textpasswd : String){
}
}
-@Composable
-fun TitleSign(title : String, size : Int, color : Color){
- Text(
- text = title,
- fontSize = size.sp,
- fontWeight = FontWeight.Bold,
- color = color
- )
-}
+//@Composable
+//fun TitleSign(title : String, size : Int, color : Color){
+// Text(
+// text = title,
+// fontSize = size.sp,
+// fontWeight = FontWeight.Bold,
+// color = color
+// )
+//}
@Composable
-fun ConnexionButtonSign(title : String, size : Int, colorButton : Color, colorText : Color){
+fun ConnexionButtonSign(titleResId : Int, size : Int, colorButton : Color, colorText : Color){
+ val title = stringResource(id = titleResId)
Button(
onClick = { /* Action */ },
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
@@ -189,7 +196,8 @@ fun ConnexionButtonSign(title : String, size : Int, colorButton : Color, colorTe
}
@Composable
-fun CreateAccountButtonSign(title: String, size: Int, color: Color, navController: NavController) {
+fun CreateAccountButtonSign(titleResId: Int, size: Int, color: Color, navController: NavController) {
+ val title = stringResource(id = titleResId)
Text(
text = title,
fontSize = size.sp,
diff --git a/What_The_Fantasy/app/src/main/res/values-fr/strings.xml b/What_The_Fantasy/app/src/main/res/values-fr/strings.xml
index cfb65f0..9d55b61 100644
--- a/What_The_Fantasy/app/src/main/res/values-fr/strings.xml
+++ b/What_The_Fantasy/app/src/main/res/values-fr/strings.xml
@@ -4,4 +4,27 @@
Film
Jeu Vidéo
Série
+
+ //Page Login
+ Connexion au compte
+ Votre identifiant*
+ Votre mot de passe*
+ Se connecter
+ Créer son compte
+
+ //Page Sign Up
+ Inscription
+ Confirmer mot de passe*
+ S\'inscrire
+
+ //Page Profil
+ Profil
+ Suggérer une citation
+ Changer la langue
+ Se Déconnecter
+ Nouveau mot de passe
+ Confirmer le nouveau mot de passe
+ Sauvegarder
+ L\'adress email est invalide
+ Les mots de passe ne correspondent pas
\ No newline at end of file
diff --git a/What_The_Fantasy/app/src/main/res/values/strings.xml b/What_The_Fantasy/app/src/main/res/values/strings.xml
index 75ba845..c9ab3e1 100644
--- a/What_The_Fantasy/app/src/main/res/values/strings.xml
+++ b/What_The_Fantasy/app/src/main/res/values/strings.xml
@@ -3,4 +3,28 @@
Movie
Video Game
Series
+
+ //Page Login
+ Account login
+ Your username*
+ Your password*
+ Login
+ Create your account
+
+ //Page Sign Up
+ Account creation
+ Confirm your password*
+ Create
+
+ //Page Profil
+ Profile
+ Suggest a quote
+ Change Language
+ Disconnect
+ New password
+ Confirm password
+ Save
+ Invalid email address
+ Passwords do not match
+
\ No newline at end of file