ajout tp android

This commit is contained in:
Simoes Lukas
2026-03-22 13:57:47 +01:00
commit ce14b15cf2
680 changed files with 16444 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
+1
View File
@@ -0,0 +1 @@
/build
+43
View File
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.android.application)
}
android {
namespace = "com.example.sae41_2025"
compileSdk = 36
defaultConfig {
applicationId = "com.example.sae41_2025"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,26 @@
package com.example.sae41_2025;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.sae41_2025", appContext.getPackageName());
}
}
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SAE41_2025">
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".GameActivity"
android:exported="false"
android:screenOrientation="portrait" />
</application>
</manifest>
@@ -0,0 +1,25 @@
package com.example.sae41_2025;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
public class BtnContinuerPartieListener implements OnClickListener {
private MainActivity activity_menu;
public BtnContinuerPartieListener(MainActivity activity_menu) {
this.activity_menu = activity_menu;
}
@Override
public void onClick(View v) {
Intent intent = new Intent(this.activity_menu, GameActivity.class);
CaseEtat[][] grilleEnCours = this.activity_menu.getGrilleEnCours();
if (grilleEnCours != null) {
intent.putExtra(MainActivity.GRILLE_ETAT, grilleEnCours);
}
this.activity_menu.startActivityForResult(intent, MainActivity.INTENT_RESQUESTCODE);
}
}
@@ -0,0 +1,19 @@
package com.example.sae41_2025;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
public class BtnLancerPartieListener implements OnClickListener {
private MainActivity activity_menu;
public BtnLancerPartieListener(MainActivity activity_menu) {
this.activity_menu = activity_menu;
}
@Override
public void onClick(View v) {
Intent intent = new Intent(this.activity_menu, GameActivity.class);
this.activity_menu.startActivityForResult(intent, MainActivity.INTENT_RESQUESTCODE);
}
}
@@ -0,0 +1,23 @@
package com.example.sae41_2025;
import android.graphics.Color;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
public class BtnOublierPartieListener implements OnClickListener {
private MainActivity activity_menu;
public BtnOublierPartieListener(MainActivity activity_menu) {
this.activity_menu = activity_menu;
}
@Override
public void onClick(View v) {
this.activity_menu.resetGrille();
this.activity_menu.setDifficulte(false);
this.activity_menu.getMenuLayout().setBackgroundColor(Color.parseColor("#fffffbfb"));
this.activity_menu.getSwitchDifficulte().setChecked(false);
this.activity_menu.actualiserBtnMenu();
}
}
@@ -0,0 +1,113 @@
package com.example.sae41_2025;
import android.content.Context;
import android.graphics.Color;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.view.View;
public class Case extends RelativeLayout {
private ImageView tileImageView;
private int tileResId;
private ImageView cadenaImageView;
private View surlignageView;
private boolean bloque = false;
private int x;
private int y;
private int caseWidth;
private int caseHeight;
public Case(Context context, int imageResId, int x, int y) {
super(context);
this.x = x;
this.y = y;
this.setSurlignageView(context);
this.setTileImage(context, imageResId);
this.setCadenaImage(context);
}
private void setTileImage(Context context, int imageResId) {
this.tileResId = imageResId;
this.tileImageView = new ImageView(context);
this.tileImageView.setImageResource(imageResId);
this.tileImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
RelativeLayout.LayoutParams tileParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.addView(this.tileImageView, tileParams);
}
private void setSurlignageView(Context context) {
this.surlignageView = new View(context);
this.surlignageView.setBackgroundColor(Color.argb(120, 255, 220, 0));
this.surlignageView.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.addView(this.surlignageView, params);
}
private void setCadenaImage(Context context) {
this.cadenaImageView = new ImageView(context);
this.cadenaImageView.setImageResource(R.drawable.lock);
this.cadenaImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
this.cadenaImageView.setVisibility(View.GONE);
RelativeLayout.LayoutParams cadenaParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
cadenaParams.addRule(RelativeLayout.CENTER_IN_PARENT);
this.addView(this.cadenaImageView, cadenaParams);
}
public void setBloque(boolean bloque) {
this.bloque = bloque;
this.cadenaImageView.setVisibility(bloque ? View.VISIBLE : View.GONE);
}
public boolean isBloque() {
return this.bloque;
}
public CaseEtat toEtat() {
return new CaseEtat(this.tileResId, this.isBloque());
}
public int getMyX() {
return x;
}
public void setMyX(int x) {
this.x = x;
}
public int getMyY() {
return y;
}
public void setMyY(int y) {
this.y = y;
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
this.caseWidth = w;
this.caseHeight = h;
}
public int getCaseWidth() {
return this.caseWidth;
}
public int getCaseHeight() {
return this.caseHeight;
}
public int getTileResId() {
return this.tileResId;
}
public void updateTile(int imageResId) {
this.tileResId = imageResId;
this.tileImageView.setImageResource(imageResId);
}
public void setSurlignee(boolean surlignee) {
this.surlignageView.setVisibility(surlignee ? View.VISIBLE : View.GONE);
}
}
@@ -0,0 +1,26 @@
package com.example.sae41_2025;
import java.io.Serializable;
public class CaseEtat implements Serializable {
private int tileResId;
private boolean bloque;
public CaseEtat(int tileResId, boolean bloque) {
this.tileResId = tileResId;
this.bloque = bloque;
}
public int getTileResId() {
return this.tileResId;
}
public boolean isBloque() {
return this.bloque;
}
public void setBloque(boolean bloque) {
this.bloque = bloque;
}
}
@@ -0,0 +1,45 @@
package com.example.exo1;
import android.view.GestureDetector;
import android.view.MotionEvent;
import com.example.sae41_2025.CaseOnTouchListener;
public class CaseGestureListener implements GestureDetector.OnGestureListener {
private CaseOnTouchListener listener;
public CaseGestureListener(CaseOnTouchListener listener) {
this.listener = listener;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
this.listener.setOrientation(distanceX, distanceY);
this.listener.updatePosition(e2);
return true;
}
@Override
public void onShowPress(MotionEvent e) {
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
return false;
}
}
@@ -0,0 +1,128 @@
package com.example.sae41_2025;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import com.example.sae41_2025.Case;
import com.example.exo1.CaseGestureListener;
import android.util.Log;
public class CaseOnTouchListener implements View.OnTouchListener {
private Case uneCase;
private GameActivity gameAcitivity;
private GestureDetector gestureDetector;
private Boolean isHorizontal = null;
private Direction direction = null;
private int ligneCaseToucheeActuelle;
private int colonneCaseToucheeActuelle;
private int[] resIdsSauvegardes = null;
private boolean[] bloquesSauvegardes = null;
private boolean isSauvegarde = false;
public CaseOnTouchListener(GameActivity context, Case c) {
this.uneCase = c;
this.gameAcitivity = context;
this.gestureDetector = new GestureDetector(context, new CaseGestureListener(this));
}
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getActionMasked();
// animation :
// garder letat initial de la ligne/col
// choper le decalage quand il change et l'appliquer
// appliquer -> revenir a l'etat inital et mettre le decalage
// tres utile pour anim et pour plus tard si on doit annuler des coups car non respect regle
if (action == MotionEvent.ACTION_DOWN) {
this.isHorizontal = null;
this.direction = null;
this.isSauvegarde = false;
this.resIdsSauvegardes = null;
this.bloquesSauvegardes = null;
} else if (action == MotionEvent.ACTION_MOVE) {
if (this.isHorizontal != null) {
if (!this.isSauvegarde) {
if (this.isHorizontal) {
this.resIdsSauvegardes = this.gameAcitivity.getLigneResIds(this.uneCase.getMyX());
this.bloquesSauvegardes = this.gameAcitivity.getLigneBloques(this.uneCase.getMyX());
} else {
this.resIdsSauvegardes = this.gameAcitivity.getColonneResIds(this.uneCase.getMyY());
this.bloquesSauvegardes = this.gameAcitivity.getColonneBloques(this.uneCase.getMyY());
}
this.isSauvegarde = true;
}
if (this.isHorizontal) {
int decalage = this.colonneCaseToucheeActuelle - this.uneCase.getMyY();
this.gameAcitivity.restoreLigne(this.uneCase.getMyX(), this.resIdsSauvegardes, this.bloquesSauvegardes);
this.gameAcitivity.decalerLigne(this.uneCase.getMyX(), decalage);
} else {
int decalage = this.ligneCaseToucheeActuelle - this.uneCase.getMyX();
this.gameAcitivity.restoreColonne(this.uneCase.getMyY(), this.resIdsSauvegardes, this.bloquesSauvegardes);
this.gameAcitivity.decalerColonne(this.uneCase.getMyY(), decalage);
}
}
} else if (action == MotionEvent.ACTION_UP) {
if (this.isHorizontal != null && this.isHorizontal) {
int decalage = this.colonneCaseToucheeActuelle - this.uneCase.getMyY();
if (this.isSauvegarde)
this.gameAcitivity.restoreLigne(this.uneCase.getMyX(), this.resIdsSauvegardes, this.bloquesSauvegardes);
this.gameAcitivity.decalerLigne(this.uneCase.getMyX(), decalage);
} else if (this.isHorizontal != null) {
int decalage = this.ligneCaseToucheeActuelle - this.uneCase.getMyX();
if (this.isSauvegarde)
this.gameAcitivity.restoreColonne(this.uneCase.getMyY(), this.resIdsSauvegardes, this.bloquesSauvegardes);
this.gameAcitivity.decalerColonne(this.uneCase.getMyY(), decalage);
}
this.gameAcitivity.effacerTousSurlignements();
} else if (action == MotionEvent.ACTION_CANCEL) {
if (this.isSauvegarde) {
if (this.isHorizontal != null && this.isHorizontal)
this.gameAcitivity.restoreLigne(this.uneCase.getMyX(), this.resIdsSauvegardes, this.bloquesSauvegardes);
else if (this.isHorizontal != null)
this.gameAcitivity.restoreColonne(this.uneCase.getMyY(), this.resIdsSauvegardes, this.bloquesSauvegardes);
}
this.gameAcitivity.effacerTousSurlignements();
}
return this.gestureDetector.onTouchEvent(event);
}
public void updatePosition(MotionEvent e2) {
int col = this.uneCase.getMyY() + (int) Math.floor(e2.getX() / this.uneCase.getCaseWidth());
int ligne = this.uneCase.getMyX() + (int) Math.floor(e2.getY() / this.uneCase.getCaseHeight());
this.colonneCaseToucheeActuelle = Math.max(0, Math.min(col, this.gameAcitivity.getNbCols() - 1));
this.ligneCaseToucheeActuelle = Math.max(0, Math.min(ligne, this.gameAcitivity.getNbLignes() - 1));
}
public void setOrientation(float distanceX, float distanceY) {
if (this.isHorizontal == null) {
boolean horizontal = Math.abs(distanceX) > Math.abs(distanceY);
if (horizontal && this.gameAcitivity.ligneEstBloquee(this.uneCase.getMyX()))
return;
if (!horizontal && this.gameAcitivity.colonneEstBloquee(this.uneCase.getMyY()))
return;
this.isHorizontal = horizontal;
if (horizontal)
this.gameAcitivity.surlignerLigne(this.uneCase.getMyX());
else
this.gameAcitivity.surlignerColonne(this.uneCase.getMyY());
}
if (this.isHorizontal) {
this.direction = distanceX > 0 ? Direction.GAUCHE : Direction.DROITE;
} else {
this.direction = distanceY > 0 ? Direction.HAUT : Direction.BAS;
}
debugAffichage();
}
public void debugAffichage() {
Log.d("blou", "Direction: " + this.direction + ", Ligne: " + this.ligneCaseToucheeActuelle + ", Colonne: " + this.colonneCaseToucheeActuelle);
}
}
@@ -0,0 +1,5 @@
package com.example.sae41_2025;
public enum Direction {
HAUT, BAS, GAUCHE, DROITE
}
@@ -0,0 +1,250 @@
package com.example.sae41_2025;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.GridLayout;
import android.util.Log;
import java.util.Random;
public class GameActivity extends Activity {
private int[] tiles = {R.drawable.tileblue, R.drawable.tilegreen, R.drawable.tilegrey, R.drawable.tileorange, R.drawable.tilepink, R.drawable.tilered, R.drawable.tileyellow};
private int NB_LIGNES = 6;
private int NB_COLS = 6;
private Case[][] cases;
private CaseEtat[][] etats; //les infos utiles en Serializable pour pouvoir les ranger dans intent ou bundle
private int score=0;
private int coup=1;
private String GRILLE_ETAT = "grille_etats";
private String TAG = "blou";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_jeu);
//mettre la grille carré peut import la taille de lecran
GridLayout grille = this.findViewById(R.id.grille);
grille.getLayoutParams().height = this.getResources().getDisplayMetrics().widthPixels;
grille.requestLayout();
this.cases = new Case[this.NB_LIGNES][this.NB_COLS];
this.etats = new CaseEtat[this.NB_LIGNES][this.NB_COLS];
CaseEtat[][] etatsRestores = null;
if (savedInstanceState != null) {
etatsRestores = (CaseEtat[][]) savedInstanceState.getSerializable(GRILLE_ETAT);
} else {
etatsRestores = (CaseEtat[][]) this.getIntent().getSerializableExtra(GRILLE_ETAT);
}
Random random = new Random();
Log.d(TAG, "créer grille");
//creer la grille soit en random (a modif!!!) soit en recuperant les infos de intent ou bundle
for (int ligne = 0; ligne < this.NB_LIGNES; ligne++) {
for (int col = 0; col < this.NB_COLS; col++) {
CaseEtat etat;
if (etatsRestores != null) {
etat = etatsRestores[ligne][col];
} else {
etat = new CaseEtat(this.tiles[random.nextInt(tiles.length)], random.nextInt(5) == 0);
}
this.etats[ligne][col] = etat;
Case cellule = new Case(this, etat.getTileResId(), ligne, col);
cellule.setBloque(etat.isBloque());
this.cases[ligne][col] = cellule;
GridLayout.LayoutParams cellParams = new GridLayout.LayoutParams();
cellParams.rowSpec = GridLayout.spec(ligne, 1, 1f);
cellParams.columnSpec = GridLayout.spec(col, 1, 1f);
cellParams.setMargins(4, 4, 4, 4);
cellParams.width = 0;
cellParams.height = 0;
grille.addView(cellule, cellParams);
}
}
}
public void decalerLigne(int ligne, int decalage) {
int n = this.NB_COLS;
decalage = (decalage + n) % n;
if (decalage == 0)
return;
int[] tmpRes = new int[n];
boolean[] tmpBloque = new boolean[n];
for (int col = 0; col < n; col++) {
int destination = (col + decalage) % n;
tmpRes[destination] = this.cases[ligne][col].getTileResId();
tmpBloque[destination] = this.cases[ligne][col].isBloque();
}
for (int col = 0; col < n; col++) {
this.cases[ligne][col].updateTile(tmpRes[col]);
this.cases[ligne][col].setBloque(tmpBloque[col]);
}
}
public void decalerColonne(int colonne, int decalage) {
int n = this.NB_LIGNES;
decalage = (decalage + n) % n;
if (decalage == 0) return;
int[] tmpRes = new int[n];
boolean[] tmpBloque = new boolean[n];
for (int ligne = 0; ligne < n; ligne++) {
int destination = (ligne + decalage) % n;
tmpRes[destination] = this.cases[ligne][colonne].getTileResId();
tmpBloque[destination] = this.cases[ligne][colonne].isBloque();
}
for (int ligne = 0; ligne < n; ligne++) {
this.cases[ligne][colonne].updateTile(tmpRes[ligne]);
this.cases[ligne][colonne].setBloque(tmpBloque[ligne]);
}
}
@Override
protected void onResume() {
super.onResume();
//ajout listener a chaque case
for (int ligne = 0; ligne < this.NB_LIGNES; ligne++) {
for (int col = 0; col < this.NB_COLS; col++) {
this.cases[ligne][col].setOnTouchListener(new CaseOnTouchListener(this, this.cases[ligne][col]));
}
}
}
@Override
protected void onPause() {
super.onPause();
//pause listener a chaque case
for (int ligne = 0; ligne < this.NB_LIGNES; ligne++) {
for (int col = 0; col < this.NB_COLS; col++) {
this.cases[ligne][col].setOnTouchListener(null);
}
}
}
@Override
public void onBackPressed() {
if (this.coup == 0) {
//si le joueur a pas commencer de partie -> on garde pas letat du jeu
super.onBackPressed();
return;
}
//recup les infos des cases pour intent
for (int ligne = 0; ligne < this.NB_LIGNES; ligne++) {
for (int col = 0; col < this.NB_COLS; col++) {
this.etats[ligne][col] = this.cases[ligne][col].toEtat();
}
}
Intent intent = new Intent();
intent.putExtra(GRILLE_ETAT, this.etats);
this.setResult(Activity.RESULT_OK, intent);
Log.d(TAG, "grille sauvegardée (onBackPressed)");
super.onBackPressed();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//recup les infos des cases pour Bundle
for (int ligne = 0; ligne < this.NB_LIGNES; ligne++) {
for (int col = 0; col < this.NB_COLS; col++) {
this.etats[ligne][col] = this.cases[ligne][col].toEtat();
}
}
outState.putSerializable(GRILLE_ETAT, this.etats);
Log.d(TAG, "grille sauvegardée (onSaveInstanceState)");
}
public int getNbLignes() {
return this.NB_LIGNES;
}
public int getNbCols() {
return this.NB_COLS;
}
public int[] getLigneResIds(int ligne) {
int[] res = new int[NB_COLS];
for (int col = 0; col < NB_COLS; col++) res[col] = this.cases[ligne][col].getTileResId();
return res;
}
public boolean[] getLigneBloques(int ligne) {
boolean[] b = new boolean[NB_COLS];
for (int col = 0; col < NB_COLS; col++) b[col] = this.cases[ligne][col].isBloque();
return b;
}
public int[] getColonneResIds(int colonne) {
int[] res = new int[NB_LIGNES];
for (int ligne = 0; ligne < NB_LIGNES; ligne++) res[ligne] = this.cases[ligne][colonne].getTileResId();
return res;
}
public boolean[] getColonneBloques(int colonne) {
boolean[] b = new boolean[NB_LIGNES];
for (int ligne = 0; ligne < NB_LIGNES; ligne++) b[ligne] = this.cases[ligne][colonne].isBloque();
return b;
}
public void surlignerLigne(int ligne) {
for (int col = 0; col < NB_COLS; col++)
this.cases[ligne][col].setSurlignee(true);
}
public void surlignerColonne(int colonne) {
for (int ligne = 0; ligne < NB_LIGNES; ligne++)
this.cases[ligne][colonne].setSurlignee(true);
}
public void effacerTousSurlignements() {
for (int ligne = 0; ligne < NB_LIGNES; ligne++)
for (int col = 0; col < NB_COLS; col++)
this.cases[ligne][col].setSurlignee(false);
}
public boolean ligneEstBloquee(int ligne) {
for (int col = 0; col < NB_COLS; col++) {
if (this.cases[ligne][col].isBloque())
return true;
}
return false;
}
public boolean colonneEstBloquee(int colonne) {
for (int ligne = 0; ligne < NB_LIGNES; ligne++) {
if (this.cases[ligne][colonne].isBloque())
return true;
}
return false;
}
public void restoreLigne(int ligne, int[] resIds, boolean[] bloques) {
for (int col = 0; col < NB_COLS; col++) {
this.cases[ligne][col].updateTile(resIds[col]);
this.cases[ligne][col].setBloque(bloques[col]);
}
}
public void restoreColonne(int colonne, int[] resIds, boolean[] bloques) {
for (int ligne = 0; ligne < NB_LIGNES; ligne++) {
this.cases[ligne][colonne].updateTile(resIds[ligne]);
this.cases[ligne][colonne].setBloque(bloques[ligne]);
}
}
}
@@ -0,0 +1,116 @@
package com.example.sae41_2025;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.util.Log;
public class MainActivity extends Activity {
public static final int INTENT_RESQUESTCODE = 1;
public static final String GRILLE_ETAT = "grille_etats";
private boolean difficulte = false;
private CaseEtat[][] grilleEnCours = null;
private RelativeLayout menuLayout;
private TextView textModeDifficile;
private Switch switchDifficile;
private LinearLayout btnLancerPartie;
private LinearLayout btnContinuerPartie;
private LinearLayout btnOublierPartie;
private LinearLayout btnLancerSeed;
private String TAG = "blou";
public void setDifficulte(boolean difficulte) {
this.difficulte = difficulte;
}
public CaseEtat[][] getGrilleEnCours() {
return this.grilleEnCours;
}
public RelativeLayout getMenuLayout() {
return this.menuLayout;
}
public Switch getSwitchDifficulte() {
return this.switchDifficile;
}
public void resetGrille() {
this.grilleEnCours = null;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
this.menuLayout = findViewById(R.id.relativeLayout);
this.switchDifficile = findViewById(R.id.switchModeDifficile);
this.textModeDifficile = findViewById(R.id.textModeDifficile);
this.btnLancerPartie = findViewById(R.id.btnLancerPartie);
this.btnLancerSeed = findViewById(R.id.btnLancerSeed);
this.btnContinuerPartie = findViewById(R.id.btnContinuerPartie);
this.btnOublierPartie = findViewById(R.id.btnOublierPartie);
actualiserBtnMenu();
}
@Override
protected void onResume() {
super.onResume();
this.switchDifficile.setOnCheckedChangeListener(new SwitchDifficulteeListener(this));
this.btnLancerPartie.setOnClickListener(new BtnLancerPartieListener(this));
this.btnContinuerPartie.setOnClickListener(new BtnContinuerPartieListener(this));
this.btnOublierPartie.setOnClickListener(new BtnOublierPartieListener(this));
}
@Override
protected void onPause() {
super.onPause();
this.switchDifficile.setOnCheckedChangeListener(null);
this.btnLancerPartie.setOnClickListener(null);
this.btnContinuerPartie.setOnClickListener(null);
this.btnOublierPartie.setOnClickListener(null);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == INTENT_RESQUESTCODE && resultCode == Activity.RESULT_OK && data != null) {
this.grilleEnCours = (CaseEtat[][]) data.getSerializableExtra(GRILLE_ETAT);
}
Log.d(TAG, "partie en cours recup (onActivityResult)");
actualiserBtnMenu();
}
public void actualiserBtnMenu() {
if (this.grilleEnCours != null) {
this.btnContinuerPartie.setVisibility(View.VISIBLE);
this.btnOublierPartie.setVisibility(View.VISIBLE);
this.btnLancerPartie.setVisibility(View.GONE);
this.btnLancerSeed.setVisibility(View.GONE);
this.textModeDifficile.setVisibility(View.GONE);
this.switchDifficile.setVisibility(View.GONE);
} else {
this.btnContinuerPartie.setVisibility(View.GONE);
this.btnOublierPartie.setVisibility(View.GONE);
this.btnLancerPartie.setVisibility(View.VISIBLE);
this.btnLancerSeed.setVisibility(View.VISIBLE);
this.textModeDifficile.setVisibility(View.VISIBLE);
this.switchDifficile.setVisibility(View.VISIBLE);
}
}
}
@@ -0,0 +1,25 @@
package com.example.sae41_2025;
import android.graphics.Color;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;
public class SwitchDifficulteeListener implements CompoundButton.OnCheckedChangeListener {
private MainActivity activity;
public SwitchDifficulteeListener(MainActivity activity) {
this.activity = activity;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
this.activity.setDifficulte(isChecked);
if (isChecked) {
this.activity.getMenuLayout().setBackgroundColor(Color.parseColor("#fff43c3c"));
} else {
this.activity.getMenuLayout().setBackgroundColor(Color.parseColor("#fffffbfb"));
}
}
}
@@ -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>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="24dp"
android:viewportWidth="12"
android:viewportHeight="24">
<path
android:fillColor="#029357"
android:pathData="M12,22 L12,24 Q7.05,24 3.5,20.45 0,16.95 0,12 0,7.05 3.5,3.5 7.05,0 12,0 L12,2 Q7.9,2 4.95,4.9 L4.9,4.95 Q2,7.9 2,12 2,16.1 4.95,19.05 7.9,22 12,22" />
<path
android:fillColor="#2FD792"
android:pathData="M12,22 Q7.9,22 4.95,19.05 2,16.1 2,12 2,7.9 4.9,4.95 L4.95,4.9 Q7.9,2 12,2 L12,4 Q8.7,4 6.35,6.35 4,8.7 4,12 4,15.3 6.35,17.6 L6.35,17.65 Q8.7,20 12,20 L12,22" />
<path
android:fillColor="#23CD87"
android:pathData="M12,4 L12,12 4,12 Q4,8.7 6.35,6.35 8.7,4 12,4" />
<path
android:fillColor="#16BB77"
android:pathData="M12,12 L12,20 Q8.7,20 6.35,17.65 L6.35,17.6 Q4,15.3 4,12 L12,12" />
</vector>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#029357"
android:pathData="M0,2 L0,0 24,0 24,2 0,2 M24,22 L24,24 0,24 0,22 24,22" />
<path
android:fillColor="#2FD792"
android:pathData="M24,22 L0,22 0,20 24,20 24,22 M24,2 L24,4 0,4 0,2 24,2" />
<path
android:fillColor="#16BB77"
android:pathData="M24,12 L24,20 0,20 0,12 24,12" />
<path
android:fillColor="#23CD87"
android:pathData="M24,12 L0,12 0,4 24,4 24,12" />
</vector>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="24dp"
android:viewportWidth="12"
android:viewportHeight="24">
<path
android:fillColor="#2FD792"
android:pathData="M0,2 Q4.1,2 7.05,4.9 L7.1,4.95 Q10,7.9 10,12 10,16.1 7.05,19.05 4.1,22 0,22 L0,20 Q3.3,20 5.65,17.65 L5.65,17.6 Q8,15.3 8,12 8,8.7 5.65,6.35 3.3,4 0,4 L0,2" />
<path
android:fillColor="#029357"
android:pathData="M0,2 L0,0 Q4.95,0 8.5,3.5 12,7.05 12,12 12,16.95 8.5,20.45 4.95,24 0,24 L0,22 Q4.1,22 7.05,19.05 10,16.1 10,12 10,7.9 7.1,4.95 L7.05,4.9 Q4.1,2 0,2" />
<path
android:fillColor="#23CD87"
android:pathData="M0,4 Q3.3,4 5.65,6.35 8,8.7 8,12 L0,12 0,4" />
<path
android:fillColor="#16BB77"
android:pathData="M8,12 Q8,15.3 5.65,17.6 L5.65,17.65 Q3.3,20 0,20 L0,12 8,12" />
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="16dp"
android:viewportWidth="8"
android:viewportHeight="16">
<path android:fillColor="#408b69"
android:pathData="M8,14L8,16 4,16Q0,16 0,12L0,4Q0,0 4,0L8,0 8,2 4,2Q2,2 2,4L2,12Q2,14 4,14L8,14Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M8,14L4,14Q2,14 2,12L2,4Q2,2 4,2L8,2 8,4 4,4 4,8 4,12 8,12 8,14Z"/>
<path android:fillColor="#95D5B2"
android:pathData="M8,8L8,12 4,12 4,8 8,8Z"/>
<path android:fillColor="#D8F3DC"
android:pathData="M8,8L4,8 4,4 8,4 8,8Z"/>
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path android:fillColor="#408b69"
android:pathData="M16,14L16,16 0,16 0,14 16,14M16,2L0,2 0,0 16,0 16,2Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M16,2L16,4 0,4 0,2 16,2M16,12L16,14 0,14 0,12 16,12Z"/>
<path android:fillColor="#95D5B2"
android:pathData="M16,12L0,12 0,8 16,8 16,12Z"/>
<path android:fillColor="#D8F3DC"
android:pathData="M16,4L16,8 0,8 0,4 16,4Z"/>
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="16dp"
android:viewportWidth="8"
android:viewportHeight="16">
<path android:fillColor="#408b69"
android:pathData="M0,2L0,0 4,0Q8,0 8,4L8,12Q8,16 4,16L0,16 0,14 4,14Q6,14 6,12L6,4Q6,2 4,2L0,2Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M0,2L4,2Q6,2 6,4L6,12Q6,14 4,14L0,14 0,12 4,12 4,8 4,4 0,4 0,2Z"/>
<path android:fillColor="#D8F3DC"
android:pathData="M0,8L0,4 4,4 4,8 0,8Z"/>
<path android:fillColor="#95D5B2"
android:pathData="M0,8L4,8 4,12 0,12 0,8Z"/>
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="16dp"
android:viewportWidth="8"
android:viewportHeight="16">
<path android:fillColor="#CFA020"
android:pathData="M8,14L8,16 4,16Q0,16 0,12L0,4Q0,0 4,0L8,0 8,2 4,2Q2,2 2,4L2,12Q2,14 4,14L8,14Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M8,14L4,14Q2,14 2,12L2,4Q2,2 4,2L8,2 8,4 4,4 4,8 4,12 8,12 8,14Z"/>
<path android:fillColor="#FFD166"
android:pathData="M8,8L8,12 4,12 4,8 8,8Z"/>
<path android:fillColor="#FFEDAD"
android:pathData="M8,8L4,8 4,4 8,4 8,8Z"/>
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path android:fillColor="#CFA020"
android:pathData="M16,14L16,16 0,16 0,14 16,14M16,2L0,2 0,0 16,0 16,2Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M16,2L16,4 0,4 0,2 16,2M16,12L16,14 0,14 0,12 16,12Z"/>
<path android:fillColor="#FFD166"
android:pathData="M16,12L0,12 0,8 16,8 16,12Z"/>
<path android:fillColor="#FFEDAD"
android:pathData="M16,4L16,8 0,8 0,4 16,4Z"/>
</vector>
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="16dp"
android:viewportWidth="8"
android:viewportHeight="16">
<path android:fillColor="#CFA020"
android:pathData="M0,2L0,0 4,0Q8,0 8,4L8,12Q8,16 4,16L0,16 0,14 4,14Q6,14 6,12L6,4Q6,2 4,2L0,2Z"/>
<path android:fillColor="#FFFFFF"
android:pathData="M0,2L4,2Q6,2 6,4L6,12Q6,14 4,14L0,14 0,12 4,12 4,8 4,4 0,4 0,2Z"/>
<path android:fillColor="#FFEDAD"
android:pathData="M0,8L0,4 4,4 4,8 0,8Z"/>
<path android:fillColor="#FFD166"
android:pathData="M0,8L4,8 4,12 0,12 0,8Z"/>
</vector>
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:fillColor="#000000"
android:pathData="M4,25.2 L4,16.9 L4,16.8 Q4.05,14.15 6,13.35 L6,12.7 Q6.1,8.75 8.95,5.95 Q11.85,3 16,3 Q20.15,3 23.1,5.95 Q25.9,8.75 26,12.7 L26,13.35 Q27.9,14.15 28,16.8 L28,16.9 L28,25.2 Q27.95,26.95 27.05,27.85 L27,27.95 Q26.05,29 24,29 L8,29 Q6.05,29 5.1,27.95 Q4.05,27 4,25.2 M24,15 L24,12.75 Q23.9,9.6 21.65,7.35 Q19.3,5 16,5 Q12.7,5 10.35,7.35 Q8.1,9.6 8,12.75 L8,15 Q6.05,15 6,16.9 L6,25.15 Q6.05,26.05 6.5,26.5 Q7,27 8,27 L24,27 Q25.05,27 25.55,26.5 Q25.95,26.05 26,25.15 L26,16.9 Q25.95,15.05 24.15,15 L24,15 M12,15 L12,12.9 Q12.05,11.3 13.15,10.2 L13.2,10.15 Q14.35,9 16,9 Q17.65,9 18.85,10.2 Q19.95,11.3 20,12.9 L20,15 L12,15 M16,17 Q17.05,17 17.75,17.75 Q18.5,18.5 18.5,19.5 Q18.5,20.55 17.8,21.25 L17.75,21.3 L17.25,21.7 L17.1,21.9 L17,22.1 L17,23.9 Q16.7,24.6 16,24.9 Q15.3,24.6 15,23.9 L15,22.1 L14.95,21.9 L14.8,21.7 L14.25,21.25 Q13.5,20.55 13.5,19.5 Q13.5,18.5 14.25,17.75 Q15,17 16,17" />
<path
android:fillColor="#DDDDDD"
android:pathData="M8,15 L8,12.75 Q8.1,9.6 10.35,7.35 Q12.7,5 16,5 Q19.3,5 21.65,7.35 Q23.9,9.6 24,12.75 L24,15 L20,15 L20,12.9 Q19.95,11.3 18.85,10.2 Q17.65,9 16,9 Q14.35,9 13.2,10.15 L13.15,10.2 Q12.05,11.3 12,12.9 L12,15 L8,15" />
<path
android:fillColor="#FFFFFF"
android:pathData="M8,15 L12,15 L20,15 L24,15 L24.15,15 Q25.95,15.05 26,16.9 L26,25.15 Q25.95,26.05 25.55,26.5 Q25.05,27 24,27 L8,27 Q7,27 6.5,26.5 Q6.05,26.05 6,25.15 L6,16.9 Q6.05,15 8,15 M16,17 Q15,17 14.25,17.75 Q13.5,18.5 13.5,19.5 Q13.5,20.55 14.25,21.25 L14.8,21.7 L14.95,21.9 L15,22.1 L15,23.9 Q15,24.3 15.3,24.6 L16,24.9 L16.7,24.6 L17,23.9 L17,22.1 L17.1,21.9 L17.25,21.7 L17.75,21.3 L17.8,21.25 Q18.5,20.55 18.5,19.5 Q18.5,18.5 17.75,17.75 Q17.05,17 16,17" />
</vector>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="24dp"
android:viewportWidth="12"
android:viewportHeight="24">
<path
android:fillColor="#FF627B"
android:pathData="M12,2 L12,4 Q8.7,4 6.35,6.35 4,8.7 4,12 4,15.3 6.35,17.6 L6.35,17.65 Q8.7,20 12,20 L12,22 Q7.9,22 4.95,19.05 2,16.1 2,12 2,7.9 4.9,4.95 L4.95,4.9 Q7.9,2 12,2" />
<path
android:fillColor="#F73F5D"
android:pathData="M12,4 L12,12 4,12 Q4,8.7 6.35,6.35 8.7,4 12,4" />
<path
android:fillColor="#CD0B2A"
android:pathData="M12,22 L12,24 Q7.05,24 3.5,20.45 0,16.95 0,12 0,7.05 3.5,3.5 7.05,0 12,0 L12,2 Q7.9,2 4.95,4.9 L4.9,4.95 Q2,7.9 2,12 2,16.1 4.95,19.05 7.9,22 12,22" />
<path
android:fillColor="#EE2747"
android:pathData="M12,12 L12,20 Q8.7,20 6.35,17.65 L6.35,17.6 Q4,15.3 4,12 L12,12" />
</vector>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF627B"
android:pathData="M24,2 L24,4 0,4 0,2 24,2 M24,20 L24,22 0,22 0,20 24,20" />
<path
android:fillColor="#CD0B2A"
android:pathData="M0,2 L0,0 24,0 24,2 0,2 M24,22 L24,24 0,24 0,22 24,22" />
<path
android:fillColor="#EE2747"
android:pathData="M24,12 L24,20 0,20 0,12 24,12" />
<path
android:fillColor="#F73F5D"
android:pathData="M24,12 L0,12 0,4 24,4 24,12" />
</vector>
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="24dp"
android:viewportWidth="12"
android:viewportHeight="24">
<path
android:fillColor="#FF627B"
android:pathData="M0,2 Q4.1,2 7.05,4.9 L7.1,4.95 Q10,7.9 10,12 10,16.1 7.05,19.05 4.1,22 0,22 L0,20 Q3.3,20 5.65,17.65 L5.65,17.6 Q8,15.3 8,12 8,8.7 5.65,6.35 3.3,4 0,4 L0,2" />
<path
android:fillColor="#CD0B2A"
android:pathData="M0,2 L0,0 Q4.95,0 8.5,3.5 12,7.05 12,12 12,16.95 8.5,20.45 4.95,24 0,24 L0,22 Q4.1,22 7.05,19.05 10,16.1 10,12 10,7.9 7.1,4.95 L7.05,4.9 Q4.1,2 0,2" />
<path
android:fillColor="#F73F5D"
android:pathData="M0,4 Q3.3,4 5.65,6.35 8,8.7 8,12 L0,12 0,4" />
<path
android:fillColor="#EE2747"
android:pathData="M8,12 Q8,15.3 5.65,17.6 L5.65,17.65 Q3.3,20 0,20 L0,12 8,12" />
</vector>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F5F5F5">
<LinearLayout
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal"
android:padding="12dp"
android:gravity="center"
android:background="#FFFFFF">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginEnd="16dp">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greensquarebar1"
android:scaleType="fitXY" />
<TextView
android:id="@+id/scoreText"
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Coups : ???"
android:textColor="#333333"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/greensquarebar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greensquarebar3"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greysquarebar1"
android:scaleType="fitXY" />
<TextView
android:id="@+id/scoreText"
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Score : ???"
android:textColor="#333333"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/greysquarebar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greysquarebar3"
android:scaleType="fitXY" />
</LinearLayout>
</LinearLayout>
<GridLayout
android:id="@+id/grille"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E8EAF6"
android:padding="8dp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3" />
</LinearLayout>
@@ -0,0 +1,380 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fffbfbff">
<ImageView
android:layout_width="52dp"
android:layout_height="52dp"
android:src="@drawable/tileblue"
android:rotation="-8"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="14dp"
android:layout_marginStart="16dp"
android:alpha="0.85" />
<ImageView
android:layout_width="34dp"
android:layout_height="34dp"
android:src="@drawable/tilepink"
android:rotation="37"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="95dp"
android:layout_marginStart="62dp"
android:alpha="0.65" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/tilegreen"
android:rotation="-32"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="42dp"
android:layout_marginEnd="30dp"
android:alpha="0.8" />
<ImageView
android:layout_width="46dp"
android:layout_height="46dp"
android:src="@drawable/tileorange"
android:rotation="14"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="110dp"
android:layout_marginEnd="8dp"
android:alpha="0.7" />
<ImageView
android:layout_width="38dp"
android:layout_height="38dp"
android:src="@drawable/tileyellow"
android:rotation="-42"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="18dp"
android:layout_marginTop="280dp"
android:alpha="0.7" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/tilered"
android:rotation="7"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="16dp"
android:layout_marginTop="350dp"
android:alpha="0.75" />
<ImageView
android:layout_width="44dp"
android:layout_height="44dp"
android:src="@drawable/tilepink"
android:rotation="28"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="55dp"
android:layout_marginStart="40dp"
android:alpha="0.8" />
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/tilegreen"
android:rotation="-5"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="140dp"
android:layout_marginStart="18dp"
android:alpha="0.6" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/tileblue"
android:rotation="-35"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="10dp"
android:layout_marginEnd="45dp"
android:alpha="0.85" />
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/tileyellow"
android:rotation="19"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="105dp"
android:layout_marginEnd="15dp"
android:alpha="0.65" />
<ImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:src="@drawable/tilered"
android:rotation="-12"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="16dp"
android:layout_marginStart="120dp"
android:alpha="0.7" />
<ImageView
android:layout_width="37dp"
android:layout_height="37dp"
android:src="@drawable/tileorange"
android:rotation="45"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="18dp"
android:layout_marginStart="16dp"
android:alpha="0.75" />
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:src="@drawable/tilegrey"
android:rotation="-27"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="190dp"
android:layout_marginStart="55dp"
android:alpha="0.55" />
<ImageView
android:layout_width="41dp"
android:layout_height="41dp"
android:src="@drawable/tilegrey"
android:rotation="16"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="200dp"
android:layout_marginEnd="18dp"
android:alpha="0.5" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="32dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chuzzle"
android:textSize="42sp"
android:textColor="#333333"
android:fontFamily="sans-serif-bold"
android:layout_marginBottom="48dp" />
<LinearLayout
android:id="@+id/btnContinuerPartie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:visibility="gone">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar1"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Continuer la partie en cours"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/greenbar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar3"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:id="@+id/btnOublierPartie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:visibility="gone">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/redbar1"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Oublier la partie en cours"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/redbar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/redbar3"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:id="@+id/btnLancerPartie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar1"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Lancer une partie"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/greenbar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar3"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:id="@+id/btnLancerSeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar1"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Lancer avec seed"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/greenbar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/greenbar3"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp">
<TextView
android:id="@+id/textModeDifficile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mode difficile"
android:textColor="#333333"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:layout_marginEnd="12dp" />
<Switch
android:id="@+id/switchModeDifficile"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/btnQuitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="16dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/redbar1"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="38dp"
android:text="Quitter"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:background="@drawable/redbar2" />
<ImageView
android:layout_width="16dp"
android:layout_height="38dp"
android:src="@drawable/redbar3"
android:scaleType="fitXY" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Some files were not shown because too many files have changed in this diff Show More