Ajout d'un controleur
This commit is contained in:
@@ -1,36 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="sae.chuzzle">
|
package="sae.chuzzle">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:label="Chuzzle"
|
android:label="Chuzzle"
|
||||||
android:theme="@android:style/Theme.Light.NoTitleBar">
|
android:theme="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
|
||||||
<!-- Point d'entrée : le menu principal -->
|
<!-- Point d'entrée : le menu principal -->
|
||||||
<activity android:name=".MenuActivity"
|
<activity android:name=".MenuActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Partie avec graine : retour arrière = MenuActivity -->
|
<!-- Partie avec graine : retour arrière = MenuActivity -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".SeedActivity"
|
android:name=".SeedActivity"
|
||||||
android:parentActivityName=".MenuActivity"/>
|
android:parentActivityName=".MenuActivity"/>
|
||||||
|
|
||||||
<!-- Options : retour arrière = MenuActivity -->
|
<!-- Options : retour arrière = MenuActivity -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".OptionsActivity"
|
android:name=".OptionsActivity"
|
||||||
android:parentActivityName=".MenuActivity"/>
|
android:parentActivityName=".MenuActivity"/>
|
||||||
|
|
||||||
<!-- Jeu : retour arrière = MenuActivity -->
|
<!-- Jeu : retour arrière = MenuActivity -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:parentActivityName=".MenuActivity"/>
|
android:parentActivityName=".MenuActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package sae.chuzzle;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class Controleur {
|
||||||
|
|
||||||
|
private final Activity activite;
|
||||||
|
private final EtatJeu etatJeu;
|
||||||
|
private final VueGrille vueGrille;
|
||||||
|
|
||||||
|
private final TextView tvScore;
|
||||||
|
private final TextView tvCoups;
|
||||||
|
private final RadioButton rbLigne;
|
||||||
|
private final RadioButton rbDroite;
|
||||||
|
private final Spinner spinnerIndex;
|
||||||
|
private final Button btnJouer;
|
||||||
|
|
||||||
|
// -
|
||||||
|
// CONSTRUCTEUR
|
||||||
|
|
||||||
|
|
||||||
|
public Controleur(Activity activite, EtatJeu etatJeu, VueGrille vueGrille,
|
||||||
|
TextView tvScore, TextView tvCoups,
|
||||||
|
RadioButton rbLigne, RadioButton rbDroite,
|
||||||
|
Spinner spinnerIndex, Button btnJouer) {
|
||||||
|
|
||||||
|
this.activite = activite;
|
||||||
|
this.etatJeu = etatJeu;
|
||||||
|
this.vueGrille = vueGrille;
|
||||||
|
this.tvScore = tvScore;
|
||||||
|
this.tvCoups = tvCoups;
|
||||||
|
this.rbLigne = rbLigne;
|
||||||
|
this.rbDroite = rbDroite;
|
||||||
|
this.spinnerIndex = spinnerIndex;
|
||||||
|
this.btnJouer = btnJouer;
|
||||||
|
|
||||||
|
initialiserSpinner();
|
||||||
|
rafraichirAffichage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -
|
||||||
|
// INITIALISATION
|
||||||
|
|
||||||
|
|
||||||
|
private void initialiserSpinner() {
|
||||||
|
String[] indices = {"0", "1", "2", "3", "4", "5"};
|
||||||
|
ArrayAdapter<String> adaptateur = new ArrayAdapter<>(
|
||||||
|
activite,
|
||||||
|
android.R.layout.simple_spinner_item,
|
||||||
|
indices
|
||||||
|
);
|
||||||
|
adaptateur.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
spinnerIndex.setAdapter(adaptateur);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -
|
||||||
|
// GESTION DU COUP
|
||||||
|
|
||||||
|
|
||||||
|
public void gererCoupJoueur() {
|
||||||
|
boolean estLigne = rbLigne.isChecked();
|
||||||
|
int index = spinnerIndex.getSelectedItemPosition();
|
||||||
|
|
||||||
|
int sens;
|
||||||
|
if (rbDroite.isChecked()) {
|
||||||
|
sens = +1;
|
||||||
|
} else {
|
||||||
|
sens = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean accepte = etatJeu.appliquerCoup(estLigne, index, sens);
|
||||||
|
|
||||||
|
if (!accepte) {
|
||||||
|
Toast.makeText(activite, "Coup invalide !", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(accepte){
|
||||||
|
Toast.makeText(activite, "Coup valide !", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
rafraichirAffichage();
|
||||||
|
|
||||||
|
if (etatJeu.estTerminee()) {
|
||||||
|
Toast.makeText(
|
||||||
|
activite,
|
||||||
|
"Partie terminee ! Score : " + etatJeu.obtenirScore(),
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
btnJouer.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -
|
||||||
|
// MISE A JOUR DE LA VUE
|
||||||
|
|
||||||
|
|
||||||
|
public void rafraichirAffichage() {
|
||||||
|
tvScore.setText("Score : " + etatJeu.obtenirScore());
|
||||||
|
tvCoups.setText("Coups : " + etatJeu.obtenirNbCoups());
|
||||||
|
vueGrille.definirGrille(etatJeu.obtenirGrille());
|
||||||
|
vueGrille.definirVerrous(etatJeu.obtenirVerrous());
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,124 +1,57 @@
|
|||||||
package sae.chuzzle;
|
package sae.chuzzle;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.Button;
|
||||||
import android.widget.Button;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioButton;
|
import android.widget.Spinner;
|
||||||
import android.widget.Spinner;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
public class MainActivity extends Activity implements View.OnClickListener {
|
||||||
|
|
||||||
import sae.chuzzle.EtatJeu;
|
private Controleur controleur;
|
||||||
import sae.chuzzle.VueGrille;
|
private Button btnJouer;
|
||||||
|
|
||||||
public class MainActivity extends Activity implements View.OnClickListener {
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
private EtatJeu etatJeu;
|
super.onCreate(savedInstanceState);
|
||||||
private VueGrille vueGrille;
|
setContentView(R.layout.activity_main);
|
||||||
private TextView tvScore;
|
|
||||||
private TextView tvCoups;
|
// --- Modèle ---
|
||||||
private RadioButton rbLigne;
|
long graine = getIntent().getLongExtra("graine", System.currentTimeMillis());
|
||||||
private RadioButton rbDroite;
|
boolean hardMode = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE)
|
||||||
private Spinner spinnerIndex;
|
.getBoolean("hard_mode", false);
|
||||||
private Button btnJouer;
|
boolean daltonien = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE)
|
||||||
|
.getBoolean("daltonien", false);
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
EtatJeu etatJeu = new EtatJeu(graine, hardMode);
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
// --- Vue ---
|
||||||
|
VueGrille vueGrille = findViewById(R.id.vueGrille);
|
||||||
// - Lire la graine et les options
|
vueGrille.definirModeDaltonien(daltonien);
|
||||||
long graine = getIntent().getLongExtra("graine", System.currentTimeMillis());
|
|
||||||
boolean daltonien = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE)
|
// --- Controleur ---
|
||||||
.getBoolean("daltonien", false);
|
btnJouer = findViewById(R.id.btnJouer);
|
||||||
boolean hardMode = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE)
|
btnJouer.setOnClickListener(this);
|
||||||
.getBoolean("hard_mode", false);
|
|
||||||
|
controleur = new Controleur(
|
||||||
// - Modèle
|
this,
|
||||||
etatJeu = new EtatJeu(graine, hardMode);
|
etatJeu,
|
||||||
|
vueGrille,
|
||||||
// - Récupérer les vues depuis le XML
|
(TextView) findViewById(R.id.tvScore),
|
||||||
tvScore = findViewById(R.id.tvScore);
|
(TextView) findViewById(R.id.tvCoups),
|
||||||
tvCoups = findViewById(R.id.tvCoups);
|
(RadioButton) findViewById(R.id.rbLigne),
|
||||||
vueGrille = findViewById(R.id.vueGrille);
|
(RadioButton) findViewById(R.id.rbDroite),
|
||||||
rbLigne = findViewById(R.id.rbLigne);
|
(Spinner) findViewById(R.id.spinnerIndex),
|
||||||
rbDroite = findViewById(R.id.rbDroite);
|
btnJouer
|
||||||
spinnerIndex = findViewById(R.id.spinnerIndex);
|
);
|
||||||
btnJouer = findViewById(R.id.btnJouer);
|
}
|
||||||
|
|
||||||
// - Configurer la vue
|
@Override
|
||||||
vueGrille.definirGrille(etatJeu.obtenirGrille());
|
public void onClick(View v) {
|
||||||
vueGrille.definirVerrous(etatJeu.obtenirVerrous());
|
if (v == btnJouer) {
|
||||||
vueGrille.definirModeDaltonien(daltonien);
|
controleur.gererCoupJoueur();
|
||||||
|
}
|
||||||
// - Configurer le spinner
|
}
|
||||||
String[] indices = {"0", "1", "2", "3", "4", "5"};
|
|
||||||
ArrayAdapter<String> adaptateur = new ArrayAdapter<>(
|
|
||||||
this,
|
|
||||||
android.R.layout.simple_spinner_item,
|
|
||||||
indices
|
|
||||||
);
|
|
||||||
adaptateur.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
||||||
spinnerIndex.setAdapter(adaptateur);
|
|
||||||
|
|
||||||
// --- Bouton jouer ---
|
|
||||||
btnJouer.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// GESTION DES CLICS
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (v == btnJouer) {
|
|
||||||
gererCoupJoueur();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// COORDINATION
|
|
||||||
|
|
||||||
|
|
||||||
private void gererCoupJoueur() {
|
|
||||||
boolean estLigne = rbLigne.isChecked();
|
|
||||||
int index = spinnerIndex.getSelectedItemPosition();
|
|
||||||
|
|
||||||
int sens;
|
|
||||||
if (rbDroite.isChecked()) {
|
|
||||||
sens = +1;
|
|
||||||
} else {
|
|
||||||
sens = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean accepte = etatJeu.appliquerCoup(estLigne, index, sens);
|
|
||||||
|
|
||||||
if (!accepte) {
|
|
||||||
Toast.makeText(
|
|
||||||
this,
|
|
||||||
"Coup invalide : aucune serie creee !",
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
rafraichirAffichage();
|
|
||||||
|
|
||||||
if (etatJeu.estTerminee()) {
|
|
||||||
Toast.makeText(
|
|
||||||
this,
|
|
||||||
"Partie terminee ! Score final : " + etatJeu.obtenirScore(),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show();
|
|
||||||
btnJouer.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rafraichirAffichage() {
|
|
||||||
tvScore.setText("Score : " + etatJeu.obtenirScore());
|
|
||||||
tvCoups.setText("Coups : " + etatJeu.obtenirNbCoups());
|
|
||||||
vueGrille.definirGrille(etatJeu.obtenirGrille());
|
|
||||||
vueGrille.definirVerrous(etatJeu.obtenirVerrous());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,44 +1,44 @@
|
|||||||
package sae.chuzzle;
|
package sae.chuzzle;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
public class MenuActivity extends Activity implements View.OnClickListener {
|
public class MenuActivity extends Activity implements View.OnClickListener {
|
||||||
|
|
||||||
private Button btnNouvellePartie;
|
private Button btnNouvellePartie;
|
||||||
private Button btnPartieGraine;
|
private Button btnPartieGraine;
|
||||||
private Button btnOptions;
|
private Button btnOptions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_menu);
|
setContentView(R.layout.activity_menu);
|
||||||
|
|
||||||
btnNouvellePartie = findViewById(R.id.btnNouvellePartie);
|
btnNouvellePartie = findViewById(R.id.btnNouvellePartie);
|
||||||
btnPartieGraine = findViewById(R.id.btnPartieGraine);
|
btnPartieGraine = findViewById(R.id.btnPartieGraine);
|
||||||
btnOptions = findViewById(R.id.btnOptions);
|
btnOptions = findViewById(R.id.btnOptions);
|
||||||
|
|
||||||
btnNouvellePartie.setOnClickListener(this);
|
btnNouvellePartie.setOnClickListener(this);
|
||||||
btnPartieGraine.setOnClickListener(this);
|
btnPartieGraine.setOnClickListener(this);
|
||||||
btnOptions.setOnClickListener(this);
|
btnOptions.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == btnNouvellePartie) {
|
if (v == btnNouvellePartie) {
|
||||||
long graine = System.currentTimeMillis();
|
long graine = System.currentTimeMillis();
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
intent.putExtra("graine", graine);
|
intent.putExtra("graine", graine);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (v == btnPartieGraine) {
|
} else if (v == btnPartieGraine) {
|
||||||
Intent intent = new Intent(this, SeedActivity.class);
|
Intent intent = new Intent(this, SeedActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (v == btnOptions) {
|
} else if (v == btnOptions) {
|
||||||
Intent intent = new Intent(this, OptionsActivity.class);
|
Intent intent = new Intent(this, OptionsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,41 +1,41 @@
|
|||||||
package sae.chuzzle;
|
package sae.chuzzle;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CheckBox;
|
||||||
import android.widget.Switch;
|
import android.widget.CompoundButton;
|
||||||
|
|
||||||
public class OptionsActivity extends Activity
|
public class OptionsActivity extends Activity
|
||||||
implements CompoundButton.OnCheckedChangeListener {
|
implements CompoundButton.OnCheckedChangeListener {
|
||||||
|
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private Switch switchDaltonien;
|
private CheckBox checkDaltonien;
|
||||||
private Switch switchHard;
|
private CheckBox checkHard;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_options);
|
setContentView(R.layout.activity_options);
|
||||||
|
|
||||||
prefs = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE);
|
prefs = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE);
|
||||||
|
|
||||||
switchDaltonien = findViewById(R.id.switchDaltonien);
|
checkDaltonien = findViewById(R.id.switchDaltonien);
|
||||||
switchHard = findViewById(R.id.switchHard);
|
checkHard = findViewById(R.id.switchHard);
|
||||||
|
|
||||||
switchDaltonien.setChecked(prefs.getBoolean("daltonien", false));
|
checkDaltonien.setChecked(prefs.getBoolean("daltonien", false));
|
||||||
switchHard.setChecked(prefs.getBoolean("hard_mode", false));
|
checkHard.setChecked(prefs.getBoolean("hard_mode", false));
|
||||||
|
|
||||||
switchDaltonien.setOnCheckedChangeListener(this);
|
checkDaltonien.setOnCheckedChangeListener(this);
|
||||||
switchHard.setOnCheckedChangeListener(this);
|
checkHard.setOnCheckedChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton bouton, boolean estCoche) {
|
public void onCheckedChanged(CompoundButton bouton, boolean estCoche) {
|
||||||
if (bouton == switchDaltonien) {
|
if (bouton == checkDaltonien) {
|
||||||
prefs.edit().putBoolean("daltonien", estCoche).apply();
|
prefs.edit().putBoolean("daltonien", estCoche).apply();
|
||||||
} else if (bouton == switchHard) {
|
} else if (bouton == checkHard) {
|
||||||
prefs.edit().putBoolean("hard_mode", estCoche).apply();
|
prefs.edit().putBoolean("hard_mode", estCoche).apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,58 @@
|
|||||||
package sae.chuzzle;
|
package sae.chuzzle;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class SeedActivity extends Activity implements View.OnClickListener {
|
||||||
public class SeedActivity extends Activity implements View.OnClickListener {
|
|
||||||
|
private EditText etGraine;
|
||||||
private EditText etGraine;
|
private Button btnJouer;
|
||||||
private Button btnJouer;
|
|
||||||
|
@Override
|
||||||
@Override
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
super.onCreate(savedInstanceState);
|
||||||
super.onCreate(savedInstanceState);
|
setContentView(R.layout.activity_seed);
|
||||||
setContentView(R.layout.activity_seed);
|
|
||||||
|
etGraine = findViewById(R.id.etGraine);
|
||||||
etGraine = findViewById(R.id.etGraine);
|
btnJouer = findViewById(R.id.btnJouer);
|
||||||
btnJouer = findViewById(R.id.btnJouer);
|
|
||||||
|
btnJouer.setOnClickListener(this);
|
||||||
btnJouer.setOnClickListener(this);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
if (v == btnJouer) {
|
||||||
if (v == btnJouer) {
|
lancerPartieAvecGraine();
|
||||||
lancerPartieAvecGraine();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void lancerPartieAvecGraine() {
|
||||||
private void lancerPartieAvecGraine() {
|
String texte = etGraine.getText().toString().trim();
|
||||||
String texte = etGraine.getText().toString().trim();
|
|
||||||
|
if (texte.isEmpty()) {
|
||||||
if (texte.isEmpty()) {
|
Toast.makeText(
|
||||||
Toast.makeText(
|
this,
|
||||||
this,
|
"Veuillez entrer une graine.",
|
||||||
"Veuillez entrer une graine.",
|
Toast.LENGTH_SHORT
|
||||||
Toast.LENGTH_SHORT
|
).show();
|
||||||
).show();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
long graine;
|
||||||
long graine;
|
|
||||||
|
try {
|
||||||
try {
|
graine = Long.parseLong(texte);
|
||||||
graine = Long.parseLong(texte);
|
} catch (NumberFormatException e) {
|
||||||
} catch (NumberFormatException e) {
|
graine = texte.hashCode();
|
||||||
graine = texte.hashCode();
|
}
|
||||||
}
|
|
||||||
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
intent.putExtra("graine", graine);
|
||||||
intent.putExtra("graine", graine);
|
startActivity(intent);
|
||||||
startActivity(intent);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,146 +1,158 @@
|
|||||||
package sae.chuzzle;
|
package sae.chuzzle;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.view.View;
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
public class VueGrille extends View {
|
|
||||||
private boolean[][] verrous = new boolean[NB_LIGNES][NB_COLONNES];
|
public class VueGrille extends View {
|
||||||
|
private boolean[][] verrous = new boolean[NB_LIGNES][NB_COLONNES];
|
||||||
private static final int NB_LIGNES = 6;
|
|
||||||
private static final int NB_COLONNES = 6;
|
private static final int NB_LIGNES = 6;
|
||||||
private static final int NB_TYPES = 7;
|
private static final int NB_COLONNES = 6;
|
||||||
|
private static final int NB_TYPES = 7;
|
||||||
// Symboles pour le mode daltonien, un par type
|
|
||||||
private static final String[] SYMBOLES = {"●", "■", "▲", "✚", "★", "♦", "✿"};
|
// Symboles pour le mode daltonien, un par type
|
||||||
|
private static final String[] SYMBOLES = {"●", "■", "▲", "✚", "★", "♦", "✿"};
|
||||||
// La VueGrille ne reçoit qu'un tableau int[][] brut, pas un EtatJeu
|
|
||||||
private int[][] grille = new int[NB_LIGNES][NB_COLONNES];
|
// La VueGrille ne reçoit qu'un tableau int[][] brut, pas un EtatJeu
|
||||||
private boolean modeDaltonien = false;
|
private int[][] grille = new int[NB_LIGNES][NB_COLONNES];
|
||||||
|
private boolean modeDaltonien = false;
|
||||||
private final Paint pinceauCase = new Paint();
|
|
||||||
private final Paint pinceauSymbole = new Paint();
|
private final Paint pinceauCase = new Paint();
|
||||||
|
private final Paint pinceauSymbole = new Paint();
|
||||||
// =========================================================
|
|
||||||
// CONSTRUCTEUR
|
// =========================================================
|
||||||
// =========================================================
|
// CONSTRUCTEUR
|
||||||
|
// =========================================================
|
||||||
public VueGrille(Context contexte) {
|
|
||||||
super(contexte);
|
public VueGrille(Context contexte) {
|
||||||
|
super(contexte);
|
||||||
pinceauCase.setAntiAlias(true);
|
|
||||||
pinceauCase.setStyle(Paint.Style.FILL);
|
pinceauCase.setAntiAlias(true);
|
||||||
|
pinceauCase.setStyle(Paint.Style.FILL);
|
||||||
pinceauSymbole.setAntiAlias(true);
|
|
||||||
pinceauSymbole.setColor(0xFF000000);
|
pinceauSymbole.setAntiAlias(true);
|
||||||
pinceauSymbole.setTextAlign(Paint.Align.CENTER);
|
pinceauSymbole.setColor(0xFF000000);
|
||||||
}
|
pinceauSymbole.setTextAlign(Paint.Align.CENTER);
|
||||||
|
}
|
||||||
// =========================================================
|
|
||||||
// API PUBLIQUE (appelée par MainActivity uniquement)
|
public VueGrille(Context context, AttributeSet attrs) {
|
||||||
// =========================================================
|
super(context, attrs);
|
||||||
|
|
||||||
/**
|
pinceauCase.setAntiAlias(true);
|
||||||
* Reçoit une copie de la grille depuis MainActivity.
|
pinceauCase.setStyle(Paint.Style.FILL);
|
||||||
* VueGrille ne sait pas d'où viennent ces données,
|
|
||||||
* elle sait juste les dessiner.
|
pinceauSymbole.setAntiAlias(true);
|
||||||
*/
|
pinceauSymbole.setColor(0xFF000000);
|
||||||
public void definirGrille(int[][] nouvelleGrille) {
|
pinceauSymbole.setTextAlign(Paint.Align.CENTER);
|
||||||
for (int l = 0; l < NB_LIGNES; l++) {
|
}
|
||||||
System.arraycopy(nouvelleGrille[l], 0, grille[l], 0, NB_COLONNES);
|
|
||||||
}
|
|
||||||
invalidate();
|
// API PUBLIQUE (appelée par MainActivity uniquement)
|
||||||
}
|
|
||||||
|
|
||||||
public void definirModeDaltonien(boolean actif) {
|
/**
|
||||||
this.modeDaltonien = actif;
|
* Reçoit une copie de la grille depuis MainActivity.
|
||||||
invalidate();
|
* VueGrille ne sait pas d'où viennent ces données,
|
||||||
}
|
* elle sait juste les dessiner.
|
||||||
|
*/
|
||||||
// =========================================================
|
public void definirGrille(int[][] nouvelleGrille) {
|
||||||
// DESSIN
|
for (int l = 0; l < NB_LIGNES; l++) {
|
||||||
// =========================================================
|
System.arraycopy(nouvelleGrille[l], 0, grille[l], 0, NB_COLONNES);
|
||||||
|
}
|
||||||
@Override
|
invalidate();
|
||||||
protected void onDraw(@NonNull Canvas canvas) {
|
}
|
||||||
super.onDraw(canvas);
|
|
||||||
|
public void definirModeDaltonien(boolean actif) {
|
||||||
int largeur = getWidth();
|
this.modeDaltonien = actif;
|
||||||
int hauteur = getHeight();
|
invalidate();
|
||||||
|
}
|
||||||
float tailleCase = Math.min(
|
|
||||||
largeur / (float) NB_COLONNES,
|
// -
|
||||||
hauteur / (float) NB_LIGNES
|
// DESSIN
|
||||||
);
|
|
||||||
|
|
||||||
float margeGauche = (largeur - tailleCase * NB_COLONNES) / 2f;
|
@Override
|
||||||
float margeHaut = (hauteur - tailleCase * NB_LIGNES) / 2f;
|
protected void onDraw(@NonNull Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
pinceauSymbole.setTextSize(tailleCase * 0.4f);
|
|
||||||
|
int largeur = getWidth();
|
||||||
for (int ligne = 0; ligne < NB_LIGNES; ligne++) {
|
int hauteur = getHeight();
|
||||||
for (int colonne = 0; colonne < NB_COLONNES; colonne++) {
|
|
||||||
|
float tailleCase = Math.min(
|
||||||
int type = grille[ligne][colonne];
|
largeur / (float) NB_COLONNES,
|
||||||
|
hauteur / (float) NB_LIGNES
|
||||||
float x1 = margeGauche + colonne * tailleCase + 6;
|
);
|
||||||
float y1 = margeHaut + ligne * tailleCase + 6;
|
|
||||||
float x2 = margeGauche + (colonne + 1) * tailleCase - 6;
|
float margeGauche = (largeur - tailleCase * NB_COLONNES) / 2f;
|
||||||
float y2 = margeHaut + (ligne + 1) * tailleCase - 6;
|
float margeHaut = (hauteur - tailleCase * NB_LIGNES) / 2f;
|
||||||
|
|
||||||
// Dessiner la case colorée
|
pinceauSymbole.setTextSize(tailleCase * 0.4f);
|
||||||
// Dessiner la case colorée
|
|
||||||
definirCouleur(type);
|
for (int ligne = 0; ligne < NB_LIGNES; ligne++) {
|
||||||
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
for (int colonne = 0; colonne < NB_COLONNES; colonne++) {
|
||||||
|
|
||||||
// Assombrir la case si elle est verrouillée
|
int type = grille[ligne][colonne];
|
||||||
if (verrous[ligne][colonne]) {
|
|
||||||
pinceauCase.setARGB(120, 0, 0, 0);
|
float x1 = margeGauche + colonne * tailleCase + 6;
|
||||||
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
float y1 = margeHaut + ligne * tailleCase + 6;
|
||||||
}
|
float x2 = margeGauche + (colonne + 1) * tailleCase - 6;
|
||||||
|
float y2 = margeHaut + (ligne + 1) * tailleCase - 6;
|
||||||
// Dessiner le symbole daltonien
|
|
||||||
if (modeDaltonien) {
|
// Dessiner la case colorée
|
||||||
float cx = (x1 + x2) / 2f;
|
// Dessiner la case colorée
|
||||||
float cy = (y1 + y2) / 2f
|
definirCouleur(type);
|
||||||
- (pinceauSymbole.descent() + pinceauSymbole.ascent()) / 2f;
|
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
||||||
canvas.drawText(SYMBOLES[type % NB_TYPES], cx, cy, pinceauSymbole);
|
|
||||||
}
|
// Assombrir la case si elle est verrouillée
|
||||||
|
if (verrous[ligne][colonne]) {
|
||||||
// Dessiner le cadenas par-dessus si verrouillée
|
pinceauCase.setARGB(120, 0, 0, 0);
|
||||||
if (verrous[ligne][colonne]) {
|
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
||||||
float cx = (x1 + x2) / 2f;
|
}
|
||||||
float cy = (y1 + y2) / 2f
|
|
||||||
- (pinceauSymbole.descent() + pinceauSymbole.ascent()) / 2f;
|
// Dessiner le symbole daltonien
|
||||||
canvas.drawText("🔒", cx, cy, pinceauSymbole);
|
if (modeDaltonien) {
|
||||||
}
|
float cx = (x1 + x2) / 2f;
|
||||||
}
|
float cy = (y1 + y2) / 2f
|
||||||
}
|
- (pinceauSymbole.descent() + pinceauSymbole.ascent()) / 2f;
|
||||||
}
|
canvas.drawText(SYMBOLES[type % NB_TYPES], cx, cy, pinceauSymbole);
|
||||||
|
}
|
||||||
// =========================================================
|
|
||||||
// UTILITAIRE PRIVE
|
// Dessiner le cadenas par-dessus si verrouillée
|
||||||
// =========================================================
|
if (verrous[ligne][colonne]) {
|
||||||
|
float cx = (x1 + x2) / 2f;
|
||||||
private void definirCouleur(int type) {
|
float cy = (y1 + y2) / 2f
|
||||||
switch (type % NB_TYPES) {
|
- (pinceauSymbole.descent() + pinceauSymbole.ascent()) / 2f;
|
||||||
case 0: pinceauCase.setARGB(255, 200, 200, 200); break;
|
canvas.drawText("🔒", cx, cy, pinceauSymbole);
|
||||||
case 1: pinceauCase.setARGB(255, 255, 105, 180); break;
|
}
|
||||||
case 2: pinceauCase.setARGB(255, 90, 230, 200); break;
|
}
|
||||||
case 3: pinceauCase.setARGB(255, 100, 170, 255); break;
|
}
|
||||||
case 4: pinceauCase.setARGB(255, 255, 220, 90); break;
|
}
|
||||||
case 5: pinceauCase.setARGB(255, 255, 140, 90); break;
|
|
||||||
case 6: pinceauCase.setARGB(255, 255, 90, 90); break;
|
// -
|
||||||
}
|
// UTILITAIRE PRIVE
|
||||||
}
|
|
||||||
public void definirVerrous(boolean[][] nouveauxVerrous) {
|
|
||||||
for (int l = 0; l < NB_LIGNES; l++) {
|
private void definirCouleur(int type) {
|
||||||
System.arraycopy(nouveauxVerrous[l], 0, verrous[l], 0, NB_COLONNES);
|
switch (type % NB_TYPES) {
|
||||||
}
|
case 0: pinceauCase.setARGB(255, 200, 200, 200); break;
|
||||||
invalidate();
|
case 1: pinceauCase.setARGB(255, 255, 105, 180); break;
|
||||||
}
|
case 2: pinceauCase.setARGB(255, 90, 230, 200); break;
|
||||||
|
case 3: pinceauCase.setARGB(255, 100, 170, 255); break;
|
||||||
|
case 4: pinceauCase.setARGB(255, 255, 220, 90); break;
|
||||||
|
case 5: pinceauCase.setARGB(255, 255, 140, 90); break;
|
||||||
|
case 6: pinceauCase.setARGB(255, 255, 90, 90); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void definirVerrous(boolean[][] nouveauxVerrous) {
|
||||||
|
for (int l = 0; l < NB_LIGNES; l++) {
|
||||||
|
System.arraycopy(nouveauxVerrous[l], 0, verrous[l], 0, NB_COLONNES);
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
@@ -1,86 +1,86 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvScore"
|
android:id="@+id/tvScore"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Score : 0"
|
android:text="Score : 0"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvCoups"
|
android:id="@+id/tvCoups"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Coups : 0"
|
android:text="Coups : 0"
|
||||||
android:textSize="18sp"/>
|
android:textSize="18sp"/>
|
||||||
|
|
||||||
<sae.chuzzle.VueGrille
|
<sae.chuzzle.VueGrille
|
||||||
android:id="@+id/vueGrille"
|
android:id="@+id/vueGrille"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/rgChoix"
|
android:id="@+id/rgChoix"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbLigne"
|
android:id="@+id/rbLigne"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Ligne"
|
android:text="Ligne"
|
||||||
android:checked="true"/>
|
android:checked="true"/>
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbColonne"
|
android:id="@+id/rbColonne"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Colonne"/>
|
android:text="Colonne"/>
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinnerIndex"
|
android:id="@+id/spinnerIndex"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/rgSens"
|
android:id="@+id/rgSens"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbDroite"
|
android:id="@+id/rbDroite"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Droite / Bas (+1)"
|
android:text="Droite / Bas (+1)"
|
||||||
android:checked="true"/>
|
android:checked="true"/>
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbGauche"
|
android:id="@+id/rbGauche"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Gauche / Haut (-1)"/>
|
android:text="Gauche / Haut (-1)"/>
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnJouer"
|
android:id="@+id/btnJouer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Jouer"/>
|
android:text="Jouer"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="48dp">
|
android:padding="48dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Chuzzle"
|
android:text="Chuzzle"
|
||||||
android:textSize="48sp"
|
android:textSize="48sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginBottom="64dp"/>
|
android:layout_marginBottom="64dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnNouvellePartie"
|
android:id="@+id/btnNouvellePartie"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Nouvelle Partie"
|
android:text="Nouvelle Partie"
|
||||||
android:layout_marginBottom="16dp"/>
|
android:layout_marginBottom="16dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnPartieGraine"
|
android:id="@+id/btnPartieGraine"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Partie avec Graine"
|
android:text="Partie avec Graine"
|
||||||
android:layout_marginBottom="16dp"/>
|
android:layout_marginBottom="16dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOptions"
|
android:id="@+id/btnOptions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Options"/>
|
android:text="Options"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,58 +1,58 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="48dp">
|
android:padding="48dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Options"
|
android:text="Options"
|
||||||
android:textSize="32sp"
|
android:textSize="32sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginBottom="64dp"/>
|
android:layout_marginBottom="64dp"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginBottom="32dp">
|
android:layout_marginBottom="32dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Mode daltonien (symboles)"
|
android:text="Mode daltonien (symboles)"
|
||||||
android:textSize="18sp"/>
|
android:textSize="18sp"/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/switchDaltonien"
|
android:id="@+id/switchDaltonien"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Hard mode (verrous)"
|
android:text="Hard mode (verrous)"
|
||||||
android:textSize="18sp"/>
|
android:textSize="18sp"/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/switchHard"
|
android:id="@+id/switchHard"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="50dp"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="50dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="48dp">
|
android:padding="48dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Entrez une graine"
|
android:text="Entrez une graine"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginBottom="32dp"/>
|
android:layout_marginBottom="32dp"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etGraine"
|
android:id="@+id/etGraine"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Ex : 12345"
|
android:hint="Ex : 12345"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:layout_marginBottom="32dp"/>
|
android:layout_marginBottom="32dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnJouer"
|
android:id="@+id/btnJouer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Jouer"/>
|
android:text="Jouer"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Chuzzle</string>
|
<string name="app_name">RealChuzzle</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user