From 992a4690fac4a04a00cfd139e6f55bad486ec96a Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Mon, 31 Mar 2025 07:03:43 +0100 Subject: [PATCH 1/4] jsp --- .../what_the_fantasy/data/services/ServicesStub.kt | 4 +--- .../com/example/what_the_fantasy/ui/components/NavBar.kt | 5 ----- .../example/what_the_fantasy/ui/screens/AccueilPage.kt | 2 +- .../example/what_the_fantasy/ui/screens/FavoritePage.kt | 8 ++------ 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt index 61f0201..054b3d2 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt @@ -1,7 +1,6 @@ package com.example.what_the_fantasy.data.services import android.annotation.SuppressLint -import android.util.Log import com.example.what_the_fantasy.data.local.UserStub.users import com.example.what_the_fantasy.data.model.User import com.example.what_the_fantasy.Logs.LogsUsers @@ -9,7 +8,6 @@ import com.example.what_the_fantasy.data.local.FavoriteStub.favorites import com.example.what_the_fantasy.data.local.QuoteStub.quotes import com.example.what_the_fantasy.data.model.Favorite import com.example.what_the_fantasy.data.local.CommentStub.comments -import com.example.what_the_fantasy.data.local.QuoteStub import com.example.what_the_fantasy.data.model.Comment import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.model.SrcLanguage @@ -132,7 +130,7 @@ class ServicesStub : IServices { return quotes.subList(fromIndex, toIndex).toMutableList() } override fun isFavorite(id: Int, user: User): Boolean { - var quote = getFavorite(user) + val quote = getFavorite(user) return quote.find{ it.id == id } != null } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index 01216d0..55b229e 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -11,14 +11,12 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* import androidx.compose.material3.BottomAppBar import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.IconButtonColors -import androidx.compose.material3.IconToggleButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar import androidx.compose.runtime.Composable @@ -26,7 +24,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector @@ -34,7 +31,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.ui.theme.* @Composable fun NavBar(onProfile : Boolean = false , @@ -49,7 +45,6 @@ fun NavBar(onProfile : Boolean = false , content : @Composable ()-> Unit ) { - var theme by remember { mutableStateOf(true) } Column( modifier = Modifier .fillMaxSize() diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt index ad0d1af..eb6607a 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt @@ -130,7 +130,7 @@ fun AccueilPage( CircularProgressIndicator() } } else { - LaunchedEffect(state.firstVisibleItemIndex, state.layoutInfo.totalItemsCount) { + LaunchedEffect(remember { derivedStateOf { state.firstVisibleItemIndex } }, state.layoutInfo.totalItemsCount) { if (!isLoading.value && state.layoutInfo.visibleItemsInfo.isNotEmpty()) { val lastVisibleItem = state.layoutInfo.visibleItemsInfo.last() if (lastVisibleItem.index >= state.layoutInfo.totalItemsCount - 1) { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt index 03f86c4..9ae741b 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/FavoritePage.kt @@ -1,6 +1,5 @@ package com.example.what_the_fantasy.ui.screens -import android.util.Log import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* @@ -11,17 +10,14 @@ import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.data.local.FavoriteStub import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.QuoteLittle -import com.example.what_the_fantasy.ui.theme.colorBackground @Composable fun FavoritePage( @@ -37,7 +33,7 @@ fun FavoritePage( val quotes = services.getFavorite(user) - val TitlePage = stringResource(R.string.TitleFavorite) + val titlePage = stringResource(R.string.TitleFavorite) NavBar(onFavorite = true, navControllerAccueil = navAccueil, navControllerProfil = navProfil, @@ -53,7 +49,7 @@ fun FavoritePage( LazyColumn { item { Text( - text = TitlePage, + text = titlePage, color = MaterialTheme.colorScheme.onBackground, fontSize = 24.sp, modifier = Modifier From f976c7c1624ed0fed52dc0760d78165458af5aee Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Mon, 31 Mar 2025 09:35:03 +0100 Subject: [PATCH 2/4] fix --- .../what_the_fantasy/Logs/LogsUsers.kt | 28 -------- .../data/services/ServicesStub.kt | 3 +- .../services}/hashPassword.kt | 2 +- .../what_the_fantasy/logs/LogsUsers.kt | 42 ++++++++++++ .../what_the_fantasy/ui/components/BackBar.kt | 64 ----------------- .../ui/components/LittleQuoteComponent.kt | 68 ------------------- .../what_the_fantasy/ui/components/NavBar.kt | 4 -- .../what_the_fantasy/ui/screens/LoginPage.kt | 6 +- .../what_the_fantasy/ui/screens/ProfilPage.kt | 3 +- .../res/drawable/dark_mode_toggle_icon.xml | 9 --- .../res/drawable/light_mode_toggle_icon.xml | 10 --- 11 files changed, 47 insertions(+), 192 deletions(-) delete mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt rename What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/{ui/components => data/services}/hashPassword.kt (88%) create mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt delete mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt delete mode 100644 What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt delete mode 100644 What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml delete mode 100644 What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt deleted file mode 100644 index e32f089..0000000 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/Logs/LogsUsers.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.example.what_the_fantasy.Logs - -import android.util.Log -import com.example.what_the_fantasy.data.model.User - -class LogsUsers{ - fun logDebugAllUsers(users : List, titleLog : String){ - for(user in users){ - Log.e(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl} => ${user.langage}") - } - } - - fun logDebugUserEmail(user : User?, titleLog : String){ - Log.e(titleLog, "User created: ${user?.username} => ${user?.email}") - } - - fun logDebugUserLangage(user : User?, titleLog : String){ - Log.e(titleLog, "User Change: ${user?.username} => ${user?.langage}") - } - - fun logInformationUserConnect(user : User?, titleLog : String){ - Log.e(titleLog, "${user?.username} logged in") - } - - fun unlogInformationUserConnect(titleLog : String){ - Log.e(titleLog, "Logged out") - } -} diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt index 054b3d2..382cd2e 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt @@ -3,7 +3,7 @@ package com.example.what_the_fantasy.data.services import android.annotation.SuppressLint import com.example.what_the_fantasy.data.local.UserStub.users import com.example.what_the_fantasy.data.model.User -import com.example.what_the_fantasy.Logs.LogsUsers +import com.example.what_the_fantasy.logs.LogsUsers import com.example.what_the_fantasy.data.local.FavoriteStub.favorites import com.example.what_the_fantasy.data.local.QuoteStub.quotes import com.example.what_the_fantasy.data.model.Favorite @@ -11,7 +11,6 @@ import com.example.what_the_fantasy.data.local.CommentStub.comments import com.example.what_the_fantasy.data.model.Comment import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.model.SrcLanguage -import com.example.what_the_fantasy.ui.components.hashPassword import java.time.LocalDate class ServicesStub : IServices { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/hashPassword.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/hashPassword.kt similarity index 88% rename from What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/hashPassword.kt rename to What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/hashPassword.kt index 2f46a9d..2334aca 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/hashPassword.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/hashPassword.kt @@ -1,4 +1,4 @@ -package com.example.what_the_fantasy.ui.components +package com.example.what_the_fantasy.data.services import java.security.MessageDigest diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt new file mode 100644 index 0000000..03d938a --- /dev/null +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt @@ -0,0 +1,42 @@ +import android.content.Context +import android.util.Log +import com.example.what_the_fantasy.data.model.User + +class LogsUsers(private val context: Context) { + + private fun isDebug(): Boolean { + return (context.applicationInfo.flags and android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE) != 0 + } + + fun logDebugAllUsers(users: List, titleLog: String) { + if (isDebug()) { + for (user in users) { + Log.d(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl} => ${user.langage}") + } + } + } + + fun logDebugUserEmail(user: User?, titleLog: String) { + if (isDebug()) { + Log.d(titleLog, "User email: ${user?.username} => ${user?.email}") + } + } + + fun logDebugUserLangage(user: User?, titleLog: String) { + if (isDebug()) { + Log.d(titleLog, "User language change: ${user?.username} => ${user?.langage}") + } + } + + fun logInformationUserConnect(user: User?, titleLog: String) { + if (isDebug()) { + Log.i(titleLog, "${user?.username} logged in") + } + } + + fun unlogInformationUserConnect(titleLog: String) { + if (isDebug()) { + Log.i(titleLog, "Logged out") + } + } +} diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt deleted file mode 100644 index c2deeda..0000000 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/BackBar.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.example.what_the_fantasy.ui.components - -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.size -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.AccountCircle -import androidx.compose.material.icons.rounded.ArrowBack -import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.IconButtonColors -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.unit.dp -import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.ui.theme.colorButtonNav -import com.example.what_the_fantasy.ui.theme.colorNavBar - -@Composable -fun BackBar(navBack : () ->Unit , - content : @Composable ()-> Unit ){ - Column( - modifier = Modifier - .fillMaxSize() - ) { - Row( - modifier = Modifier - .fillMaxWidth() - .height(70.dp) - .background(colorNavBar), - Arrangement.SpaceBetween, - verticalAlignment = Alignment.Bottom - ) { - IconButton(onClick = {navBack()}, - modifier = Modifier - .size(60.dp) - ) { - Icon(Icons.Rounded.ArrowBack, - contentDescription = "Back", - modifier = Modifier - .size(60.dp) - ) - } - - } - - Box(modifier = Modifier.background(Color.Black).fillMaxHeight()) { - content() - } - } -} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt deleted file mode 100644 index 3f9481c..0000000 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/LittleQuoteComponent.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.example.what_the_fantasy.ui.components - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import coil.compose.AsyncImage -import com.example.what_the_fantasy.R -import com.example.what_the_fantasy.data.model.Quote -import com.example.what_the_fantasy.ui.theme.gradienBox - -@Composable -fun LittleQuoteComponent(quote : Quote){ - Row( - modifier = Modifier - .fillMaxWidth(0.9f) - .clip(RoundedCornerShape(16.dp)) - .background(gradienBox) - ) { - val sizeTextInfoQuote = 13 - val lineHeightText = 12 - val sizeTextQuote = 16 - - AsyncImage( - model = quote.imgUrl, - contentDescription = "Quote picture", - modifier = Modifier - .size(130.dp) - .clip(RoundedCornerShape(16.dp)) - ) - Column(modifier = Modifier.padding(10.dp)) { - - TextInfoQuote( - quote.content, - sizeTextQuote, - lineHeightText - ) - - SpaceHeightComponent(40) - - TextInfoQuote("${stringResource(R.string.dateQuote)} : ${quote.date}", sizeTextInfoQuote, lineHeightText) - TextInfoQuote("${quote.type} : ${quote.source}", sizeTextInfoQuote, lineHeightText) - TextInfoQuote("${stringResource(R.string.CharacterQuote)}: ${quote.character}", sizeTextInfoQuote, lineHeightText) - } - } -} - -@Composable -fun TextInfoQuote(text : String, fontSizeText : Int, lineHeightText : Int){ - Text(text, - color = Color.White, - fontSize = fontSizeText.sp, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - lineHeight = lineHeightText.sp) -} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index 55b229e..e8e1cb1 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -4,8 +4,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize @@ -20,8 +18,6 @@ import androidx.compose.material3.IconButtonColors import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color 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 a98a4f8..511ed28 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 @@ -30,16 +30,14 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.example.what_the_fantasy.Logs.LogsUsers +import com.example.what_the_fantasy.logs.LogsUsers import com.example.what_the_fantasy.R import com.example.what_the_fantasy.data.model.User import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent -import com.example.what_the_fantasy.ui.components.hashPassword -import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox +import com.example.what_the_fantasy.data.services.hashPassword @Composable fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Unit, services : IServices) { 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 131ffeb..346cb6e 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 @@ -45,7 +45,7 @@ import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import coil.compose.AsyncImage -import com.example.what_the_fantasy.Logs.LogsUsers +import com.example.what_the_fantasy.logs.LogsUsers import com.example.what_the_fantasy.R import com.example.what_the_fantasy.data.model.User import com.example.what_the_fantasy.data.services.IServices @@ -53,7 +53,6 @@ import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent -import com.example.what_the_fantasy.ui.theme.gradienBox @Composable fun ProfilPage(index: Int, diff --git a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml deleted file mode 100644 index 752f388..0000000 --- a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml deleted file mode 100644 index 8e171be..0000000 --- a/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - From a68ffab341fd366d35937c2cbc7ba2807a383354 Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Mon, 31 Mar 2025 09:49:41 +0100 Subject: [PATCH 3/4] nettoyage code mort et imports --- .../what_the_fantasy/logs/LogsUsers.kt | 43 ++++++------------- .../what_the_fantasy/ui/components/NavBar.kt | 2 - .../ui/components/QuoteLittle.kt | 3 -- .../ui/components/SpaceComponent.kt | 1 - .../ui/components/TitleComponents.kt | 4 -- .../ui/navigations/AppNavigator.kt | 1 - .../ui/screens/AccueilPage.kt | 2 - .../ui/screens/QuizEndPage.kt | 1 - .../what_the_fantasy/ui/screens/QuotePage.kt | 10 ----- .../ui/screens/RecapSubmitPage.kt | 12 +----- .../what_the_fantasy/ui/screens/SignUpPage.kt | 2 - .../ui/screens/SubmitQuotePage.kt | 3 -- .../res/drawable/dark_mode_toggle_icon.xml | 9 ++++ 13 files changed, 24 insertions(+), 69 deletions(-) create mode 100644 What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt index 03d938a..4f30af3 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/logs/LogsUsers.kt @@ -1,42 +1,27 @@ -import android.content.Context +package com.example.what_the_fantasy.logs import android.util.Log import com.example.what_the_fantasy.data.model.User -class LogsUsers(private val context: Context) { - - private fun isDebug(): Boolean { - return (context.applicationInfo.flags and android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE) != 0 - } - - fun logDebugAllUsers(users: List, titleLog: String) { - if (isDebug()) { - for (user in users) { - Log.d(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl} => ${user.langage}") - } +class LogsUsers{ + fun logDebugAllUsers(users : List, titleLog : String){ + for(user in users){ + Log.e(titleLog, "User created: ${user.username} => ${user.email} => ${user.imgUrl} => ${user.langage}") } } - fun logDebugUserEmail(user: User?, titleLog: String) { - if (isDebug()) { - Log.d(titleLog, "User email: ${user?.username} => ${user?.email}") - } + fun logDebugUserEmail(user : User?, titleLog : String){ + Log.e(titleLog, "User created: ${user?.username} => ${user?.email}") } - fun logDebugUserLangage(user: User?, titleLog: String) { - if (isDebug()) { - Log.d(titleLog, "User language change: ${user?.username} => ${user?.langage}") - } + fun logDebugUserLangage(user : User?, titleLog : String){ + Log.e(titleLog, "User Change: ${user?.username} => ${user?.langage}") } - fun logInformationUserConnect(user: User?, titleLog: String) { - if (isDebug()) { - Log.i(titleLog, "${user?.username} logged in") - } + fun logInformationUserConnect(user : User?, titleLog : String){ + Log.e(titleLog, "${user?.username} logged in") } - fun unlogInformationUserConnect(titleLog: String) { - if (isDebug()) { - Log.i(titleLog, "Logged out") - } + fun unlogInformationUserConnect(titleLog : String){ + Log.e(titleLog, "Logged out") } -} +} \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index e8e1cb1..a067088 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -59,8 +59,6 @@ fun NavBar(onProfile : Boolean = false , ButtonIconVector(Icons.Rounded.AccountCircle,stringResource(R.string.NavProfile),navControllerProfil,onProfile) ButtonIconVector(Icons.Rounded.Search,stringResource(R.string.NavSearch),navControllerSearch,false) - - } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/QuoteLittle.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/QuoteLittle.kt index f9f38ab..32e97b0 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/QuoteLittle.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/QuoteLittle.kt @@ -15,7 +15,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow @@ -24,8 +23,6 @@ import androidx.compose.ui.unit.sp import coil.compose.rememberAsyncImagePainter import com.example.what_the_fantasy.R import com.example.what_the_fantasy.data.model.Quote -import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox @Composable fun QuoteLittle(quote: Quote, modifier: Modifier = Modifier) { diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/SpaceComponent.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/SpaceComponent.kt index d9a69d7..bcb2251 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/SpaceComponent.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/SpaceComponent.kt @@ -2,7 +2,6 @@ package com.example.what_the_fantasy.ui.components import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt index 50c1ac7..2fbabeb 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/TitleComponents.kt @@ -1,15 +1,11 @@ package com.example.what_the_fantasy.ui.components -import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt index 1e50e85..310b4d6 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt @@ -13,7 +13,6 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.toRoute import com.example.what_the_fantasy.data.services.ServicesStub import com.example.what_the_fantasy.ui.screens.* -import com.example.what_the_fantasy.ui.theme.colorNavBar import kotlinx.serialization.Serializable @Serializable diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt index eb6607a..ced3eee 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/AccueilPage.kt @@ -12,7 +12,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp @@ -23,7 +22,6 @@ import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.QuoteLittle -import com.example.what_the_fantasy.ui.theme.colorBackground import kotlinx.coroutines.delay @Composable diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt index 74ffee1..7c9379d 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt @@ -16,7 +16,6 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.example.what_the_fantasy.data.local.QuestionStub import com.example.what_the_fantasy.data.local.QuizStub import com.example.what_the_fantasy.ui.components.NavBar diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt index a3aa9da..fcc8da0 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt @@ -16,10 +16,8 @@ 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.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape @@ -30,7 +28,6 @@ import androidx.compose.material.icons.filled.Favorite import androidx.compose.material.icons.filled.FavoriteBorder import androidx.compose.material.icons.filled.MailOutline import androidx.compose.material.icons.filled.Share -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -45,8 +42,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind -import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource @@ -58,11 +53,6 @@ import coil.compose.AsyncImage import com.example.what_the_fantasy.data.model.Comment import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.NavBar -import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox -import com.example.what_the_fantasy.ui.theme.iconText -import com.example.what_the_fantasy.ui.theme.likeIcon -import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText var isCommentVisible by mutableStateOf(false) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt index 007197e..8176610 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/RecapSubmitPage.kt @@ -1,6 +1,5 @@ package com.example.what_the_fantasy.ui.screens -import android.content.Context -import android.content.Intent + import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -8,18 +7,10 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Favorite -import androidx.compose.material.icons.filled.FavoriteBorder -import androidx.compose.material.icons.filled.MailOutline -import androidx.compose.material.icons.filled.Share -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.CornerRadius -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.what_the_fantasy.R @@ -39,7 +30,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign -import com.example.what_the_fantasy.data.model.Character @Composable 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 f9f0fa3..6c4840f 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 @@ -39,8 +39,6 @@ import com.example.what_the_fantasy.R import com.example.what_the_fantasy.data.services.IServices import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent -import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent @Composable diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt index 5bb111b..ed84c81 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/SubmitQuotePage.kt @@ -2,7 +2,6 @@ package com.example.what_the_fantasy.ui.screens import androidx.compose.foundation.background import androidx.compose.foundation.clickable -import androidx.compose.foundation.gestures.scrollable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize @@ -35,8 +34,6 @@ import com.example.what_the_fantasy.ui.components.ErrorMessageSubmitQuoteCompone import com.example.what_the_fantasy.ui.components.NavBar import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent -import com.example.what_the_fantasy.ui.theme.colorBackground -import com.example.what_the_fantasy.ui.theme.gradienBox @Composable fun SubmitQuotePage( diff --git a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml new file mode 100644 index 0000000..752f388 --- /dev/null +++ b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml @@ -0,0 +1,9 @@ + + + From e097290152013d2ff13db896f9a5924034b6dc08 Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Mon, 31 Mar 2025 09:49:58 +0100 Subject: [PATCH 4/4] nettoyage code mort et imports --- .../app/src/main/res/drawable/dark_mode_toggle_icon.xml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml diff --git a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml deleted file mode 100644 index 752f388..0000000 --- a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml +++ /dev/null @@ -1,9 +0,0 @@ - - -