cleanup: suppression du code legacy (v3 pré-hub)

- Activités obsolètes: MainActivity, Jeux, JeuxParametres, ChatGPTTask
- Layouts associés et questionOLD.json (809 lignes)
- Entrées correspondantes du Manifest
Environ 3900 lignes supprimées. EndGameActivity conservée (utilisée par Classic).
This commit is contained in:
Roman
2026-08-19 18:41:07 +00:00
parent 69954bcff2
commit b3722ed776
9 changed files with 2 additions and 3787 deletions
+2 -15
View File
@@ -82,22 +82,9 @@
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<!-- Legacy Activities (to be removed) --> <!-- End of game -->
<!-- Legacy activities placeholder -->
<activity <activity
android:name="com.example.boidelov3.Jeux" android:name=".EndGameActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name="com.example.boidelov3.JeuxParametres"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name="com.example.boidelov3.EndGameActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
-809
View File
@@ -1,809 +0,0 @@
{
"version": "2",
"questions": [
{
"id": 1,
"question": "Celles/Ceux qui ont habité dans plus de 3 villes diferentes",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 2,
"question": "Ceux qui ont dansé aujourd'hui",
"gorger": 1,
"distribution": true,
"recois": true
},
{
"id": 3,
"question": "si tu n'as pas ton veritable nom sur insta",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 4,
"question": "si tu a des photos sur insta",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 5,
"question": "Les joueurs de Counter Strike ",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 5,
"question": "La dernière personne à avoir vomi en soirée ",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 6,
"question": "Toutes celles (ou ceux) qui ont du verni à ongles",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 7,
"question": "Tous les joueurs célibataires",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 8,
"question": "Tous ceux qui ont des lunettes",
"gorger": 2,
"distribution": true,
"recois": true
},
{
"id": 9,
"question": "Tous ceux qui ont déjà triché à un examen",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 10,
"question": "Le/La plus radin(e)",
"gorger": 4,
"distribution": false,
"recois": true
},
{
"id": 11,
"question": "<J1> a toi de juger : entre <J1> et <J2> qui stresse le plus pour un rien selon toi? Le perdant ",
"gorger": 5,
"distribution": false,
"recois": true
}, {
"id": 12,
"question": "Le mec qui a le plus gros ventre à bière ",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 13,
"question": "Tous ceux qui se sont déjà fait exclure de cours",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 14,
"question": "<J1>, donne le nombre d'habitant du/de la <variante> ( à 1 000 000 près) Si tu as faux tu bois, sinon tu ",
"gorger": 3,
"distribution": true,
"recois": false,
"variante": ["Tadjikistant", "Monaco", "Belgique", "Suisse", "Allemagne", "Chine", "Inde"]
},
{
"id": 15,
"question": "Tous ceux qui ont des frères et soeurs",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 16,
"question": "<J1> a qui appartient le slogan suivant? <variante>",
"variante": ["Des pâtes oui mais des (panzani)"," Le plaisir pour les petites faims. (Kinder Bueno)","Réveillez le lion qui est en vous. (Cereale lion)","Parce que le monde bouge (CIC)","Ça coule de source ! (Cristaline)", "Pensez différemment (apple)" ],
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 17,
"question": "Celles et ceux qui ont eu un Windows phone",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 18,
"question": "<J1>, Boire un café fait baisser le taux d'alcool? Si tu as faux ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 19,
"question": "Celles/Ceux qui se sont déjà battus",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 20,
"question": "Celui/Celle qui pèse le plus lourd",
"variante": ["lourd","leger"],
"gorger": 3,
"distribution": true,
"recois": false
},
{
"id": 21,
"question": "Pour se décoincer, le/la plus <variante>",
"variante": ["timide", "enervé ", "angoissé","aigri"],
"gorger": 2,
"distribution": false,
"recois": true
},
{
"id": 22,
"question": "Le/La plus <variante>",
"gorger": 3,
"variante": ["jeune","vieille"],
"distribution": false,
"recois": true
},
{
"id": 23,
"question": "Celles/Ceux qui ont fait des études <variante>",
"gorger": 3,
"variante": ["L","Scientifique", "Bac Professionel", "STMG"],
"distribution": true,
"recois": true
},
{
"id": 25,
"question": "Celles et ceux qui ont deja joué <variante> de maniere recurrente ",
"gorger": 3,
"variante": ["du piano","de la guitare", "du saxophone", "de la batterie"],
"distribution": true,
"recois": true
},
{
"id": 26,
"question": "Les gens qui se sont masturbés aujourd'hui",
"gorger": 3,
"distribution": true,
"recois": true,
"caliente": true
},
{
"id": 27,
"question": "Celui ou celle a la meilleure place",
"gorger": 2,
"distribution": false,
"recois": true
},
{
"id": 28,
"question": "Celles et ceux qui n'ont jamais trompé leur partenaire",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 29,
"question": "Celui/Celle avec les vêtements les plus beaux ",
"gorger": 1,
"distribution": false,
"recois": true
},
{
"id": 30,
"question": "Celui/Celle qui a les cheveux les plus <variante> ",
"gorger": 2,
"variante": ["longs","courts"],
"distribution": true,
"recois": true
},
{
"id": 31,
"question": "Les végans ",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 32,
"question": "La personne la plus maquillé ",
"gorger": 2,
"distribution": true,
"recois": true
}, {
"id": 33,
"question": "Celles/Ceux qui ont déjà appelé leur partenaire par le prénom de leurs ex",
"gorger": 4,
"distribution": false,
"recois": true
},
{
"id": 34,
"question": "Celles et ceux qui boit de la <variante> actuellement",
"gorger": 3,
"distribution": true,
"recois": true,
"variante": ["vodka", "rhum", "tequila", "whisky"]
},
{
"id": 35,
"question": "Les joueurs qui ont un <variante> dans leurs prénom",
"gorger": 3,
"distribution": false,
"recois": true,
"variante": ["a","e","i","o","u","y"]
},
{
"id": 36,
"question": "Le/La joueur/euse avec le plus gros cul",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 37,
"question": "Celles/Ceux qui ont moins de <variante> ans",
"gorger": 3,
"distribution": false,
"recois": true,
"variante": ["21","22","23","24","25","26"]
},
{
"id": 38,
"question": "Celui/celle avec le plus gros appetit sexuel",
"gorger": 3,
"distribution": false,
"recois": true,
"caliente": true
},
{
"id": 39,
"question": "Ceux/Celles qui fumes (VapeNation compris)",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 40,
"question": "Celles et ceux qui ont au moins un BAC +<variante>",
"gorger": 1,
"distribution": true,
"recois": true,
"variante": [0,1,2,3,4,5]
},
{
"id": 41,
"question": "Le premier joueur à se lever",
"doubledistribution": true,
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 42,
"question": "Ceux qui n'ont jamais eu l'occasion de faire un strip tease",
"gorger": 3,
"distribution": false,
"recois": true,
"caliente": true
},
{
"id": 43,
"question": "Le premier joueur à enlever un vêtements",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 44,
"question": "Tous ceux qui ont déjà uriné dans une piscine ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 30,
"question": "Celui/Celle avec le plus de follow sur <variante>",
"gorger": 3,
"distribution": true,
"recois": true,
"variante": ["instagram","facebook","tik-tok"]
},
{
"id": 31,
"question": "Celui/Celle avec le nom de famille le plus compliqué",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 32,
"question": "Les joueurs qui n'ont pas encore distribué de gorgées",
"gorger": 3,
"distribution": false,
"recois": true
}, {
"id": 33,
"question": "Le premier joueur à donner l'heure",
"doubledistribution": true,
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 34,
"question": "Celles et ceux qui ont déjà dépenser plus de 2000 euros en un achat",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 35,
"question": "La personne la moins courageuse",
"gorger": 1,
"distribution": false,
"recois": true
},
{
"id": 36,
"question": "Celles/Ceux qui rentre chez eux à la fin de la soirée",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 37,
"question": "Celles et ceux dont le jour d'anniversaire est un nombre <variante>",
"gorger": 3,
"distribution": true,
"recois": true,
"variante": ["impaire","paire"]
},
{
"id": 38,
"question": "Si tu as un téléphone qui a un prix supperieur d'achat a 1000Euros, tu est riche donc en tant que personne généreuse",
"gorger": 3,
"distribution": true,
"recois": false
},
{
"id": 39,
"question": "Tous ceux qui ont fait plus de 100km pour venir ici ",
"gorger": 3,
"distribution": true,
"recois": false
},
{
"id": 40,
"jeux": true,
"question": "Le jeu du revolver: Chaque joueur a maintenant 7 balles, une balle correspondant à une gorgée. Les joueurs ont la capacité de tirer des balles à tout moment du jeu.",
"distribution": false,
"recois": false
},
{
"id": 41,
"question": "<J1>",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 42,
"jeux": true,
"question": "<J1> est le vieu/vieille briscard ! Interdiction de montrer tes dents pendant <manche> manches",
"manche": true,
"arret": "Tu peux arreter de cacher tes belles dents"
},
{
"id": 43,
"jeux": true,
"question": "<J1> et <J2> liser le premier SMS qui s'affiche quand on tape <variante> dans la barre de recherche. le plus marrant",
"gorger": 3,
"variante": ["désolé","caca","bourré","mine","nazi"],
"distribution": true,
"recois": false
}, {
"id": 44,
"jeux": true,
"question": "A tour de role, vous avez exactement 3 secondes pour donner un mot en rapport avec le mots dit precedemment.<J1> tu commences en choissisant un mot. Le perdant",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 45,
"jeux": true,
"question": "Le jeu du PIM PAM POUM. Le premier qui perd ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 46,
"jeux": true,
"question": "<J1> defie <J2> au chifoumi ! Le perdant",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 47,
"jeux": true,
"question": "<J1> est dans le <variante> ! Tu dois parler au <variante> pendant <manches> manches ",
"variante": ["passé", "futur"],
"manche": true,
"arret": "Tu est revenu dans le present",
"distribution": false,
"recois": false,
"caliente": false
},
{
"id": 48,
"question": "<J1> tu bois autant de gorgées que tu as d'années d'études après le BAC"
},
{
"id": 49,
"jeux": true,
"question": "<J1> et <J2> ferment leurs yeux ! Ils/Elles doivent deviner la couleur des yeux de l'autre. ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 50,
"jeux": true,
"question": "<J1> est manchot ! Il/Elle ne peut plus utiliser ses doigts durant <manches> manches . Si il s'en sert, il/elle devra boire autant de gorgées qu'il/elle a utilisé de doigts",
"distribution": false,
"arret": "Tu n'es plus manchot",
"recois": false
},
{
"id": 51,
"jeux": true,
"question": "<J1> et <J2> , si vous êtes ensemble dans la vraie vie, vous pouvez distribuer 2 gorgées , autrement buvez-les"
},
{
"id": 52,
"jeux": true,
"question": "<J1> a la tourette ! A chaque fois que tu bois une gorgée, tu dois CRIER une insulte. C'est un stade avancé, ça dure <manches> manches",
"manches": true,
"arret": "Tu n'as plus tourette."
},
{
"id": 53,
"jeux": true,
"question": "<J1>, donne la couleur préférée de <J2> si tu te trompes",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 54,
"jeux": true,
"question": "<J1> à l'oeil de serpent ! Dès qu'un joueur te regarde dans les yeux, il/elle boit. Si tu es arrivé a faire boire personne avant <manches> manches, tu ",
"gorger": 4,
"distribution": false,
"recois": true
}, {
"id": 55,
"jeux": true,
"question": "<J1> et <J2> se mesurent ! Le/la plus <variante>",
"gorger": 3,
"variante": ["petit","grand"],
"distribution": true,
"recois": true
},
{
"id": 56,
"jeux": true,
"question": "<J1> doit terminer toutes ses phrases par - <variante> pendant <manches> manches",
"variante": ["C'est clair","han","quoicoubeh"]
},
{
"id": 57,
"jeux": true,
"question": "<J1> et <J2> se défient au 'je te tiens, tu me tiens', le premier qui rit sera dechiré, et ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 58,
"jeux": true,
"question": "<J1> et <J2> n'ont plus le droit d'utiliser leur téléphone pendant <manches> manches !",
"manches": "true"
},
{
"id": 59,
"jeux": true,
"question": "<J1> et <J2> racontent une anecdote, celui/celle qui sort la plus <variante> ",
"variante": ["banale","incroyable","marrante"],
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 60,
"jeux": true,
"question": "<J1>, Si on te dit Marco? ... Si tu as dis Polo ",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 61,
"jeux": true,
"question": "<J1> est l'aigris pendant <manches> manches ! Dès que tu souris ou rigoles,",
"gorger": 1,
"manches": true,
"distribution": false,
"arret": "Tu n'es plus aigris!",
"recois": true
},
{
"id": 62,
"jeux": true,
"question": "<J1> fait un geste, le suivant répète et en ajoute un. Le perdant ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 63,
"question": "<J1>, <J2> et <J3> vont désigner quelqu'un qui doit terminer son verre",
"jeux": true
},
{
"id": 64,
"question": "Récitez l'alphabet en énonçant une lettre à tour de rôle. Si <J1> finit son verre avant, cul sec pour tout le monde !",
"jeux": true
},
{
"id": 65,
"question": "Si <J1> arrive a finir son verre en moins de 5 secondes, il/elle ",
"gorger": 6,
"distribution": true,
"recois": false,
"jeux": true
},
{
"id": 66,
"jeux": true,
"question": "<J1> et <J2> sont lies, si l'un boit alors l'autre aussi, et ce pendant <manches> manches",
"manches": true
},
{
"id": 67,
"question": "<J1> dit un mot, la personne suivante le répète et en ajoute un nouveau, ainsi de suite jusqu'a ce que quelqu'un se trompe. Le perdant boit autant de gorgées qu'il y a eu de personne avant lui",
"jeux": true
},
{
"id": 68,
"question": "<J1> doit choisir un mot que tout le monde devra dire à chaque fois qu'une personne boit. Pendant <manches> manches",
"jeux": false,
"manches": true,
"arret": "Plus besoin de dire le mots avant de boire"
},
{
"id": 69,
"question": "Quand l'heure affichera un multiple de 10 (22h, 22h10 ...) le premier a crier 'merde j'ai oublié mon chat'",
"gorger": 3,
"distribut":false,
"manches": true,
"arret": "Vous avez retrouver le chat!"
},
{
"id": 70,
"question": "Plutôt ne plus avoir de mains ou de jambes? les perdants ",
"gorger": 3,
"jeux": false,
"distribution": false,
"recois": true
},
{
"id": 71,
"question": "Vive la poésie ! Nos phrases doivent rimer sous peine d'une gorgée pendant <manches> manches",
"manches": true,
"arret": "Vous ne devez plus faire de rime."
},
{
"id": 72,
"question": "Choisissez le joueur le <variante> drôle d'entre vous, ce dernier ",
"variante": ["moins", "plus"],
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 73,
"question": "Les <variante>",
"variante": ["filles","garçons","couples","celibataires"],
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 74,
"jeux": true,
"question": "Plutôt avoir un tapis volant, ou un frigo qui se remplit tout seul ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true,
"manches": false
},
{
"id": 75,
"question": "Plutôt avoir du temps ou de l'argent ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 76,
"question": "Le premier joueur qui en embrasse un autre sur la bouche",
"gorger": 5,
"distribution": true,
"recois": false,
"caliente": true
},
{
"id": 77,
"question": "Plutôt série ou film ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 78,
"question": "Plutôt jeux-videos ou livre ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 79,
"question": "Plutôt anime ou jeux-videos ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 80,
"question": "Elisez le plus <variante> d'entre vous, ce dernier ",
"variante": ["con", "intelligent", "beau", "gentil","dragueur","timide"],
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 81,
"question": "Le premier qui donne un film de <variante> ",
"gorger": 3,
"distribution": true,
"recois": false,
"variante": ["Christopher Nolan","James Cameron","Tim Burton","Quentin tarantino","Steven Spielberg"]
},
{
"id": 82,
"question": "Le premier qui donne un film avec ",
"variante": ["Christian Clavier","Morgan freeman","Brad Pitt", "Jean Reno","Marion Cotillard"],
"gorger": 3,
"distribution": true,
"recois": false
},
{
"id": 83,
"question": "La première personne qui désigne le/la plus <variante> ",
"gorger": 3,
"distribution": true,
"recois": false,
"variante": ["jeune", "vieille"]
},
{
"id": 84,
"question": "Plutôt avoir des connaissances illimitées ou diriger le monde ? Votez tous en même temps. La minorité",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 85,
"question": "Plutôt n'avoir aucun ami ou ne plus pouvoir utiliser d'appareil électronique ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 86,
"question": "Plutot vaincre le patrikaka ou la polution dans le monde? Votez tous en meme temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 87,
"question": "Jeu du LUTIN : Pendant <manches> manches. Vous devez enlever le lutin de votre verre pour pouvoir boire et le remettre ensuite sinon vous devait reboire",
"gorger": 3,
"distribution": false,
"recois": false,
"manches": true,
"arret": "Le Lutin est parti. Vous pouvez boire normalement"
},
{
"id": 88,
"question": "Le premier joueur à ramener un objet <variante> (pas de vêtements) ",
"gorger": 3,
"distribution": true,
"variante": ["rouge","vert","bleu","jaune"],
"recois": false,
"manches": false
},
{
"id": 89,
"question": "Le premier joueur qui dévoile un de ses secrets et que personne ne sait ",
"gorger": 3,
"distribution": true,
"recois": false
},
{
"id": 90,
"question": "Jeu des peaux! Triez vous du joueur le plus bronzé au joueur le moins bronzé. Le plus bronzé prend 1 gorgée, le second 2 gorgées, etc.",
"gorger": 3,
"distribution": true,
"recois": true
},
{
"id": 91,
"question": "Plutôt avoir du pouvoir ou de la connaissance ? Votez tous en même temps. La minorité ",
"gorger": 3,
"distribution": false,
"recois": true
},
{
"id": 92,
"question": "Il est désormais interdit de se tutoyer pendant <manches> manches",
"manches": true,
"arret":"Vous pouvez vous tutoyer"
},
{
"id": 93,
"question": "Vaccin contre le COVID19 : Le DR Raoul à dit que boire un cul sec avait les mêmes effets que le vaccin. Tout le monde bois sont verre cul sec"
},
{
"id": 94,
"question": "Faites un concours de clash : Rap contenders entre <J1> et <J2> le perdant ",
"gorger": 3,
"distribution": false,
"recois": true
}
]
}
@@ -1,85 +0,0 @@
package com.example.boidelov3;
//public class ChatGPTTask extends AsyncTask<Void, Void, String> {
//// private Jeux jeuxActivity;
//// private String keyOpenai;
////
//// public ChatGPTTask(Jeux jeuxActivity, String keyOpenai) {
//// this.jeuxActivity = jeuxActivity;
//// this.keyOpenai = keyOpenai;
//// }
////
////
//// @Override
//// protected String doInBackground(Void... voids) {
//// String url = "https://api.openai.com/v1/chat/completions";
//// String apiKey = keyOpenai;
//// System.out.println("apiKey de ChatGPTTASK.java: " + apiKey);
//// String model = "gpt-3.5-turbo";
////
//// String prompt = "Tu es une IA française qui génère des questions ainsi que la categories de la question. Voici des exemples :" +
//// "Celles/Ceux qui ont habité dans plus de 3 villes diferentes';'La vie" +
//// "Ceux qui ont dansé aujourd'hui' ; 'Soirée'" +
//// "'Pour se décoincer, le/la plus timide' ; 'Caractère'" +
//// "'Celles et ceux qui ont déjà dépenser plus de 2000 euros en un achat' ; 'Dépense'" +
//// "'Le/La plus radin(e)' ; 'Caractère'";
//
//// try {
//// URL obj = new URL(url);
//// HttpURLConnection connection = (HttpURLConnection) obj.openConnection();
//// connection.setRequestMethod("POST");
//// connection.setRequestProperty("Authorization", "Bearer " + apiKey);
//// connection.setRequestProperty("Content-Type", "application/json");
////
//// // The request body
//// String body = "{\"model\": \"" + model + "\", \"messages\": [{\"role\": \"user\", \"content\": \"" + prompt + "\"}]}";
//// System.out.println("body: " + body);
//// connection.setDoOutput(true);
//// OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
//// writer.write(body);
//// writer.flush();
//// writer.close();
////
//// // Response from ChatGPT
//// BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
//// String line;
////
//// StringBuffer response = new StringBuffer();
////
//// while ((line = br.readLine()) != null) {
//// response.append(line);
//// }
//// br.close();
////
//// // calls the method to extract the message.
//// return extractMessageFromJSONResponse(response.toString());
////
//// } catch (IOException e) {
//// System.out.println("Il y a eu une erreur" + e);
//// throw new RuntimeException(e);
////
//// }
//// }
////
//// public String extractMessageFromJSONResponse(String response) {
//// int start = response.indexOf("content") + 11;
//// int end = response.indexOf("\"", start);
//// String extractedMessage = response.substring(start, end);
//// System.out.println("extractedMessage: " + extractedMessage);
//// return extractedMessage;
//// }
////
//// @Override
//// protected void onPostExecute(String result) {
//// if (result != null) {
//// // Handle the extracted message here
//// jeuxActivity.handleExtractedMessage(result);
//// } else {
//// Toast.makeText(jeuxActivity.getApplicationContext(), "Échec de la communication avec l'API !", Toast.LENGTH_SHORT).show();
//// jeuxActivity.navigateToJeuxParametres();
//// }
//// }
//
//
// return url;
// }}
File diff suppressed because it is too large Load Diff
@@ -1,480 +0,0 @@
package com.example.boidelov3;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.CompoundButton;
import com.google.android.material.switchmaterial.SwitchMaterial;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.boidelov3.utils.ErrorHandler;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class JeuxParametres extends AppCompatActivity {
private SeekBar seekBar1, seekBar2, seekBar3, seekBarDuration;
private TextView textView1, textView2, textView5, textViewRatioGen, questionCountValue, gorgeesValue, durationValue;
private SwitchMaterial checkBoxGPT;
private Button buttonTestApi;
private EditText editText, editTextKeyGPT;
private AutoCompleteTextView autoCompleteProvider;
private String keyGPT;
private OpenAIService.AIProvider selectedProvider = OpenAIService.AIProvider.OPENAI;
private int nbQuestions;
private List<String> toutlesjoueurs;
@Override
protected void onCreate(Bundle savedInstanceState) {
toutlesjoueurs = getIntent().getStringArrayListExtra("EXTRA_LIST_JOUEUR");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jeux_parametres);
// Initialisation des vues
seekBar1 = findViewById(R.id.seekBar1);
seekBar2 = findViewById(R.id.seekBar2);
seekBar3 = findViewById(R.id.seekBar3);
seekBarDuration = findViewById(R.id.seekBarDuration);
textView1 = findViewById(R.id.textView1);
textView2 = findViewById(R.id.textView2);
textView5 = findViewById(R.id.textView5);
editTextKeyGPT = findViewById(R.id.editTextGPT);
autoCompleteProvider = findViewById(R.id.autoCompleteProvider);
buttonTestApi = findViewById(R.id.ButtonTestApi);
textViewRatioGen = findViewById(R.id.textViewRatioGen);
questionCountValue = findViewById(R.id.questionCountValue);
gorgeesValue = findViewById(R.id.gorgeesValue);
durationValue = findViewById(R.id.durationValue);
// Configuration du dropdown pour le provider IA
String[] providers = new String[]{
OpenAIService.AIProvider.OPENAI.getDisplayName(),
OpenAIService.AIProvider.OPENROUTER.getDisplayName(),
OpenAIService.AIProvider.ZAI.getDisplayName()
};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, providers);
autoCompleteProvider.setAdapter(adapter);
// Charger le provider sauvegardé
SharedPreferences providerPrefs = getSharedPreferences("MyPrefs", MODE_PRIVATE);
String savedProvider = providerPrefs.getString("aiProvider", OpenAIService.AIProvider.OPENAI.getDisplayName());
autoCompleteProvider.setText(savedProvider, false);
// Définir le provider sélectionné
if (savedProvider.equals(OpenAIService.AIProvider.OPENROUTER.getDisplayName())) {
selectedProvider = OpenAIService.AIProvider.OPENROUTER;
} else if (savedProvider.equals(OpenAIService.AIProvider.ZAI.getDisplayName())) {
selectedProvider = OpenAIService.AIProvider.ZAI;
} else {
selectedProvider = OpenAIService.AIProvider.OPENAI;
}
// Listener pour le changement de provider
autoCompleteProvider.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String selected = (String) parent.getItemAtPosition(position);
SharedPreferences.Editor editor = providerPrefs.edit();
editor.putString("aiProvider", selected);
editor.apply();
if (selected.equals(OpenAIService.AIProvider.OPENROUTER.getDisplayName())) {
selectedProvider = OpenAIService.AIProvider.OPENROUTER;
} else if (selected.equals(OpenAIService.AIProvider.ZAI.getDisplayName())) {
selectedProvider = OpenAIService.AIProvider.ZAI;
} else {
selectedProvider = OpenAIService.AIProvider.OPENAI;
}
}
});
// Initialiser les TextView avec les valeurs par défaut
int initialQuestions = 50;
int initialGorgees = 0;
int initialRatio = 8;
int initialDuration = 0; // 0 pour avoir 4-10 tours par défaut (MIN_DEFI_ROUNDS=4)
questionCountValue.setText(String.valueOf(initialQuestions));
gorgeesValue.setText(String.valueOf(initialGorgees));
durationValue.setText("0"); // Afficher 0 par défaut pour avoir 4-10 tours
textView5.setText("Palier : Grosse merde");
textViewRatioGen.setText("Ratio BDD/OPENAI : 1/" + initialRatio);
// Configuration de la seekBar1
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
seekBar1.setMin(20);
}
seekBar1.setMax(150);
seekBar1.setProgress(50);
// Configuration de la seekBar2
seekBar2.setMax(20);
seekBar2.setProgress(0);
// Configuration de la seekBar3
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
seekBar2.setMin(0);
seekBar3.setMin(1);
}
seekBar3.setMax(15);
seekBar3.setProgress(8);
// Configuration de la seekBarDuration (permet valeurs négatives pour offset)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
seekBarDuration.setMin(-5); // Permet un offset négatif jusqu'à -5
}
seekBarDuration.setMax(15);
seekBarDuration.setProgress(0); // Valeur par défaut à 0 pour avoir 4-10 tours (MIN_DEFI_ROUNDS=4)
// Configuration des listeners pour les seekBars
seekBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
// Ajustement de la valeur au multiple de 10 le plus proche
int adjustedProgress = Math.round(progress / 10) * 10;
seekBar.setProgress(adjustedProgress);
questionCountValue.setText(String.valueOf(adjustedProgress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
// Mise à jour du gorgeesValue en fonction de la valeur de la seekBar2
gorgeesValue.setText(String.valueOf(progress));
// Mise à jour du textView5 en fonction de la valeur de la seekBar2
switch (progress) {
case 0:
textView5.setText("Palier : Grosse merde");
break;
case 2:
textView5.setText("Palier : Petite merde");
break;
case 4:
textView5.setText("Palier : Petit joueur");
break;
case 6:
textView5.setText("Palier : Un p'tit verre ?!");
break;
case 8:
textView5.setText("Palier : ça commence à aller");
break;
case 10:
textView5.setText("Palier : Alcoolique");
break;
case 12:
textView5.setText("Palier : COMA ETHYLIX");
break;
case 13:
textView5.setText("Palier : APÉROOOOO !!");
break;
case 14:
textView5.setText("Palier : LA J'SUIS BIENG");
break;
case 15:
textView5.setText("Palier : J'VOIS PLUS RIENG");
break;
case 17:
textView5.setText("Palier : J'AI PLUS DE VERRES");
break;
case 18 :
textView5.setText("Palier : Soirée Murge");
break;
case 19:
textView5.setText("Palier : Soirée Pétée");
break;
case 20:
textView5.setText("Palier : L'ENDER DRAGON");
break;
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
// Configuration du checkBox // Q : IL sert à quoi ?
// R : Il sert à activer/désactiver les vues en dessous
Button buttonTestApi = findViewById(R.id.ButtonTestApi);
checkBoxGPT = findViewById(R.id.checkBoxGPT);
checkBoxGPT.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// Activation/désactivation des vues en fonction de l'état du checkBox
autoCompleteProvider.setEnabled(isChecked);
// Pour le champ API key : on garde le layout activé pour le toggle password,
// mais on désactive l'édition du texte
editTextKeyGPT.setFocusable(isChecked);
editTextKeyGPT.setFocusableInTouchMode(isChecked);
editTextKeyGPT.setClickable(isChecked);
editTextKeyGPT.setCursorVisible(isChecked);
if (!isChecked) {
editTextKeyGPT.clearFocus();
}
textViewRatioGen.setEnabled(isChecked);
seekBar3.setEnabled(isChecked);
buttonTestApi.setEnabled(isChecked);
}
});
// Configuration de la seekBar3
seekBar3.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar3, int progress, boolean fromUser) {
textViewRatioGen.setText("Ratio BDD/OPENAI : 1/" + progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar3) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar3) {
}
});
// Configuration de la seekBarDuration
seekBarDuration.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
// Afficher avec signe +/- pour bien voir l'offset, mais sans signe pour 0
String displayValue;
if (progress > 0) {
displayValue = "+" + progress;
} else {
displayValue = String.valueOf(progress); // Affiche "0" ou "-X"
}
durationValue.setText(displayValue);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
// Partie OpenAI : enregistrement de la clé en dur.
// Récupérer une instance des SharedPreferences
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", MODE_PRIVATE);
final SharedPreferences.Editor editor = sharedPreferences.edit();
// Récupérer l'EditText
final EditText editText = findViewById(R.id.editTextGPT);
// Récupérer la valeur enregistrée dans les SharedPreferences
String apiKey = editText.getText().toString();
// Récupérer la valeur enregistrée dans les SharedPreferences
String savedText = sharedPreferences.getString("savedText", "");
editText.setText(savedText);
// Enregistrer le contenu de l'EditText lorsque l'utilisateur modifie le texte
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// Enregistrer le texte dans les SharedPreferences
editor.putString("savedText", editText.getText().toString());
editor.apply();
}
});
}
public void onClickButtonTestAPI(View view) {
String apiKey = editTextKeyGPT.getText().toString();
if (apiKey == null || apiKey.isEmpty()) {
Toast.makeText(this, "Veuillez entrer une clé API", Toast.LENGTH_SHORT).show();
return;
}
// Créer un client OkHttpClient pour effectuer la requête
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(10, java.util.concurrent.TimeUnit.SECONDS)
.readTimeout(10, java.util.concurrent.TimeUnit.SECONDS)
.build();
// Déterminer l'URL, le modèle et le format selon le provider sélectionné
String testUrl;
String testModel;
String jsonBody;
boolean isAnthropicFormat = (selectedProvider == OpenAIService.AIProvider.ZAI);
switch (selectedProvider) {
case OPENROUTER:
testUrl = "https://openrouter.ai/api/v1/chat/completions";
testModel = "openai/gpt-3.5-turbo";
// Format OpenAI
jsonBody = "{\"model\":\"" + testModel + "\",\"messages\":[{\"role\":\"user\",\"content\":\"Test\"}],\"max_tokens\":5}";
break;
case ZAI:
testUrl = "https://api.z.ai/v1/messages";
testModel = "claude-3-5-sonnet";
// Format Anthropic
jsonBody = "{\"model\":\"" + testModel + "\",\"messages\":[{\"role\":\"user\",\"content\":\"Test\"}],\"max_tokens\":5}";
break;
case OPENAI:
default:
testUrl = "https://api.openai.com/v1/chat/completions";
testModel = "gpt-3.5-turbo";
jsonBody = "{\"model\":\"" + testModel + "\",\"messages\":[{\"role\":\"user\",\"content\":\"Test\"}],\"max_tokens\":5}";
break;
}
// Construire la requête
Request.Builder requestBuilder = new Request.Builder()
.url(testUrl)
.addHeader("Content-Type", "application/json");
// Ajouter les headers selon le provider
switch (selectedProvider) {
case OPENAI:
case OPENROUTER:
requestBuilder.addHeader("Authorization", "Bearer " + apiKey);
break;
case ZAI:
requestBuilder.addHeader("x-api-key", apiKey);
requestBuilder.addHeader("anthropic-version", "2023-06-01");
break;
}
// Headers spécifiques pour OpenRouter
if (selectedProvider == OpenAIService.AIProvider.OPENROUTER) {
requestBuilder.addHeader("HTTP-Referer", "https://boidelo.app");
requestBuilder.addHeader("X-Title", "Boidelo");
}
Request request = requestBuilder
.post(okhttp3.RequestBody.create(jsonBody, okhttp3.MediaType.get("application/json")))
.build();
// Exécuter la requête de test
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(@NonNull Call call, IOException e) {
String operation = "Test de connexion API " + selectedProvider.getDisplayName();
String details = "Échec de connexion lors du test de l'API";
ErrorHandler.logErrorOnly("JeuxParametres", operation + " - " + details, e);
runOnUiThread(() -> {
String userMessage = "Échec de connexion " + selectedProvider.getDisplayName() + " : " + e.getMessage();
Toast.makeText(getApplicationContext(), userMessage, Toast.LENGTH_SHORT).show();
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()) {
runOnUiThread(() -> {
Toast.makeText(getApplicationContext(),
"Connexion " + selectedProvider.getDisplayName() + " réussie !",
Toast.LENGTH_SHORT).show();
});
} else {
runOnUiThread(() -> {
Toast.makeText(getApplicationContext(),
"Erreur " + selectedProvider.getDisplayName() + " (HTTP " + response.code() + ")",
Toast.LENGTH_SHORT).show();
});
}
response.close();
}
});
}
public void onClickButtonStart(View view) {
// Récupérer les paramètres de la partie
int nombreQuestions = seekBar1.getProgress();
int ajoutGorgees = seekBar2.getProgress();
int ratioBddOpenAI = seekBar3.getProgress();
int durationDefis = seekBarDuration.getProgress();
boolean openAI = checkBoxGPT.isChecked();
toutlesjoueurs = getIntent().getStringArrayListExtra("EXTRA_LIST_JOUEUR");
// Récupérer les joueurs (vous devrez définir comment vous les récupérez)
SharedPreferences sharedPreferences = getSharedPreferences("Joueurs", Context.MODE_PRIVATE);
ArrayList<String> joueurs = new ArrayList<>();
for (int i = 1; i <= 3; i++) {
String joueur = sharedPreferences.getString("J" + i, "");
if (!joueur.isEmpty()) {
joueurs.add(joueur);
}
}
// Récupérer les joueurs supplémentaires en utilisant une boucle
int i = 4;
String nomJoueur = sharedPreferences.getString("J" + i, "");
while (!nomJoueur.isEmpty()) {
joueurs.add(nomJoueur);
i++;
nomJoueur = sharedPreferences.getString("J" + i, "");
}
// Créer une instance de la classe Jeux avec les paramètres récupérés
Jeux jeux = new Jeux();
// Lancer l'activité Jeux avec les paramètres
Intent intent = new Intent(this, Jeux.class);
intent.putExtra("EXTRA_NOMBRE_QUESTIONS", nombreQuestions);
intent.putExtra("EXTRA_AJOUT_GORGEE", ajoutGorgees);
intent.putExtra("EXTRA_RATIO_OPENAI", ratioBddOpenAI);
intent.putExtra("EXTRA_DURATION_DEFIS", durationDefis);
intent.putExtra("EXTRA_OPENAI", openAI);
final EditText editText = findViewById(R.id.editTextGPT);
intent.putExtra("EXTRA_KEY_OPENAI", editText.getText().toString());
intent.putExtra("EXTRA_AI_PROVIDER", selectedProvider.name());
toutlesjoueurs = getIntent().getStringArrayListExtra("EXTRA_LIST_JOUEUR");
intent.putStringArrayListExtra("EXTRA_LIST_JOUEUR", (ArrayList<String>) toutlesjoueurs);
startActivity(intent);
}
}
@@ -1,339 +0,0 @@
package com.example.boidelov3;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputEditText;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
String J1S, J2S, J3S;
private int offset;
private List<String> toutlesjoueurs;
private TextInputEditText J1;
private TextInputEditText J2;
private TextInputEditText J3;
private List<TextInputEditText> editTextList = new ArrayList<>();
private List<View> playerRowList = new ArrayList<>(); // Liste des lignes de joueurs pour suppression
private TextView playerCountText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Récupérer le TextView du compteur
playerCountText = findViewById(R.id.playerCountText);
// Initialiser les 3 champs statiques et ajouter les listeners
J1 = findViewById(R.id.J1);
J2 = findViewById(R.id.J2);
J3 = findViewById(R.id.J3);
// Ajouter un TextWatcher à chaque champ pour mettre à jour le compteur
TextWatcher playerCountWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
updatePlayerCount();
}
@Override
public void afterTextChanged(Editable s) {}
};
if (J1 != null) J1.addTextChangedListener(playerCountWatcher);
if (J2 != null) J2.addTextChangedListener(playerCountWatcher);
if (J3 != null) J3.addTextChangedListener(playerCountWatcher);
// Mise à jour initiale
updatePlayerCount();
}
/**
* Met à jour le compteur de joueurs en temps réel
*/
private void updatePlayerCount() {
int count = 0;
if (J1 != null && J1.getText() != null && !J1.getText().toString().isEmpty()) count++;
if (J2 != null && J2.getText() != null && !J2.getText().toString().isEmpty()) count++;
if (J3 != null && J3.getText() != null && !J3.getText().toString().isEmpty()) count++;
// Compter les champs dynamiques
for (TextInputEditText edit : editTextList) {
if (edit != null && edit.getText() != null && !edit.getText().toString().isEmpty()) {
count++;
}
}
if (playerCountText != null) {
playerCountText.setText("Joueurs: " + count + " / min. 3");
}
}
public void onClickButton1(View view) {
LinearLayout nameEntryLayout = findViewById(R.id.nameEntryLayout);
// Créer un conteneur pour la ligne de joueur (EditText + Bouton supprimer)
FrameLayout playerRow = new FrameLayout(this);
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
rowParams.setMargins(0, 0, 0, 12); // Marge identique aux champs statiques (12dp)
playerRow.setLayoutParams(rowParams);
// Créer un nouveau TextInputLayout
com.google.android.material.textfield.TextInputLayout textInputLayout = new com.google.android.material.textfield.TextInputLayout(this);
FrameLayout.LayoutParams textInputParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
// Plus d'espace pour le bouton poubelle (68dp au lieu de 52dp)
textInputParams.setMargins(0, 0, 68, 0);
textInputLayout.setLayoutParams(textInputParams);
textInputLayout.setBoxBackgroundMode(com.google.android.material.textfield.TextInputLayout.BOX_BACKGROUND_OUTLINE);
textInputLayout.setHint("Nom");
// Appliquer exactement les mêmes styles que le XML
// Créer un ColorStateList pour la bordure : grise par défaut, primaire quand focus
int[][] states = new int[][] {
new int[] { android.R.attr.state_focused},
new int[] {}
};
int[] colors = new int[] {
androidx.core.content.ContextCompat.getColor(this, R.color.primary),
androidx.core.content.ContextCompat.getColor(this, android.R.color.darker_gray) // Bordure grise par défaut
};
android.content.res.ColorStateList strokeColorStateList = new android.content.res.ColorStateList(states, colors);
textInputLayout.setBoxStrokeColorStateList(strokeColorStateList);
textInputLayout.setBoxStrokeWidth(2); // Largeur de bordure comme dans le XML
textInputLayout.setBoxBackgroundColor(androidx.core.content.ContextCompat.getColor(this, R.color.surface));
textInputLayout.setDefaultHintTextColor(androidx.core.content.ContextCompat.getColorStateList(this, R.color.text_hint));
textInputLayout.setEndIconMode(com.google.android.material.textfield.TextInputLayout.END_ICON_CLEAR_TEXT);
// Créer un nouveau TextInputEditText
TextInputEditText newEditText = new TextInputEditText(this);
newEditText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
newEditText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
newEditText.setMaxLines(1);
newEditText.setTextSize(16);
newEditText.setTextColor(androidx.core.content.ContextCompat.getColor(this, R.color.text_primary));
newEditText.setHintTextColor(androidx.core.content.ContextCompat.getColor(this, R.color.text_hint));
// Ajouter un TextWatcher pour mettre à jour le compteur en temps réel
newEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
updatePlayerCount();
}
@Override
public void afterTextChanged(Editable s) {}
});
// Ajouter l'EditText au TextInputLayout
textInputLayout.addView(newEditText);
// Créer le bouton de suppression - style élégant avec fond circulaire
ImageButton deleteButton = new ImageButton(this);
int dp40 = (int) (40 * getResources().getDisplayMetrics().density);
FrameLayout.LayoutParams buttonParams = new FrameLayout.LayoutParams(dp40, dp40);
buttonParams.setMargins(0, 0, 8, 0);
buttonParams.gravity = android.view.Gravity.END | android.view.Gravity.CENTER_VERTICAL;
deleteButton.setLayoutParams(buttonParams);
// Utiliser l'icône de poubelle Material (ic_menu_delete est une croix)
deleteButton.setImageResource(android.R.drawable.ic_menu_delete);
deleteButton.setColorFilter(androidx.core.content.ContextCompat.getColor(this, R.color.text_secondary));
deleteButton.setScaleType(ImageButton.ScaleType.CENTER_INSIDE);
// Fond circulaire blanc avec bordure fine
deleteButton.setBackgroundColor(androidx.core.content.ContextCompat.getColor(this, R.color.white));
deleteButton.setPadding(8, 8, 8, 8);
// Arrondir le bouton en cercle via un OutlineProvider
deleteButton.setOutlineProvider(new android.view.ViewOutlineProvider() {
@Override
public void getOutline(android.view.View view, android.graphics.Outline outline) {
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
});
deleteButton.setClipToOutline(true);
deleteButton.setContentDescription("Supprimer ce joueur");
// Configuration du bouton de suppression avec animation
deleteButton.setOnClickListener(v -> removePlayerRow(playerRow, newEditText));
// Ajouter les éléments au conteneur
playerRow.addView(textInputLayout);
playerRow.addView(deleteButton);
// Ajouter à la liste et au layout avec animation
editTextList.add(newEditText);
playerRowList.add(playerRow);
nameEntryLayout.addView(playerRow);
// Animation d'apparition
BoideloAnimationUtils.popIn(playerRow, 300);
BoideloAnimationUtils.triggerHapticFeedback(this);
}
/**
* Supprime une ligne de joueur avec animation
*/
private void removePlayerRow(View playerRow, TextInputEditText editText) {
BoideloAnimationUtils.triggerHapticFeedback(this);
// Animation de suppression
BoideloAnimationUtils.slideOutToRemove(playerRow, 300, () -> {
// Retirer de la liste et du layout après l'animation
editTextList.remove(editText);
playerRowList.remove(playerRow);
ViewGroup parent = (ViewGroup) playerRow.getParent();
if (parent != null) {
parent.removeView(playerRow);
}
// Mettre à jour le compteur après suppression
updatePlayerCount();
});
}
public void onClickButtonStart(View view) {
// Récupérer les 3 premiers champs de saisie
J1 = findViewById(R.id.J1);
if (J1 != null && J1.getText() != null) {
J1S = J1.getText().toString();
} else {
J1S = "";
}
J2 = findViewById(R.id.J2);
if (J2 != null && J2.getText() != null) {
J2S = J2.getText().toString();
} else {
J2S = "";
}
J3 = findViewById(R.id.J3);
if (J3 != null && J3.getText() != null) {
J3S = J3.getText().toString();
} else {
J3S = "";
}
// Creation d'une liste avec tt les j et verif si elle est completé
toutlesjoueurs = new ArrayList<>();
if (!J1S.isEmpty()) {
toutlesjoueurs.add(J1S);
}
if (!J2S.isEmpty()) {
toutlesjoueurs.add(J2S);
}
if (!J3S.isEmpty()) {
toutlesjoueurs.add(J3S);
}
// Ajouter les champs dynamiques
int nbnom = editTextList.size();
for (int i = 0; i < nbnom; i++) {
TextInputEditText editText = editTextList.get(i);
if (editText != null && editText.getText() != null) {
String nom = editText.getText().toString();
if (!nom.isEmpty()) {
toutlesjoueurs.add(nom);
}
}
}
openParametres();
}
public void openParametres(){
// Vérifier s'il y a des noms en double (insensible à la casse)
List<String> nomsNormauxes = new ArrayList<>();
for (String nom : toutlesjoueurs) {
String nomNormalise = nom.trim().toLowerCase();
if (nomsNormauxes.contains(nomNormalise)) {
// Nom en double détecté
Context context = getApplicationContext();
CharSequence text = "Erreur : Le nom \"" + nom + "\" est utilisé plusieurs fois. Chaque joueur doit avoir un nom unique.";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
return; // Ne pas continuer
}
nomsNormauxes.add(nomNormalise);
}
//enregistrement des joueurs dans les shared preferences Joueurs
SharedPreferences sharedPreferences = getSharedPreferences("Joueurs", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("J1", J1S != null ? J1S : "");
editor.putString("J2", J2S != null ? J2S : "");
editor.putString("J3", J3S != null ? J3S : "");
for (int i = 0; i < editTextList.size(); i++) {
TextInputEditText editText = editTextList.get(i);
if (editText != null && editText.getText() != null) {
String nom = editText.getText().toString();
editor.putString("J" + (i + 4), nom);
}
}
editor.apply();
//Lancement de l'activité (Jeux_parametres)
Intent intent = new Intent(this, JeuxParametres.class);
//Regarde si le pseudo est vide et envoie à l'activité jeux
if (toutlesjoueurs.isEmpty()){
Context context = getApplicationContext();
CharSequence text = "Merci de rentrer des joueurs";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
else {
if (toutlesjoueurs.size() >= 3) {
intent.putStringArrayListExtra("EXTRA_LIST_JOUEUR", (ArrayList<String>) toutlesjoueurs);
intent.putExtra("EXTRA_OFFSET", offset);
startActivity(intent);
} else {
Context context = getApplicationContext();
CharSequence text = "La partie ne peut pas commencer avec moins de 3 joueurs";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}
}
}
-187
View File
@@ -1,187 +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"
android:id="@+id/rootLayout"
android:fitsSystemWindows="true"
tools:context=".Jeux">
<!-- Progress Bar -->
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:max="100"
android:progress="0"
android:progressTint="@color/accent"
android:progressBackgroundTint="@color/surface_variant"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- Progress Text -->
<TextView
android:id="@+id/progressText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Question 1 / 50"
android:textColor="@color/text_secondary"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/progressBar" />
<!-- Question Type Indicator -->
<LinearLayout
android:id="@+id/questionIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/progressText">
<ImageView
android:id="@+id/indicatorIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/ic_player_one"
app:tint="@color/text_secondary" />
<TextView
android:id="@+id/indicatorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="1 joueur"
android:textColor="@color/text_secondary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<!-- Main Question Container -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/questionCard"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:cardBackgroundColor="@color/card_background"
app:cardCornerRadius="20dp"
app:cardElevation="8dp"
app:layout_constraintBottom_toTopOf="@id/buttonContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/questionIndicator">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="536dp"
android:gravity="center"
android:orientation="vertical"
android:padding="24dp">
<!-- Manche Question Text (petit) -->
<TextView
android:id="@+id/mancheCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/bg_card"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:text="Manches: 5"
android:textColor="@color/primary"
android:textSize="14sp"
android:textStyle="bold"
android:visibility="gone"
tools:visibility="visible"/>
<TextView
android:id="@+id/mancheQuestionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:gravity="center"
android:text="Défi en cours"
android:textColor="@color/text_secondary"
android:textSize="14sp"
android:textStyle="italic"
android:visibility="gone"/>
<!-- Question Text -->
<TextView
android:id="@+id/textView1"
style="@style/BoideloQuestionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Question"
android:textSize="26sp"/>
<!-- Manche Counter (if applicable) -->
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Button Container -->
<LinearLayout
android:id="@+id/buttonContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="32dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<!-- Skip Button -->
<!-- Next Button -->
<com.google.android.material.button.MaterialButton
android:id="@+id/skipButton"
style="@style/BoideloButton"
android:layout_width="229dp"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:onClick="onSkipClick"
android:text="Abandonner le défi"
android:textSize="12sp"
android:textColor="@color/error"
app:backgroundTint="@color/surface_variant"
app:cornerRadius="28dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/button"
style="@style/BoideloButton.Primary"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_weight="2"
android:onClick="OnClickButton1"
android:text="Suivant"
android:textSize="18sp"
app:cornerRadius="28dp"
app:icon="@android:drawable/ic_media_play"
app:iconGravity="textEnd"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,397 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
android:background="@color/surface"
tools:context=".JeuxParametres">
<!-- App Bar -->
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark"/>
<!-- Main Content -->
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Title -->
<TextView
android:id="@+id/Titre"
style="@style/BoideloTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="@string/param_tres_du_jeu" />
<!-- Game Settings Card -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="@color/card_background"
app:cardCornerRadius="16dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Number of Questions -->
<TextView
style="@style/BoideloSubtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Paramètres de partie"
app:drawableStartCompat="@android:drawable/ic_menu_edit"
app:drawableTint="@color/primary"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Nombre de questions"
android:textColor="@color/text_primary"
android:textSize="16sp"/>
<TextView
android:id="@+id/questionCountValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_card"
android:paddingStart="12dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingBottom="4dp"
android:text="50"
android:textColor="@color/primary"
android:textSize="14sp"
android:textStyle="bold"/>
</LinearLayout>
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressTint="@color/accent"
android:thumbTint="@color/accent"/>
</LinearLayout>
<!-- Drink Addition -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Ajout de gorgées"
android:textColor="@color/text_primary"
android:textSize="16sp"/>
<TextView
android:id="@+id/gorgeesValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_card"
android:paddingStart="12dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingBottom="4dp"
android:text="0"
android:textColor="@color/accent"
android:textSize="14sp"
android:textStyle="bold"/>
</LinearLayout>
<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressTint="@color/accent"
android:thumbTint="@color/accent"/>
<!-- Palier Indicator -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardBackgroundColor="@color/surface_variant"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="12dp"
android:text="Palier : Grosse merde"
android:textColor="@color/text_secondary"
android:textSize="14sp"
android:textStyle="bold"/>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<!-- Duration of Challenges -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewDuration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Durée des défis"
android:textColor="@color/text_primary"
android:textSize="16sp"/>
<TextView
android:id="@+id/durationValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_card"
android:paddingStart="12dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingBottom="4dp"
android:text="0"
android:textColor="@color/primary"
android:textSize="14sp"
android:textStyle="bold"/>
</LinearLayout>
<SeekBar
android:id="@+id/seekBarDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressTint="@color/accent"
android:thumbTint="@color/accent"/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- OpenAI Settings Card -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/openaiCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="@color/card_background"
app:cardCornerRadius="16dp"
app:cardElevation="4dp"
app:strokeColor="@color/surface_variant"
app:strokeWidth="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:src="@android:drawable/ic_menu_edit"
app:tint="@color/primary" />
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/openai"
android:textColor="@color/text_primary"
android:textSize="18sp"
android:textStyle="bold" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/checkBoxGPT"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Provider Selection -->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutProvider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:enabled="false"
android:hint="Fournisseur IA"
app:boxBackgroundColor="@color/surface"
app:boxStrokeColor="@color/primary"
app:hintTextColor="@color/text_hint"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/autoCompleteProvider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:text="OpenAI" />
</com.google.android.material.textfield.TextInputLayout>
<!-- API Key Input -->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutApiKey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Clé API"
app:boxBackgroundColor="@color/surface"
app:boxStrokeColor="@color/primary"
app:endIconMode="password_toggle"
app:hintTextColor="@color/text_hint"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextGPT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Ratio SeekBar -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewRatioGen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:enabled="false"
android:text="Ratio BDD/OPENAI : 1/8"
android:textColor="@color/text_primary"
android:textSize="14sp" />
</LinearLayout>
<SeekBar
android:id="@+id/seekBar3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:progressTint="@color/accent"
android:thumbTint="@color/accent" />
</LinearLayout>
<!-- Test API Button -->
<com.google.android.material.button.MaterialButton
android:id="@+id/ButtonTestApi"
style="@style/BoideloButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:onClick="onClickButtonTestAPI"
android:text="@string/test_de_connectivit_openai"
app:backgroundTint="@color/surface_variant"
app:icon="@android:drawable/ic_menu_info_details"
app:iconGravity="textStart" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Bottom Spacer -->
<View
android:layout_width="match_parent"
android:layout_height="80dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<!-- Floating Action Button -->
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/Go2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:onClick="onClickButtonStart"
android:text="@string/commencer_a_vous_mettre_une_mine"
android:textColor="@color/text_primary"
app:backgroundTint="@color/accent"
app:icon="@android:drawable/ic_media_play"
app:iconTint="@color/text_primary" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
-218
View File
@@ -1,218 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
android:background="@color/surface"
tools:context=".MainActivity">
<!-- App Bar -->
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark"/>
<!-- Main Content -->
<!-- Floating Action Button -->
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Title -->
<TextView
android:id="@+id/Titre"
style="@style/BoideloTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginBottom="16dp"
android:text="@string/bienvenue"/>
<!-- Player Count Indicator -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="@color/accent"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="12dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_player_three"
app:tint="@color/white"/>
<TextView
android:id="@+id/playerCountText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Joueurs: 0 / min. 3"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Players Input Card -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="16dp"
app:cardElevation="4dp"
app:strokeColor="@color/surface_variant"
app:strokeWidth="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/background"
android:padding="16dp">
<TextView
android:id="@+id/textView2"
style="@style/BoideloCaption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:gravity="center"
android:text="@string/laisse_vide_si_il_y_a_pas_assez_de_joueur"/>
<!-- Default Player Inputs -->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutJ1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:hint="@string/nom"
app:boxBackgroundColor="@color/surface"
app:boxStrokeColor="@color/primary"
app:boxStrokeWidth="2dp"
app:endIconMode="clear_text"
app:errorEnabled="false"
app:hintTextColor="@color/text_hint"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/J1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="16sp"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutJ2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:hint="@string/nom"
app:boxBackgroundColor="@color/surface"
app:boxStrokeColor="@color/primary"
app:boxStrokeWidth="2dp"
app:endIconMode="clear_text"
app:hintTextColor="@color/text_hint"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/J2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="16sp"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayoutJ3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:hint="@string/nom"
app:boxBackgroundColor="@color/surface"
app:boxStrokeColor="@color/primary"
app:boxStrokeWidth="2dp"
app:endIconMode="clear_text"
app:hintTextColor="@color/text_hint"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/J3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="16sp"/>
</com.google.android.material.textfield.TextInputLayout>
<!-- Dynamic Player Input Container -->
<LinearLayout
android:id="@+id/nameEntryLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
<!-- Add Player Button -->
<com.google.android.material.button.MaterialButton
android:id="@+id/Validation"
style="@style/BoideloButton.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:onClick="onClickButton1"
android:text="@string/c_ok"
app:icon="@android:drawable/ic_input_add"
app:iconGravity="textStart"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Bottom Spacer for FAB -->
<View
android:layout_width="match_parent"
android:layout_height="80dp"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/Go"
android:layout_width="172dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:onClick="onClickButtonStart"
android:text="@string/go"
android:textColor="@color/text_primary"
app:backgroundTint="@color/accent"
app:icon="@android:drawable/ic_media_play"
app:iconTint="@color/text_primary"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>