|
|
@ -43,6 +43,7 @@ import androidx.compose.ui.geometry.Offset
|
|
|
|
import androidx.compose.ui.graphics.Brush
|
|
|
|
import androidx.compose.ui.graphics.Brush
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.text.TextStyle
|
|
|
|
import androidx.compose.ui.text.TextStyle
|
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
|
import androidx.compose.ui.text.input.ImeAction
|
|
|
|
import androidx.compose.ui.text.input.ImeAction
|
|
|
@ -81,7 +82,7 @@ fun ProfilPage() {
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
// Titre
|
|
|
|
// Titre
|
|
|
|
TitleProfil("Profil", 20, Color.White)
|
|
|
|
TitleProfil(R.string.titleProfile, 20, Color.White)
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
|
|
|
|
|
|
|
|
// Image de profil
|
|
|
|
// Image de profil
|
|
|
@ -101,11 +102,11 @@ fun ProfilPage() {
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
|
|
|
|
|
|
|
|
// Bouton
|
|
|
|
// Bouton
|
|
|
|
ButtonProfile("Ajouter une citation",18, Color.Black, Color.White)
|
|
|
|
ButtonProfile(R.string.ButtonAddQuoteprofile,18, Color.Black, Color.White)
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
ButtonProfile("Langue",18, Color.Black, Color.White)
|
|
|
|
ButtonProfile(R.string.ButtonLanguageprofile,18, Color.Black, Color.White)
|
|
|
|
SpaceProfil(16)
|
|
|
|
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
|
|
|
|
@Composable
|
|
|
|
fun TitleProfil(title : String, size : Int, color : Color){
|
|
|
|
fun TitleProfil(titleResId : Int, size : Int, color : Color){
|
|
|
|
|
|
|
|
val title = stringResource(id = titleResId)
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
text = title,
|
|
|
|
text = title,
|
|
|
|
fontSize = size.sp,
|
|
|
|
fontSize = size.sp,
|
|
|
@ -174,8 +176,9 @@ fun EditEmail(){
|
|
|
|
isError = emailError // ✅ Afficher l'erreur si l'email est invalide
|
|
|
|
isError = emailError // ✅ Afficher l'erreur si l'email est invalide
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (emailError) {
|
|
|
|
if (emailError) {
|
|
|
|
|
|
|
|
val text = stringResource(id = R.string.ErrorEmailprofile)
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
text = "Adresse e-mail invalide",
|
|
|
|
text = text,
|
|
|
|
color = Color.Red,
|
|
|
|
color = Color.Red,
|
|
|
|
fontSize = 12.sp,
|
|
|
|
fontSize = 12.sp,
|
|
|
|
modifier = Modifier.padding(top = 4.dp)
|
|
|
|
modifier = Modifier.padding(top = 4.dp)
|
|
|
@ -259,10 +262,11 @@ fun EditPasswd(){
|
|
|
|
var passwordError by remember { mutableStateOf(false) }
|
|
|
|
var passwordError by remember { mutableStateOf(false) }
|
|
|
|
if (isEditingPassword) {
|
|
|
|
if (isEditingPassword) {
|
|
|
|
Column {
|
|
|
|
Column {
|
|
|
|
|
|
|
|
val text = stringResource(id = R.string.NewPasswdprofile)
|
|
|
|
OutlinedTextField(
|
|
|
|
OutlinedTextField(
|
|
|
|
value = newPassword,
|
|
|
|
value = newPassword,
|
|
|
|
onValueChange = { newPassword = it },
|
|
|
|
onValueChange = { newPassword = it },
|
|
|
|
label = { Text("Nouveau mot de passe") },
|
|
|
|
label = { Text(text) },
|
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
|
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
|
|
|
|
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
|
|
|
|
singleLine = true,
|
|
|
|
singleLine = true,
|
|
|
@ -279,14 +283,15 @@ fun EditPasswd(){
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
Spacer(modifier = Modifier.height(8.dp))
|
|
|
|
Spacer(modifier = Modifier.height(8.dp))
|
|
|
|
|
|
|
|
val textConfirm = stringResource(id = R.string.ConfirmNewPasswdprofile)
|
|
|
|
OutlinedTextField(
|
|
|
|
OutlinedTextField(
|
|
|
|
value = confirmPassword,
|
|
|
|
value = confirmPassword,
|
|
|
|
onValueChange = {
|
|
|
|
onValueChange = {
|
|
|
|
confirmPassword = it
|
|
|
|
confirmPassword = it
|
|
|
|
passwordError = newPassword != it
|
|
|
|
passwordError = newPassword != it
|
|
|
|
},
|
|
|
|
},
|
|
|
|
label = { Text("Confirmer le mot de passe") },
|
|
|
|
|
|
|
|
|
|
|
|
label = { Text(textConfirm) },
|
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
|
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
|
|
|
|
textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
|
|
|
|
singleLine = true,
|
|
|
|
singleLine = true,
|
|
|
@ -310,8 +315,9 @@ fun EditPasswd(){
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if (passwordError) {
|
|
|
|
if (passwordError) {
|
|
|
|
|
|
|
|
val text = stringResource(id = R.string.Errorpasswdprofile)
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
text = "Les mots de passe ne correspondent pas",
|
|
|
|
text = text,
|
|
|
|
color = Color.Red,
|
|
|
|
color = Color.Red,
|
|
|
|
fontSize = 12.sp,
|
|
|
|
fontSize = 12.sp,
|
|
|
|
modifier = Modifier.padding(top = 4.dp)
|
|
|
|
modifier = Modifier.padding(top = 4.dp)
|
|
|
@ -330,7 +336,8 @@ fun EditPasswd(){
|
|
|
|
colors = ButtonDefaults.buttonColors(containerColor = Color.White),
|
|
|
|
colors = ButtonDefaults.buttonColors(containerColor = Color.White),
|
|
|
|
modifier = Modifier.fillMaxWidth()
|
|
|
|
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 {
|
|
|
|
} else {
|
|
|
@ -356,7 +363,8 @@ fun EditPasswd(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@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(
|
|
|
|
Button(
|
|
|
|
onClick = { /* Action */ },
|
|
|
|
onClick = { /* Action */ },
|
|
|
|
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
|
|
|
|
colors = ButtonDefaults.buttonColors(containerColor = colorButton),
|
|
|
|