Merge branch 'master' of https://codefirst.iut.uca.fr/git/jade.van_brabandt/3.01-QCM_MuscuMaths
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
b1e79e1689
@ -0,0 +1,79 @@
|
|||||||
|
package com.example.mathseduc
|
||||||
|
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.ImageButton
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.example.mathseduc.controllers.ControllerPlayer
|
||||||
|
class ConnexionPlayerActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_connexion_player)
|
||||||
|
|
||||||
|
val buttonLogin = findViewById<Button>(R.id.buttonLogin)
|
||||||
|
val editTextNickname = findViewById<EditText>(R.id.editTextNickname)
|
||||||
|
val editTextPassword = findViewById<EditText>(R.id.editTextPassword)
|
||||||
|
|
||||||
|
buttonLogin.setOnClickListener {
|
||||||
|
val nickname = editTextNickname.text.toString()
|
||||||
|
val password = editTextPassword.text.toString()
|
||||||
|
|
||||||
|
val isAuthenticated = ControllerPlayer.authenticateUser(nickname,password)
|
||||||
|
if (isAuthenticated != -1) {
|
||||||
|
// Save authentication status for global accessibility
|
||||||
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
|
||||||
|
MainActivity.idPlayerConnected = isAuthenticated
|
||||||
|
|
||||||
|
Toast.makeText(this, "Connexion réussi, bienvenue $nickname !", Toast.LENGTH_SHORT).show()
|
||||||
|
} else {
|
||||||
|
// Show an error toast
|
||||||
|
Toast.makeText(this, "Connexion échoué. Veuillez réessayer.", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val btnReturn = findViewById<ImageButton>(R.id.btnReturn)
|
||||||
|
val btnRegister = findViewById<Button>(R.id.registerButton)
|
||||||
|
|
||||||
|
btnReturn.setOnClickListener {
|
||||||
|
//val intent = Intent(this, MainActivity::class.java)
|
||||||
|
//startActivity(intent)
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
btnRegister.setOnClickListener {
|
||||||
|
showRegisterDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showRegisterDialog() {
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
val inflater = layoutInflater
|
||||||
|
val dialogView = inflater.inflate(R.layout.dialog_register, null)
|
||||||
|
|
||||||
|
val etNickname = dialogView.findViewById<EditText>(R.id.nickname)
|
||||||
|
val etPassword = dialogView.findViewById<EditText>(R.id.password)
|
||||||
|
val btnSave = dialogView.findViewById<Button>(R.id.buttonSave)
|
||||||
|
val btnDismiss = dialogView.findViewById<Button>(R.id.buttonDismiss)
|
||||||
|
|
||||||
|
val dialog = builder.setView(dialogView).create()
|
||||||
|
|
||||||
|
btnSave.setOnClickListener {
|
||||||
|
val nickname = etNickname.text.toString()
|
||||||
|
val password = etPassword.text.toString()
|
||||||
|
// Faites quelque chose avec le nom d'utilisateur et le mot de passe
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
btnDismiss.setOnClickListener {
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.mathseduc
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.ProgressBar
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.example.mathseduc.controllers.ControllerLobby
|
||||||
|
import com.example.mathseduc.controllers.ControllerQuestion
|
||||||
|
|
||||||
|
class QuizMultiActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private lateinit var countDownTimer: CountDownTimer
|
||||||
|
|
||||||
|
var progressBarValue : Int = 0
|
||||||
|
var chronoValue : Int = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_quiz_multi)
|
||||||
|
|
||||||
|
val lobbyId = intent.getIntExtra("lobbyId", -1)
|
||||||
|
|
||||||
|
var progressBar1 = findViewById<ProgressBar>(R.id.progressBar1)
|
||||||
|
var chrono = findViewById<ProgressBar>(R.id.chrono)
|
||||||
|
|
||||||
|
progressBar1.max = 100
|
||||||
|
chrono.max = 30
|
||||||
|
|
||||||
|
val toto = ControllerQuestion.getQuestionsForLobby(ControllerLobby.getIdQuestionsLobby(lobbyId))
|
||||||
|
|
||||||
|
var incrementeButton = findViewById<Button>(R.id.buttonValider)
|
||||||
|
|
||||||
|
// Initialiser le CountDownTimer
|
||||||
|
countDownTimer = object : CountDownTimer(30*1000, 1000) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
// Incrémenter la valeur de la ProgressBar chaque seconde
|
||||||
|
chronoValue++
|
||||||
|
chrono.progress = chronoValue
|
||||||
|
progressBarValue++
|
||||||
|
progressBar1.progress = progressBarValue
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
// Code à exécuter lorsque le timer est terminé
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incrementeButton.setOnClickListener {
|
||||||
|
progressBarValue += 10
|
||||||
|
progressBar1.progress = progressBarValue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Démarrer le CountDownTimer
|
||||||
|
countDownTimer.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
// Arrêter le CountDownTimer pour éviter les fuites de mémoire
|
||||||
|
countDownTimer.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,20 +1,159 @@
|
|||||||
package com.example.mathseduc
|
package com.example.mathseduc
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.ListView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
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 okhttp3.MultipartBody
|
||||||
|
|
||||||
class ServerDetailsActivity : AppCompatActivity() {
|
class ServerDetailsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private var playerList: List<Player> = emptyList()
|
||||||
|
private lateinit var playerAdapter: PlayerAdapter
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
private val refreshInterval: Long = 2000
|
||||||
|
|
||||||
|
private val onBackPressedCallback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
myBackPressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
setContentView(R.layout.activity_server_details)
|
setContentView(R.layout.activity_server_details)
|
||||||
|
|
||||||
val serverName = intent.getStringExtra("serverName")
|
val serverName = intent.getStringExtra("serverName")
|
||||||
|
|
||||||
// Now you can use the data as needed, for example, display it in a TextView
|
|
||||||
val serverNameTextView = findViewById<TextView>(R.id.titleServerDetails)
|
val serverNameTextView = findViewById<TextView>(R.id.titleServerDetails)
|
||||||
serverNameTextView.text = serverName
|
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<ListView>(R.id.listViewPlayers)
|
||||||
|
playerAdapter = PlayerAdapter(this, playerList)
|
||||||
|
listViewPlayers.adapter = playerAdapter
|
||||||
|
|
||||||
|
handler.postDelayed(refreshRunnable, refreshInterval)
|
||||||
|
|
||||||
|
val btnLaunchQuiz = findViewById<Button>(R.id.btnLaunchQuiz)
|
||||||
|
|
||||||
|
if (ControllerLobby.playerCreatorIdPresentInLobby(MainActivity.idPlayerConnected, lobbyId)) {
|
||||||
|
btnLaunchQuiz.visibility = View.VISIBLE
|
||||||
|
btnLaunchQuiz.setOnClickListener {
|
||||||
|
|
||||||
|
val formDataBuilder = MultipartBody.Builder().setType(MultipartBody.FORM)
|
||||||
|
formDataBuilder.addFormDataPart("launched", "1")
|
||||||
|
|
||||||
|
ControllerLobby.updateLobbyLauched(lobbyId,formDataBuilder)
|
||||||
|
|
||||||
|
val intent = Intent(this, QuizMultiActivity::class.java)
|
||||||
|
intent.putExtra("lobbyId", lobbyId)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
btnLaunchQuiz.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
outState.putParcelableArrayList("playerList", ArrayList(playerList))
|
||||||
|
}
|
||||||
|
|
||||||
|
private val refreshRunnable: Runnable = object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
val lobbyId = intent.getIntExtra("lobbyId", -1)
|
||||||
|
|
||||||
|
val playerId = ControllerPlayer.getPlayersIdFromLobbyId(lobbyId)
|
||||||
|
if (playerId != null) {
|
||||||
|
playerList = playerId.mapNotNull { playerId ->
|
||||||
|
ControllerPlayer.getPlayerInfoById(playerId.toString())
|
||||||
|
}
|
||||||
|
playerAdapter.clear()
|
||||||
|
playerAdapter.addAll(playerList)
|
||||||
|
playerAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
val btnLaunchQuiz = findViewById<Button>(R.id.btnLaunchQuiz)
|
||||||
|
|
||||||
|
if (ControllerLobby.playerCreatorIdPresentInLobby(MainActivity.idPlayerConnected, lobbyId)) {
|
||||||
|
btnLaunchQuiz.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
btnLaunchQuiz.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ControllerLobby.lobbyIsLaunched(lobbyId)){
|
||||||
|
val intent = Intent(this@ServerDetailsActivity, QuizMultiActivity::class.java)
|
||||||
|
intent.putExtra("lobbyId", lobbyId)
|
||||||
|
startActivity(intent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.postDelayed(this, refreshInterval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun myBackPressed() {
|
||||||
|
val lobbyId = intent.getIntExtra("lobbyId", -1)
|
||||||
|
|
||||||
|
ControllerUtiliser.DeleteUtiliserForLobby(MainActivity.idPlayerConnected, lobbyId)
|
||||||
|
|
||||||
|
if (ControllerLobby.playerCreatorIdPresentInLobby(MainActivity.idPlayerConnected, lobbyId)) {
|
||||||
|
val idNextPlayerCreator = ControllerUtiliser.getIdNextPlayerInLobby(lobbyId)
|
||||||
|
|
||||||
|
if (idNextPlayerCreator == -1) {
|
||||||
|
ControllerLobby.deleteLobby(lobbyId)
|
||||||
|
} else {
|
||||||
|
val formDataBuilder = MultipartBody.Builder().setType(MultipartBody.FORM)
|
||||||
|
formDataBuilder.addFormDataPart("idplayercreator", idNextPlayerCreator.toString())
|
||||||
|
ControllerLobby.updateLobbyIdCreatorLobby(lobbyId, formDataBuilder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handler.removeCallbacks(refreshRunnable)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
class PlayerAdapter(context: Context, players: List<Player>) :
|
||||||
|
ArrayAdapter<Player>(context, 0, players) {
|
||||||
|
|
||||||
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||||
|
var currentPlayerView = convertView
|
||||||
|
if (currentPlayerView == null) {
|
||||||
|
currentPlayerView =
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.list_view_player, parent, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
val playerNameTextView = currentPlayerView!!.findViewById<TextView>(R.id.playerName)
|
||||||
|
playerNameTextView.text = getItem(position)?.nickname ?: "Unknown"
|
||||||
|
|
||||||
|
return currentPlayerView
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.example.mathseduc.controllers
|
||||||
|
|
||||||
|
import android.os.StrictMode
|
||||||
|
import com.example.mathseduc.models.*
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import org.mindrot.jbcrypt.BCrypt
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
class ControllerPlayer {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun getPlayersIdFromLobbyId(lobbyId: Int): List<Int>? {
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/utiliser/$lobbyId/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
||||||
|
|
||||||
|
val gson = Gson()
|
||||||
|
val typeTokenProduct = object : TypeToken<List<Utiliser>>() {}.type
|
||||||
|
|
||||||
|
val playerInfoList: List<Utiliser> = gson.fromJson(response.body!!.string(), typeTokenProduct)
|
||||||
|
|
||||||
|
// Extract player IDs from PlayerInfo list
|
||||||
|
val playerIds: List<Int> = playerInfoList.map { it.idplayer }
|
||||||
|
|
||||||
|
return playerIds
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getPlayerInfoById(playerId: String): Player? {
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/players/$playerId/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
||||||
|
|
||||||
|
val gson = Gson()
|
||||||
|
val playerInfo: List<Player> = gson.fromJson(response.body!!.string(), object : TypeToken<List<Player>>() {}.type)
|
||||||
|
|
||||||
|
// Assuming the API returns a list even for a single player, we take the first item
|
||||||
|
return playerInfo.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
fun authenticateUser(nickname: String, password: String): Int {
|
||||||
|
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
// Client HTTP API
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
// API Access
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/verif/player/$nickname/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// API Response
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
val responseData = response.body?.string()
|
||||||
|
|
||||||
|
// Use Gson to parse the JSON response
|
||||||
|
val gson = Gson()
|
||||||
|
val playerListType = object : TypeToken<List<Player>>() {}.type
|
||||||
|
val playerList: List<Player> = gson.fromJson(responseData, playerListType)
|
||||||
|
|
||||||
|
// Check if the list is not empty
|
||||||
|
if (playerList.isNotEmpty()) {
|
||||||
|
val storedPasswordHash = playerList[0].password
|
||||||
|
|
||||||
|
// Use BCrypt to check if the provided password matches the stored hash
|
||||||
|
if(BCrypt.checkpw(password, storedPasswordHash)){
|
||||||
|
return playerList[0].id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.example.mathseduc.controllers
|
||||||
|
|
||||||
|
import android.os.StrictMode
|
||||||
|
import android.util.Log
|
||||||
|
import com.example.mathseduc.models.Lobby
|
||||||
|
import com.example.mathseduc.models.Question
|
||||||
|
import com.example.mathseduc.models.Utiliser
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import org.json.JSONObject
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
|
||||||
|
class ControllerQuestion {
|
||||||
|
companion object {
|
||||||
|
fun getQuestionsForLobby(questionIds: ArrayList<String>): List<Question>? {
|
||||||
|
val questions = ArrayList<Question>()
|
||||||
|
|
||||||
|
for (questionId in questionIds) {
|
||||||
|
val question = getQuestionById(questionId)
|
||||||
|
if (question != null) {
|
||||||
|
questions.add(question)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (questions.isNotEmpty()) questions else null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getQuestionById(questionId: String): Question? {
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
// Client HTTP API
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
// API Access
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/questions/$questionId/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// API Response
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
// Handle error, log, or throw an exception as needed
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gson deserialization
|
||||||
|
val gson = Gson()
|
||||||
|
val typeTokenProduct = object : TypeToken<ArrayList<Question>>() {}.type
|
||||||
|
|
||||||
|
val question: ArrayList<Question> = gson.fromJson(response.body!!.string(), typeTokenProduct)
|
||||||
|
|
||||||
|
// Assuming the API returns a list with a single question
|
||||||
|
return if (question.isNotEmpty()) question[0] else null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.example.mathseduc.controllers
|
||||||
|
|
||||||
|
import android.os.StrictMode
|
||||||
|
import android.util.Log
|
||||||
|
import com.example.mathseduc.models.Lobby
|
||||||
|
import com.example.mathseduc.models.Utiliser
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
class ControllerUtiliser {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun createUtiliserByIdLobby(utiliserData: MultipartBody.Builder): Boolean {
|
||||||
|
try {
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
// Client HTTP API
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
// API Access
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/add/utiliser/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.post(utiliserData.build())
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// API Response
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
// Vérifier si la création du lobby a réussi
|
||||||
|
return response.isSuccessful
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Log en cas d'erreur
|
||||||
|
Log.e("CreateLobby", "Error creating lobby", e)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun DeleteUtiliserForLobby(idPlayerConnected: Int, lobbyId: Int): Boolean {
|
||||||
|
try {
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
// Client HTTP API
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
// API Access
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/delete/utiliser/$lobbyId/$idPlayerConnected/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.delete()
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// API Response
|
||||||
|
val response: Response = client.newCall(request).execute()
|
||||||
|
|
||||||
|
// Vérifier si la suppression a réussi
|
||||||
|
return response.isSuccessful
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Log en cas d'erreur
|
||||||
|
Log.e("DeleteUtiliser", "Error deleting utiliser", e)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun getIdNextPlayerInLobby(lobbyId: Int): Int {
|
||||||
|
|
||||||
|
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
|
||||||
|
StrictMode.setThreadPolicy(policy)
|
||||||
|
|
||||||
|
// Client HTTP API
|
||||||
|
val client = OkHttpClient()
|
||||||
|
|
||||||
|
// API Access
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url("https://trusting-panini.87-106-126-109.plesk.page/api/utiliser/$lobbyId/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// API Response
|
||||||
|
client.newCall(request).execute().use { response ->
|
||||||
|
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
||||||
|
|
||||||
|
// Gson deserialization
|
||||||
|
val gson = Gson()
|
||||||
|
val typeTokenProduct = object : TypeToken<ArrayList<Utiliser>>() {}.type
|
||||||
|
|
||||||
|
val utiliser: ArrayList<Utiliser> = gson.fromJson(response.body!!.string(), typeTokenProduct)
|
||||||
|
if (utiliser.isNotEmpty()){
|
||||||
|
return utiliser[0].idplayer
|
||||||
|
} else {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
package com.example.mathseduc.models
|
package com.example.mathseduc.models
|
||||||
|
|
||||||
data class Lobby(
|
data class Lobby(
|
||||||
val id: String,
|
val id: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
val password: String,
|
val password: String,
|
||||||
val nbplayers: Int,
|
val nbplayers: Int,
|
||||||
val idplayercreator: Int,
|
val idplayercreator: Int,
|
||||||
val idchapter: Int,
|
val idchapter: Int,
|
||||||
val difficulty: Int
|
val difficulty: Int,
|
||||||
|
val launched: Int
|
||||||
)
|
)
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.example.mathseduc.models
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
|
data class Player(
|
||||||
|
val id: Int,
|
||||||
|
val nickname: String,
|
||||||
|
val password: String
|
||||||
|
) : Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readInt(),
|
||||||
|
parcel.readString() ?: "",
|
||||||
|
parcel.readString() ?: ""
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeInt(id)
|
||||||
|
parcel.writeString(nickname)
|
||||||
|
parcel.writeString(password)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<Player> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): Player {
|
||||||
|
return Player(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<Player?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.mathseduc.models
|
||||||
|
|
||||||
|
data class Question(
|
||||||
|
val id: Int,
|
||||||
|
val content: String,
|
||||||
|
val nbfails: Int,
|
||||||
|
val difficulty: Int,
|
||||||
|
val idchapter: Int,
|
||||||
|
val idanswergood: Int,
|
||||||
|
)
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.mathseduc.models
|
||||||
|
|
||||||
|
data class Utiliser (
|
||||||
|
val idlobby: Int,
|
||||||
|
val idplayer: Int,
|
||||||
|
val playertime: Int
|
||||||
|
)
|
After Width: | Height: | Size: 641 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 240 B |
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape android:shape="ring"
|
||||||
|
android:thickness="10dp"
|
||||||
|
android:useLevel="false">
|
||||||
|
|
||||||
|
<solid android:color="@color/black"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:id="@+id/chrono">
|
||||||
|
|
||||||
|
<shape android:shape="ring"
|
||||||
|
android:thickness="10dp"
|
||||||
|
android:useLevel="true">
|
||||||
|
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
After Width: | Height: | Size: 635 B |
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<!-- View border color and width -->
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/white" >
|
||||||
|
</stroke>
|
||||||
|
|
||||||
|
<!-- The radius makes the corners rounded -->
|
||||||
|
<corners
|
||||||
|
android:radius="2dp" >
|
||||||
|
</corners>
|
||||||
|
|
||||||
|
</shape>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
<stroke android:width="1dp"
|
||||||
|
android:color="@color/grey"/>
|
||||||
|
</shape>
|
@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ConnexionPlayerActivity">
|
||||||
|
<!--<Button
|
||||||
|
android:id="@+id/btnReturn"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="@string/fleche"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:textSize="70sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.051"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />-->
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btnReturn"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@drawable/arrow_small"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:contentDescription="@string/retour"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.030"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="25dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:fontFamily="@font/math_educ_font"
|
||||||
|
android:text="@string/connexion"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="50sp" />
|
||||||
|
|
||||||
|
<!--<TextView
|
||||||
|
android:id="@+id/errorTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@android:color/holo_red_dark"
|
||||||
|
android:textSize="20sp" /> -->
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextNickname"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:background="@drawable/rounded_corner"
|
||||||
|
android:hint="@string/nom_d_utilisateur"
|
||||||
|
android:inputType="text"
|
||||||
|
android:minHeight="50dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:background="@drawable/rounded_corner"
|
||||||
|
android:hint="@string/mot_de_passe"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:minHeight="50dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonLogin"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="13dp"
|
||||||
|
android:backgroundTint="@color/turquoise"
|
||||||
|
android:text="@string/se_connecter" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/registerButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:backgroundTint="@color/blue"
|
||||||
|
android:text="@string/s_inscrire" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar1"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar2"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar3"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar4"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/chrono"
|
||||||
|
android:layout_weight="0.05"
|
||||||
|
android:paddingHorizontal="10dp"
|
||||||
|
style="?android:attr/progressBarStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminateOnly="false"
|
||||||
|
android:rotation="-90"
|
||||||
|
android:progressDrawable="@drawable/chrono"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingVertical="20dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/question_border"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Question"
|
||||||
|
android:layout_weight="5"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/blue"
|
||||||
|
android:text="Answer1" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/green"
|
||||||
|
android:text="Answer2" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/orange"
|
||||||
|
android:text="Answer3" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/purple_500"
|
||||||
|
android:text="Answer4" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonPasser"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/red"
|
||||||
|
android:text="Passer" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonValider"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:backgroundTint="@color/green"
|
||||||
|
android:text="Valider" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="350dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/rounded_corner"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:fontFamily="@font/math_educ_font"
|
||||||
|
android:text="@string/creer_compte"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="40sp"/>
|
||||||
|
|
||||||
|
<!--<TextView
|
||||||
|
android:id="@+id/errorTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text=""
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@android:color/holo_red_dark"
|
||||||
|
android:textSize="20sp" /> -->
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/nickname"
|
||||||
|
android:layout_width="320dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/rounded_corner"
|
||||||
|
android:hint="@string/nom_d_utilisateur"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:inputType="text"
|
||||||
|
android:minHeight="50dp"
|
||||||
|
android:autofillHints=""
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:layout_width="320dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:background="@drawable/rounded_corner"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:hint="@string/mot_de_passe"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:minHeight="50dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:autofillHints=""
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="end"
|
||||||
|
android:layout_marginTop="15dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonDismiss"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:backgroundTint="@color/blackgrey"
|
||||||
|
android:text="@string/fermer"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
style="?android:attr/buttonBarButtonStyle" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonSave"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:backgroundTint="@color/blue"
|
||||||
|
android:text="@string/enregistrer"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
style="?android:attr/buttonBarButtonStyle" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp" >
|
||||||
|
|
||||||
|
<!-- res/layout/list_view_player.xml -->
|
||||||
|
<TextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/playerName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@color/black"/>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
Loading…
Reference in new issue