diff --git a/Android/app/src/main/AndroidManifest.xml b/Android/app/src/main/AndroidManifest.xml
index 631cb1e..0a13bb4 100644
--- a/Android/app/src/main/AndroidManifest.xml
+++ b/Android/app/src/main/AndroidManifest.xml
@@ -28,11 +28,8 @@
-
\ No newline at end of file
diff --git a/Android/app/src/main/java/com/example/mathseduc/ConnexionPlayerActivity.kt b/Android/app/src/main/java/com/example/mathseduc/ConnexionPlayerActivity.kt
index b27ff25..24d71ad 100644
--- a/Android/app/src/main/java/com/example/mathseduc/ConnexionPlayerActivity.kt
+++ b/Android/app/src/main/java/com/example/mathseduc/ConnexionPlayerActivity.kt
@@ -1,5 +1,6 @@
package com.example.mathseduc
+import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
@@ -12,6 +13,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.*
import androidx.compose.runtime.*
+import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -39,9 +41,9 @@ class ConnexionPlayerActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ConnexionPlayerContent(activity: ConnexionPlayerActivity) {
- var nickname by remember { mutableStateOf("") }
- var password by remember { mutableStateOf("") }
- var showDialog by remember { mutableStateOf(false) }
+ var nickname by rememberSaveable { mutableStateOf("") }
+ var password by rememberSaveable { mutableStateOf("") }
+ var showDialog by rememberSaveable { mutableStateOf(false) }
val context = LocalContext.current
@@ -121,22 +123,22 @@ fun ConnexionPlayerContent(activity: ConnexionPlayerActivity) {
Spacer(modifier = Modifier.height(16.dp))
- Button(
- onClick = {
- val isAuthenticated = ControllerPlayer.authenticateUser(nickname, password)
- if (isAuthenticated != -1) {
- MainActivity.idPlayerConnected = isAuthenticated
- Toast.makeText(context, "Connexion réussie, bienvenue $nickname !", Toast.LENGTH_SHORT).show()
- } else {
- Toast.makeText(context, "Connexion échouée. Veuillez réessayer.", Toast.LENGTH_SHORT).show()
- }
- },
- modifier = Modifier
- .fillMaxWidth()
- .height(48.dp)
- ) {
- Text("Login")
- }
+ Button(
+ onClick = {
+ val isAuthenticated = ControllerPlayer.authenticateUser(nickname, password)
+ if (isAuthenticated != -1) {
+ MainActivity.idPlayerConnected = isAuthenticated
+ Toast.makeText(context, "Connexion réussie, bienvenue $nickname !", Toast.LENGTH_SHORT).show()
+ } else {
+ Toast.makeText(context, "Connexion échouée. Veuillez réessayer.", Toast.LENGTH_SHORT).show()
+ }
+ },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(48.dp)
+ ) {
+ Text("Login")
+ }
Spacer(modifier = Modifier.height(16.dp))
diff --git a/Android/app/src/main/java/com/example/mathseduc/MainActivity.kt b/Android/app/src/main/java/com/example/mathseduc/MainActivity.kt
index 5ed91fc..8b25357 100644
--- a/Android/app/src/main/java/com/example/mathseduc/MainActivity.kt
+++ b/Android/app/src/main/java/com/example/mathseduc/MainActivity.kt
@@ -1,6 +1,7 @@
package com.example.mathseduc
import android.os.Bundle
+import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable
diff --git a/Android/app/src/main/java/com/example/mathseduc/QuizMultiActivity.kt b/Android/app/src/main/java/com/example/mathseduc/QuizMultiActivity.kt
new file mode 100644
index 0000000..ffad1e3
--- /dev/null
+++ b/Android/app/src/main/java/com/example/mathseduc/QuizMultiActivity.kt
@@ -0,0 +1,35 @@
+package com.example.mathseduc
+
+import android.os.Bundle
+import android.os.CountDownTimer
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
+import com.example.mathseduc.ui.QuizMultiScreen
+import com.example.mathseduc.ui.theme.MathsEducTheme
+
+
+class QuizMultiActivity : ComponentActivity() {
+ companion object {
+ var countDownTimer: CountDownTimer? = null
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContent {
+ MathsEducTheme {
+ val lobbyId = intent.getIntExtra("lobbyId",-1)
+ QuizMultiScreen(lobbyId) //TODO sus
+ }
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ // Stop the CountDownTimer to avoid memory leaks
+ countDownTimer?.cancel()
+ }
+}
+
diff --git a/Android/app/src/main/java/com/example/mathseduc/ServerDetailsActivity.kt b/Android/app/src/main/java/com/example/mathseduc/ServerDetailsActivity.kt
new file mode 100644
index 0000000..4fd4413
--- /dev/null
+++ b/Android/app/src/main/java/com/example/mathseduc/ServerDetailsActivity.kt
@@ -0,0 +1,230 @@
+package com.example.mathseduc
+
+import android.content.Intent
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.util.Log
+import androidx.activity.ComponentActivity
+import androidx.activity.OnBackPressedCallback
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+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.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.example.mathseduc.controllers.ControllerLobby
+import com.example.mathseduc.controllers.ControllerPlayer
+import com.example.mathseduc.controllers.ControllerUtiliser
+import com.example.mathseduc.models.Player
+import com.example.mathseduc.ui.theme.Colors
+import okhttp3.MultipartBody
+
+class ServerDetailsActivity : ComponentActivity() {
+
+ private var playerList: List = emptyList()
+ private val handler = Handler(Looper.getMainLooper())
+ private val refreshInterval: Long = 2000
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val onBackPressedCallback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
+ override fun handleOnBackPressed() {
+ myBackPressed()
+ }
+ }
+
+ onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
+
+ setContent {
+ ServerDetailPage()
+ }
+
+ /*
+ onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
+ //setContentView(R.layout.activity_server_details)
+
+ val serverName = intent.getStringExtra("serverName")
+
+ val serverNameTextView = findViewById(R.id.titleServerDetails)
+ serverNameTextView.text = serverName
+
+ val lobbyId = intent.getIntExtra("lobbyId", -1)
+
+ if (savedInstanceState != null) {
+ playerList = savedInstanceState?.getParcelableArrayList("playerList") ?: emptyList()
+ } else {
+ val playerId = ControllerPlayer.getPlayersIdFromLobbyId(lobbyId)
+ if (playerId != null) {
+ playerList = playerId.mapNotNull { playerId ->
+ ControllerPlayer.getPlayerInfoById(playerId.toString())
+ }
+ }
+ }
+
+ val listViewPlayers = findViewById(R.id.listViewPlayers)
+ playerAdapter = PlayerAdapter(this, playerList)
+ listViewPlayers.adapter = playerAdapter
+
+ handler.postDelayed(refreshRunnable, refreshInterval)
+
+ val btnLaunchQuiz = findViewById