Maxence GUITARD 1 year ago
commit 5b2f5f0d67

@ -10,7 +10,7 @@ android {
defaultConfig {
applicationId "com.example.mathseduc"
minSdk 21
targetSdk 34
targetSdk 33
versionCode 1
versionName "1.0"
@ -44,4 +44,5 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation "org.mindrot:jbcrypt:0.4"
}

@ -22,5 +22,6 @@
<activity android:name=".MultiActivity" />
<activity android:name=".ServerDetailsActivity" />
<activity android:name=".CreateLobbyActivity" />
<activity android:name=".ConnexionPlayerActivity" />
</application>
</manifest>

@ -0,0 +1,40 @@
package com.example.mathseduc
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.example.mathseduc.controllers.ControllerPlayer
import org.mindrot.jbcrypt.BCrypt
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()
}
}
}
}

@ -6,7 +6,8 @@ import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import com.example.mathseduc.controllers.ControllerChapter
import com.example.mathseduc.controllers.ControllerLobby
import com.example.mathseduc.models.Lobby
import com.example.mathseduc.controllers.ControllerUtiliser
import okhttp3.MultipartBody
import org.json.JSONObject
@ -34,27 +35,42 @@ class CreateLobbyActivity : AppCompatActivity() {
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().toInt()
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 chapterId = chaptersFromApi?.getOrNull(selectedChapterPosition)?.id?.toInt() ?: -1
val idChapter = chaptersFromApi?.getOrNull(selectedChapterPosition)?.id?: -1
// Créer un objet Lobby avec les valeurs du formulaire
val lobbyData = JSONObject().apply {
put("name", lobbyName)
put("password", password)
put("nbplayers", nbPlayers)
put("idplayercreator", 53)
put("idchapter", chapterId)
put("difficulty", difficulty)
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 lobbyCreatedSuccessfully = ControllerLobby.createLobby(lobbyData)
val idLobbyCreatedSuccessfully = ControllerLobby.createLobby(formDataBuilder)
// Vérifier si la création du lobby a réussi
if (lobbyCreatedSuccessfully) {
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()
@ -62,3 +78,4 @@ class CreateLobbyActivity : AppCompatActivity() {
}
}
}
}

@ -3,9 +3,13 @@ package com.example.mathseduc
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
companion object {
var idPlayerConnected: Int = -1
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -21,9 +25,19 @@ class MainActivity : AppCompatActivity() {
}
btnMulti.setOnClickListener {
if (MainActivity.idPlayerConnected != -1){
val intent = Intent(this, MultiActivity::class.java)
startActivity(intent)
}
else {
Toast.makeText(this, "Vous n'êtes pas connecté", Toast.LENGTH_SHORT).show()
}
}
btnConnexion.setOnClickListener {
val intent = Intent(this, ConnexionPlayerActivity::class.java)
startActivity(intent)
}
btnConnexion.setOnClickListener{
val intent = Intent(this, ConnexionPlayerActivity::class.java)

@ -13,7 +13,9 @@ import android.widget.ListView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.example.mathseduc.controllers.ControllerLobby
import com.example.mathseduc.controllers.ControllerUtiliser
import com.example.mathseduc.models.Lobby
import okhttp3.MultipartBody
class MultiActivity : AppCompatActivity() {
@ -33,8 +35,16 @@ class MultiActivity : AppCompatActivity() {
listView.adapter = adapter
listView.setOnItemClickListener { _, _, position, _ ->
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 {

@ -1,11 +1,18 @@
package com.example.mathseduc
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.ListView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.example.mathseduc.controllers.ControllerPlayer
import com.example.mathseduc.models.Player
class ServerDetailsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_server_details)
@ -16,5 +23,35 @@ class ServerDetailsActivity : AppCompatActivity() {
val serverNameTextView = findViewById<TextView>(R.id.titleServerDetails)
serverNameTextView.text = serverName
val lobbyId = intent.getIntExtra("lobbyId", -1)
val playerIds = ControllerPlayer.getPlayersIdFromLobbyId(lobbyId)
if (playerIds != null) {
val playerList = playerIds.mapNotNull { playerId ->
ControllerPlayer.getPlayerInfoById(playerId.toString())
}
val listViewPlayers = findViewById<ListView>(R.id.listViewPlayers)
val playerAdapter = PlayerAdapter(this, playerList)
listViewPlayers.adapter = playerAdapter
}
}
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"
// You can customize the view further if needed
return currentPlayerView
}
}
}

@ -5,13 +5,13 @@ import android.util.Log
import com.example.mathseduc.models.Lobby
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject
import java.io.IOException
class ControllerLobby {
companion object {
fun getLobbies(): ArrayList<Lobby>? {
@ -24,7 +24,7 @@ class ControllerLobby {
// API Access
val request = Request.Builder()
.url("https://trusting-panini.87-106-126-109.plesk.page/api/all/lobbies/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO/1")
.url("https://trusting-panini.87-106-126-109.plesk.page/api/all/lobbies/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
.build()
// API Response
@ -40,11 +40,8 @@ class ControllerLobby {
return null
}
fun createLobby(lobbyData: JSONObject): Boolean {
fun createLobby(lobbyData: MultipartBody.Builder): Int {
try {
// Log avant l'appel API
Log.d("CreateLobby", "Request Data: ${lobbyData.toString()}")
val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
StrictMode.setThreadPolicy(policy)
@ -54,24 +51,25 @@ class ControllerLobby {
// API Access
val request = Request.Builder()
.url("https://trusting-panini.87-106-126-109.plesk.page/api/add/lobbies/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO")
.post(lobbyData.toString().toRequestBody("application/json".toMediaTypeOrNull()))
.post(lobbyData.build())
.build()
// API Response
client.newCall(request).execute().use { response ->
// Log après la réponse API
Log.d("CreateLobby", "Response Code: ${response.code}")
Log.d("CreateLobby", "Response Body: ${response.body?.string()}")
if (response.isSuccessful) {
// Si la réponse est réussie, extraire l'ID du lobby du corps de la réponse JSON
val responseBody = response.body?.string()
val jsonObject = JSONObject(responseBody)
// Vérifier si la création du lobby a réussi
return response.isSuccessful
// Retourner l'ID du lobby
return jsonObject.optInt("lobby_id", -1)
}
}
} catch (e: Exception) {
// Log en cas d'erreur
Log.e("CreateLobby", "Error creating lobby", e)
return false
}
return -1
}
}
}

@ -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,43 @@
package com.example.mathseduc.controllers
import android.os.StrictMode
import android.util.Log
import com.example.mathseduc.models.Lobby
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
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
}
}
}
}

@ -1,7 +1,7 @@
package com.example.mathseduc.models
data class Lobby(
val id: String,
val id: Int,
val name: String,
val password: String,
val nbplayers: Int,

@ -0,0 +1,7 @@
package com.example.mathseduc.models
data class Player(
val id: Int,
val nickname: String,
val password: String
)

@ -0,0 +1,7 @@
package com.example.mathseduc.models
data class Utiliser (
val idlobby: Int,
val idplayer: Int,
val playertime: Int
)

@ -1,99 +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">
<Button
android:id="@+id/btnReturn"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_gravity="start"
android:layout_marginTop="16dp"
android:backgroundTint="@color/grey"
android:text="@string/retour"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.948"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
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="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="15dp"
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" />
<Button
android:id="@+id/loginButton"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginTop="13dp"
android:backgroundTint="@color/blue"
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,40 @@
<?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">
<EditText
android:id="@+id/editTextNickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nickname"
android:background="#FFFFFF"
android:padding="8dp"
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:padding="8dp"
android:textColor="#000000"
android:layout_below="@id/editTextNickname"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"/>
<Button
android:id="@+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:background="#4CAF50"
android:textColor="#FFFFFF"
android:layout_below="@id/editTextPassword"
android:layout_marginTop="16dp"/>
</RelativeLayout>

@ -5,40 +5,50 @@
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">
android:weightSum="10"
tools:context=".MainActivity"
android:gravity="center">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/background_image"
android:layout_width="165dp"
android:layout_height="138dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
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="90dp"
android:layout_marginTop="40dp"
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="90dp"
android:layout_marginTop="30dp"
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="60dp"
android:layout_marginTop="50dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:layout_marginTop="10dp"
android:backgroundTint="@color/grey"
android:text="@string/connexion" />

@ -6,44 +6,44 @@
android:orientation="vertical"
tools:context=".MultiActivity">
<Button
android:id="@+id/btnReturn"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_marginTop="15dp"
android:layout_marginStart="20dp"
android:backgroundTint="@color/grey"
android:layout_gravity="start"
android:text="@string/retour" />
<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="50dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
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"
tools:ignore="TextSizeCheck" />
android:textSize="40sp" />
<Button
android:id="@+id/btnAddLobby"
android:layout_width="140dp"
android:layout_height="60dp"
android:layout_gravity="end"
android:layout_marginTop="5dp"
android:layout_marginEnd="15dp"
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"
tools:ignore="TextSizeCheck" />
android:text="@string/addLobby" />
</LinearLayout>
<include layout="@layout/header_list_lobby" />
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="524dp"
android:layout_height="0dp"
android:layout_weight="85"
android:background="@color/white" />
</LinearLayout>

@ -2,15 +2,30 @@
<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: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_centerInParent="true"
android:layout_weight="1"
android:text="LobbyTitle"
android:textColor="@color/white"
android:text="Bonjour depuis le serveur"
android:textSize="18sp"/>
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" />
</LinearLayout>

@ -1,7 +1,7 @@
<?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" >
android:layout_height="45dp" >
<LinearLayout
android:layout_width="match_parent"
@ -25,7 +25,7 @@
android:layout_width="0dp"
android:layout_weight="0.2"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:gravity="center"
android:textSize="10dp"
android:text="NbPlayers"/>
@ -34,7 +34,7 @@
android:layout_width="0dp"
android:layout_weight="0.2"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:gravity="center"
android:textSize="10dp"
android:text="Difficulty"/>
@ -43,7 +43,7 @@
android:layout_width="0dp"
android:layout_weight="0.2"
android:layout_height="match_parent"
android:gravity="center|center_vertical"
android:gravity="center"
android:textSize="10dp"
android:text="idChapter"/>

@ -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…
Cancel
Save