fix
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
5353378b06
commit
d0ab279f50
@ -1,47 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.android.application'
|
|
||||||
id 'org.jetbrains.kotlin.android'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace 'com.example.mathseduc'
|
|
||||||
compileSdk 34
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "com.example.mathseduc"
|
|
||||||
minSdk 21
|
|
||||||
targetSdk 33
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = '1.8'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
||||||
implementation 'com.google.android.material:material:1.11.0'
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
|
||||||
|
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
|
||||||
implementation "org.mindrot:jbcrypt:0.4"
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
package com.example.mathseduc
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.widget.*
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import com.example.mathseduc.controllers.ControllerChapter
|
|
||||||
import com.example.mathseduc.controllers.ControllerLobby
|
|
||||||
import com.example.mathseduc.controllers.ControllerUtiliser
|
|
||||||
import okhttp3.MultipartBody
|
|
||||||
import org.json.JSONObject
|
|
||||||
|
|
||||||
|
|
||||||
class CreateLobbyActivity : AppCompatActivity() {
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_create_lobby)
|
|
||||||
|
|
||||||
var spinnerChapter = findViewById<Spinner>(R.id.spinnerChapter)
|
|
||||||
|
|
||||||
// Fetch chapters from API
|
|
||||||
val chaptersFromApi = ControllerChapter.getChapters()
|
|
||||||
|
|
||||||
// Populate Spinner with fetched chapters
|
|
||||||
if (chaptersFromApi != null) {
|
|
||||||
val chapterNames = chaptersFromApi.map { it.name }.toTypedArray()
|
|
||||||
|
|
||||||
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, chapterNames)
|
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
|
||||||
spinnerChapter.adapter = adapter
|
|
||||||
}
|
|
||||||
|
|
||||||
val buttonCreateLobby = findViewById<Button>(R.id.buttonCreateLobby)
|
|
||||||
buttonCreateLobby.setOnClickListener {
|
|
||||||
val lobbyName = findViewById<EditText>(R.id.editTextLobbyName).text.toString()
|
|
||||||
val password = findViewById<EditText>(R.id.editTextPassword).text.toString()
|
|
||||||
val nbPlayers = findViewById<EditText>(R.id.editTextNbPlayers).text.toString()
|
|
||||||
val difficulty = findViewById<Spinner>(R.id.spinnerDifficulty).selectedItemPosition + 1
|
|
||||||
val selectedChapterPosition = findViewById<Spinner>(R.id.spinnerChapter).selectedItemPosition
|
|
||||||
val idChapter = chaptersFromApi?.getOrNull(selectedChapterPosition)?.id?: -1
|
|
||||||
|
|
||||||
if (lobbyName.isNullOrBlank() || password.isNullOrBlank() || nbPlayers.isNullOrBlank() || nbPlayers.toInt() <= 0) {
|
|
||||||
Toast.makeText(this, "Échec de la création du lobby. Veuillez réessayer.", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Create form data
|
|
||||||
val formDataBuilder = MultipartBody.Builder().setType(MultipartBody.FORM)
|
|
||||||
|
|
||||||
// Add fields to form data
|
|
||||||
formDataBuilder.addFormDataPart("name", lobbyName)
|
|
||||||
formDataBuilder.addFormDataPart("password", password)
|
|
||||||
formDataBuilder.addFormDataPart("nbplayers", nbPlayers.toString())
|
|
||||||
formDataBuilder.addFormDataPart("idplayercreator", MainActivity.idPlayerConnected.toString())
|
|
||||||
formDataBuilder.addFormDataPart("idchapter", idChapter.toString())
|
|
||||||
formDataBuilder.addFormDataPart("difficulty", difficulty.toString())
|
|
||||||
|
|
||||||
// Appeler la fonction pour créer le lobby
|
|
||||||
val idLobbyCreatedSuccessfully = ControllerLobby.createLobby(formDataBuilder)
|
|
||||||
|
|
||||||
// Vérifier si la création du lobby a réussi
|
|
||||||
if (idLobbyCreatedSuccessfully != -1) {
|
|
||||||
val formDataBuilder = MultipartBody.Builder().setType(MultipartBody.FORM)
|
|
||||||
formDataBuilder.addFormDataPart("idplayer", MainActivity.idPlayerConnected.toString())
|
|
||||||
formDataBuilder.addFormDataPart("idlobby", idLobbyCreatedSuccessfully.toString())
|
|
||||||
formDataBuilder.addFormDataPart("playertime", "0")
|
|
||||||
|
|
||||||
ControllerUtiliser.createUtiliserByIdLobby(formDataBuilder)
|
|
||||||
|
|
||||||
val intent = Intent(this, ServerDetailsActivity::class.java)
|
|
||||||
intent.putExtra("serverName", lobbyName)
|
|
||||||
intent.putExtra("lobbyId", idLobbyCreatedSuccessfully)
|
|
||||||
startActivity(intent)
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "Échec de la création du lobby. Veuillez réessayer.", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
package com.example.mathseduc
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.*
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import com.example.mathseduc.controllers.ControllerChapter
|
|
||||||
import com.example.mathseduc.controllers.ControllerLobby
|
|
||||||
import com.example.mathseduc.controllers.ControllerUtiliser
|
|
||||||
import com.example.mathseduc.models.Lobby
|
|
||||||
import okhttp3.MultipartBody
|
|
||||||
|
|
||||||
class MultiActivity : AppCompatActivity() {
|
|
||||||
|
|
||||||
private lateinit var lobbyAdapter: LobbyAdapter
|
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
|
||||||
private val refreshInterval: Long = 3000 // Refresh every 3 seconds
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_multi)
|
|
||||||
|
|
||||||
var btnAddLobby = findViewById<Button>(R.id.btnAddLobby)
|
|
||||||
|
|
||||||
val serverList = ControllerLobby.getLobbies()
|
|
||||||
|
|
||||||
if (serverList != null) {
|
|
||||||
|
|
||||||
val listView = findViewById<ListView>(R.id.listView)
|
|
||||||
|
|
||||||
lobbyAdapter = LobbyAdapter(this, serverList)
|
|
||||||
listView.adapter = lobbyAdapter
|
|
||||||
|
|
||||||
listView.setOnItemClickListener { _, _, position, _ ->
|
|
||||||
if (ControllerLobby.getNbPlayerInLobby(serverList[position].id) < serverList[position].nbplayers) {
|
|
||||||
val formDataBuilder = MultipartBody.Builder().setType(MultipartBody.FORM)
|
|
||||||
formDataBuilder.addFormDataPart("idplayer", MainActivity.idPlayerConnected.toString())
|
|
||||||
formDataBuilder.addFormDataPart("idlobby", serverList[position].id.toString())
|
|
||||||
formDataBuilder.addFormDataPart("playertime", "0")
|
|
||||||
|
|
||||||
ControllerUtiliser.createUtiliserByIdLobby(formDataBuilder)
|
|
||||||
|
|
||||||
val intent = Intent(this, ServerDetailsActivity::class.java)
|
|
||||||
intent.putExtra("serverName", serverList[position].name)
|
|
||||||
intent.putExtra("lobbyId", serverList[position].id)
|
|
||||||
startActivity(intent)
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "Oh nan, le serveur est déjà plein ! Réessayer plus tard.", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schedule periodic refresh using Handler and Runnable
|
|
||||||
handler.postDelayed(refreshRunnable, refreshInterval)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.e("MultiActivity", "Error fetching server list")
|
|
||||||
}
|
|
||||||
|
|
||||||
btnAddLobby.setOnClickListener {
|
|
||||||
val intent = Intent(this, CreateLobbyActivity::class.java)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
val btnReturn = findViewById<ImageButton>(R.id.btnReturn)
|
|
||||||
|
|
||||||
btnReturn.setOnClickListener {
|
|
||||||
//val intent = Intent(this, MainActivity::class.java)
|
|
||||||
//startActivity(intent)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
// Remove callbacks to prevent memory leaks
|
|
||||||
handler.removeCallbacks(refreshRunnable)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val refreshRunnable: Runnable = object : Runnable {
|
|
||||||
override fun run() {
|
|
||||||
// Refresh the server list
|
|
||||||
val serverList = ControllerLobby.getLobbies()
|
|
||||||
if (serverList != null) {
|
|
||||||
lobbyAdapter.clear()
|
|
||||||
lobbyAdapter.addAll(serverList)
|
|
||||||
lobbyAdapter.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
// Schedule the next refresh
|
|
||||||
handler.postDelayed(this, refreshInterval)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LobbyAdapter(context: Context, lobbies: ArrayList<Lobby>) :
|
|
||||||
ArrayAdapter<Lobby>(context, 0, lobbies), View.OnClickListener {
|
|
||||||
|
|
||||||
private val mContext: Context
|
|
||||||
private val mLobbies: ArrayList<Lobby>
|
|
||||||
|
|
||||||
private var selectedItem = -1
|
|
||||||
|
|
||||||
// Get Access to Context and Data Array
|
|
||||||
init {
|
|
||||||
mContext = context
|
|
||||||
mLobbies = lobbies
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCount(): Int {
|
|
||||||
return mLobbies.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemId(position: Int): Long {
|
|
||||||
return mLobbies[position].id.toLong()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItem(position: Int): Lobby {
|
|
||||||
return mLobbies[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
|
||||||
var currentLobbyView = convertView
|
|
||||||
if (currentLobbyView == null) {
|
|
||||||
currentLobbyView =
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.list_view_lobby, parent, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
val name = currentLobbyView!!.findViewById<TextView>(R.id.name)
|
|
||||||
val nbplayers = currentLobbyView!!.findViewById<TextView>(R.id.nbplayers)
|
|
||||||
val idchapter = currentLobbyView!!.findViewById<TextView>(R.id.idchapter)
|
|
||||||
val difficulty = currentLobbyView!!.findViewById<TextView>(R.id.difficulty)
|
|
||||||
|
|
||||||
name.text = mLobbies[position].name
|
|
||||||
nbplayers.text = ControllerLobby.getNbPlayerInLobby(mLobbies[position].id).toString() + "/" + mLobbies[position].nbplayers.toString()
|
|
||||||
idchapter.text = ControllerChapter.getChapterNameById(mLobbies[position].idchapter)
|
|
||||||
difficulty.text = mLobbies[position].difficulty.toString()
|
|
||||||
|
|
||||||
return currentLobbyView
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setSelectedItem(position: Int) {
|
|
||||||
selectedItem = position
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getSelectedItem(): Lobby? {
|
|
||||||
if (selectedItem != -1)
|
|
||||||
return mLobbies[selectedItem]
|
|
||||||
else
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClick(p0: View?) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
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,159 +0,0 @@
|
|||||||
package com.example.mathseduc
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
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 androidx.activity.OnBackPressedCallback
|
|
||||||
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() {
|
|
||||||
|
|
||||||
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?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
|
||||||
setContentView(R.layout.activity_server_details)
|
|
||||||
|
|
||||||
val serverName = intent.getStringExtra("serverName")
|
|
||||||
|
|
||||||
val serverNameTextView = findViewById<TextView>(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<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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 240 B |
@ -1,27 +0,0 @@
|
|||||||
<?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>
|
|
Before Width: | Height: | Size: 635 B |
@ -1,16 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<corners android:topLeftRadius="20dp"
|
|
||||||
android:topRightRadius="20dp"/>
|
|
||||||
<solid android:color="@color/grey"/>
|
|
||||||
</shape>
|
|
Binary file not shown.
@ -1,112 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout 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:padding="16dp"
|
|
||||||
android:background="#000000">
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editTextLobbyName"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="Lobby Name"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:layout_marginBottom="16dp"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editTextPassword"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="Password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:layout_below="@id/editTextLobbyName"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginBottom="16dp"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editTextNbPlayers"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="Number of Players"
|
|
||||||
android:inputType="number"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:layout_below="@id/editTextPassword"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginBottom="16dp"/>
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/spinnerDifficulty"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/editTextNbPlayers"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:entries="@array/difficulty_array"
|
|
||||||
android:prompt="@string/difficulty_prompt"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/spinnerChapter"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/spinnerDifficulty"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:background="#FFFFFF"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:entries="@array/chapter_array"
|
|
||||||
android:prompt="@string/chapter_prompt"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/buttonCreateLobby"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Create Lobby"
|
|
||||||
android:background="#4CAF50"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:layout_below="@id/spinnerChapter"
|
|
||||||
android:layout_marginTop="16dp"/>
|
|
||||||
</RelativeLayout>
|
|
@ -1,54 +0,0 @@
|
|||||||
<?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:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:weightSum="10"
|
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/background_image"
|
|
||||||
android:layout_width="160dp"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:contentDescription="@string/app_name"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/logo" />
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnSolo"
|
|
||||||
android:layout_width="370dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.25"
|
|
||||||
android:backgroundTint="@color/green"
|
|
||||||
android:text="@string/solo" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnMulti"
|
|
||||||
android:layout_width="370dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.25"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:backgroundTint="@color/orange"
|
|
||||||
android:text="@string/multiplayer" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnConnexion"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.25"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:backgroundTint="@color/grey"
|
|
||||||
android:text="@string/connexion" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,60 +0,0 @@
|
|||||||
<?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="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".MultiActivity">
|
|
||||||
|
|
||||||
<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"
|
|
||||||
android:layout_marginStart="15dp"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginVertical="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
android:layout_weight="95"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:fontFamily="@font/math_educ_font"
|
|
||||||
android:text="@string/listLobbies"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="40sp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnAddLobby"
|
|
||||||
android:layout_width="140dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginEnd="20dp"
|
|
||||||
android:layout_weight="5"
|
|
||||||
android:backgroundTint="@color/blue"
|
|
||||||
android:text="@string/addLobby" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<include layout="@layout/header_list_lobby" />
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/listView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="85"
|
|
||||||
android:background="@color/white" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,204 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,36 +0,0 @@
|
|||||||
<?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="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
tools:context=".ServerDetailsActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleServerDetails"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="LobbyTitle"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="20dp"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:layout_gravity="center"/>
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/listViewPlayers"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="75"
|
|
||||||
android:background="@color/white" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnLaunchQuiz"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:background="@drawable/top_rounded_corner"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/lobby"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/nbPlayer"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,52 +0,0 @@
|
|||||||
<?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="45dp" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:paddingTop="4dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/name"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="0.4"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="Name"
|
|
||||||
android:textSize="18dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/difficulty"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="14dp"
|
|
||||||
android:text="Difficulty"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/idchapter"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="14dp"
|
|
||||||
android:text="idChapter"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nbplayers"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="14dp"
|
|
||||||
android:text="NbPlayers"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
@ -1,18 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
@ -1,16 +0,0 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="Theme.MathsEduc" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
|
||||||
<!-- Primary brand color. -->
|
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
|
||||||
<!-- Secondary brand color. -->
|
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
|
||||||
<!-- Status bar color. -->
|
|
||||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -1,6 +0,0 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
plugins {
|
|
||||||
id 'com.android.application' version '7.4.2' apply false
|
|
||||||
id 'com.android.library' version '7.4.2' apply false
|
|
||||||
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rootProject.name = "MathsEduc"
|
|
||||||
include ':app'
|
|
Loading…
Reference in new issue