debut de la SAE
1
Flow_Free/app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
40
Flow_Free/app/build.gradle.kts
Normal file
@@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.flow_free"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.flow_free"
|
||||
minSdk = 19
|
||||
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.material)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
}
|
||||
21
Flow_Free/app/proguard-rules.pro
vendored
Normal 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.flow_free;
|
||||
|
||||
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.flow_free", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
17
Flow_Free/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.flow_free">
|
||||
|
||||
<application
|
||||
android:allowBackup="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".GameActivity"/>
|
||||
<activity android:name=".SettingsActivity"/>
|
||||
</application>
|
||||
</manifest>
|
||||
57
Flow_Free/app/src/main/assets/puzzles/puzzle10.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<puzzle size="10" nom="Puzzle Taille 10">
|
||||
<!-- rouge-->
|
||||
<paire>
|
||||
<point colonne="0" ligne="9" />
|
||||
<point colonne="9" ligne="1" />
|
||||
</paire>
|
||||
<!-- orange-->
|
||||
<paire>
|
||||
<point colonne="1" ligne="8" />
|
||||
<point colonne="5" ligne="7" />
|
||||
</paire>
|
||||
<!-- cyan-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="9" />
|
||||
<point colonne="9" ligne="9" />
|
||||
</paire>
|
||||
<!-- jaune-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="8" />
|
||||
<point colonne="9" ligne="8" />
|
||||
</paire>
|
||||
<!-- bleu-->
|
||||
<paire>
|
||||
<point colonne="3" ligne="3" />
|
||||
<point colonne="7" ligne="7" />
|
||||
</paire>
|
||||
<!-- rose-->
|
||||
<paire>
|
||||
<point colonne="7" ligne="6" />
|
||||
<point colonne="6" ligne="5" />
|
||||
</paire>
|
||||
<!-- vert clair-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="7" />
|
||||
<point colonne="8" ligne="1" />
|
||||
</paire>
|
||||
<!-- violet-->
|
||||
<paire>
|
||||
<point colonne="2" ligne="6" />
|
||||
<point colonne="4" ligne="7" />
|
||||
</paire>
|
||||
<!-- vert-->
|
||||
<paire>
|
||||
<point colonne="4" ligne="8" />
|
||||
<point colonne="5" ligne="6" />
|
||||
</paire>
|
||||
<!-- vert foncé-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="4" />
|
||||
<point colonne="7" ligne="5" />
|
||||
</paire>
|
||||
<!-- rose pastel-->
|
||||
<paire>
|
||||
<point colonne="2" ligne="1" />
|
||||
<point colonne="1" ligne="4" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
46
Flow_Free/app/src/main/assets/puzzles/puzzle11.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<puzzle size="11" nom="Puzzle Taille 11">
|
||||
<paire> <!-- rose pastel -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="0" ligne="3" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="0" ligne="5" />
|
||||
<point colonne="1" ligne="1" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="10" />
|
||||
<point colonne="7" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="1" ligne="0" />
|
||||
<point colonne="10" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="2" ligne="2" />
|
||||
<point colonne="9" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="3" ligne="2" />
|
||||
<point colonne="3" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="2" ligne="6" />
|
||||
<point colonne="2" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="1" ligne="9" />
|
||||
<point colonne="2" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="1" ligne="10" />
|
||||
<point colonne="10" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="3" ligne="9" />
|
||||
<point colonne="4" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="5" ligne="5" />
|
||||
<point colonne="9" ligne="8" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
47
Flow_Free/app/src/main/assets/puzzles/puzzle12.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<puzzle size="12" nom="Puzzle Taille 12">
|
||||
<paire> <!-- rose pastel -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="0" ligne="4" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="1" ligne="1" />
|
||||
<point colonne="2" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="11" />
|
||||
<point colonne="7" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="2" ligne="0" />
|
||||
<point colonne="11" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="3" ligne="3" />
|
||||
<point colonne="10" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="4" ligne="3" />
|
||||
<point colonne="4" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="3" ligne="7" />
|
||||
<point colonne="3" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="2" ligne="10" />
|
||||
<point colonne="3" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="1" ligne="11" />
|
||||
<point colonne="11" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="5" ligne="10" />
|
||||
<point colonne="6" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="6" ligne="5" />
|
||||
<point colonne="10" ligne="9" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
|
||||
50
Flow_Free/app/src/main/assets/puzzles/puzzle13.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<puzzle size="13" nom="Puzzle Taille 13">
|
||||
<paire> <!-- rose pastel -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="0" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="2" ligne="1" />
|
||||
<point colonne="1" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="12" />
|
||||
<point colonne="8" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="3" ligne="0" />
|
||||
<point colonne="12" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="4" ligne="4" />
|
||||
<point colonne="11" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="5" ligne="4" />
|
||||
<point colonne="5" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="4" ligne="8" />
|
||||
<point colonne="4" ligne="11" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="3" ligne="11" />
|
||||
<point colonne="4" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="2" ligne="12" />
|
||||
<point colonne="12" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="6" ligne="11" />
|
||||
<point colonne="7" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="7" ligne="6" />
|
||||
<point colonne="11" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- turquoise -->
|
||||
<point colonne="6" ligne="3" />
|
||||
<point colonne="10" ligne="7" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
54
Flow_Free/app/src/main/assets/puzzles/puzzle14.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<puzzle size="14" nom="Puzzle Taille 14">
|
||||
<paire> <!-- rose pastel -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="0" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="3" ligne="1" />
|
||||
<point colonne="1" ligne="7" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="13" />
|
||||
<point colonne="9" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="4" ligne="0" />
|
||||
<point colonne="13" ligne="9" />
|
||||
</paire>
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="5" ligne="5" />
|
||||
<point colonne="12" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="6" ligne="5" />
|
||||
<point colonne="6" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="5" ligne="9" />
|
||||
<point colonne="5" ligne="12" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="4" ligne="12" />
|
||||
<point colonne="5" ligne="10" />
|
||||
</paire>
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="3" ligne="13" />
|
||||
<point colonne="13" ligne="11" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="7" ligne="12" />
|
||||
<point colonne="8" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="9" ligne="7" />
|
||||
<point colonne="12" ligne="11" />
|
||||
</paire>
|
||||
<paire> <!-- turquoise -->
|
||||
<point colonne="6" ligne="3" />
|
||||
<point colonne="11" ligne="8" />
|
||||
</paire>
|
||||
<paire> <!-- marron -->
|
||||
<point colonne="8" ligne="5" />
|
||||
<point colonne="10" ligne="6" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
18
Flow_Free/app/src/main/assets/puzzles/puzzle5.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<puzzle size="5" nom="Puzzle Taille 5">
|
||||
<paire> <!-- marron -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="3" ligne="3" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="2" ligne="0" />
|
||||
<point colonne="2" ligne="2" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="0" ligne="1" />
|
||||
<point colonne="1" ligne="3" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="0" ligne="3" />
|
||||
<point colonne="1" ligne="4" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
23
Flow_Free/app/src/main/assets/puzzles/puzzle6.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<puzzle size="6" nom="Puzzle Taille 6">
|
||||
<paire> <!-- marron -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="3" ligne="2" />
|
||||
</paire>
|
||||
<paire> <!-- rose -->
|
||||
<point colonne="0" ligne="1" />
|
||||
<point colonne="2" ligne="4" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="0" ligne="2" />
|
||||
<point colonne="4" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="3" ligne="1" />
|
||||
<point colonne="5" ligne="2" />
|
||||
</paire>
|
||||
<paire> <!-- vert -->
|
||||
<point colonne="3" ligne="4" />
|
||||
<point colonne="5" ligne="5" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
|
||||
34
Flow_Free/app/src/main/assets/puzzles/puzzle7.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<puzzle size="7" nom="Puzzle Taille 7">
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="0" ligne="0" />
|
||||
<point colonne="6" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="5" ligne="0" />
|
||||
<point colonne="6" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="0" ligne="3" />
|
||||
<point colonne="3" ligne="1" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="0" ligne="5" />
|
||||
<point colonne="3" ligne="2" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="2" ligne="3" />
|
||||
<point colonne="3" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="1" ligne="5" />
|
||||
<point colonne="2" ligne="4" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="6" />
|
||||
<point colonne="4" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="4" ligne="2" />
|
||||
<point colonne="4" ligne="5" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
34
Flow_Free/app/src/main/assets/puzzles/puzzle8.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<puzzle size="8" nom="Puzzle Taille 8">
|
||||
<paire> <!-- vert clair -->
|
||||
<point colonne="1" ligne="1" />
|
||||
<point colonne="7" ligne="3" />
|
||||
</paire>
|
||||
<paire> <!-- bleu -->
|
||||
<point colonne="0" ligne="2" />
|
||||
<point colonne="2" ligne="1" />
|
||||
</paire>
|
||||
<paire> <!-- jaune -->
|
||||
<point colonne="0" ligne="5" />
|
||||
<point colonne="4" ligne="1" />
|
||||
</paire>
|
||||
<paire> <!-- cyan -->
|
||||
<point colonne="0" ligne="6" />
|
||||
<point colonne="3" ligne="4" />
|
||||
</paire>
|
||||
<paire> <!-- rouge -->
|
||||
<point colonne="0" ligne="7" />
|
||||
<point colonne="3" ligne="5" />
|
||||
</paire>
|
||||
<paire> <!-- orange -->
|
||||
<point colonne="6" ligne="1" />
|
||||
<point colonne="3" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="4" ligne="4" />
|
||||
<point colonne="6" ligne="6" />
|
||||
</paire>
|
||||
<paire> <!-- violet -->
|
||||
<point colonne="5" ligne="1" />
|
||||
<point colonne="6" ligne="5" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
51
Flow_Free/app/src/main/assets/puzzles/puzzle9.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<puzzle size="9" nom="Puzzle Taille 9">
|
||||
<paire> <!-- vert foncé -->
|
||||
<point colonne="0" ligne="5" />
|
||||
<point colonne="4" ligne="7" />
|
||||
</paire>
|
||||
<!-- orange-->
|
||||
<paire>
|
||||
<point colonne="3" ligne="7" />
|
||||
<point colonne="7" ligne="8" />
|
||||
</paire>
|
||||
<!-- jaune-->
|
||||
<paire>
|
||||
<point colonne="1" ligne="3" />
|
||||
<point colonne="2" ligne="6" />
|
||||
</paire>
|
||||
<!-- bleu-->
|
||||
<paire>
|
||||
<point colonne="1" ligne="1" />
|
||||
<point colonne="4" ligne="3" />
|
||||
</paire>
|
||||
<!-- vert foncé-->
|
||||
<paire>
|
||||
<point colonne="2" ligne="1" />
|
||||
<point colonne="5" ligne="1" />
|
||||
</paire>
|
||||
<!-- vert clair-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="1" />
|
||||
<point colonne="3" ligne="3" />
|
||||
</paire>
|
||||
<!-- rose-->
|
||||
<paire>
|
||||
<point colonne="7" ligne="1" />
|
||||
<point colonne="7" ligne="3" />
|
||||
</paire>
|
||||
<!-- cyan-->
|
||||
<paire>
|
||||
<point colonne="6" ligne="3" />
|
||||
<point colonne="6" ligne="8" />
|
||||
</paire>
|
||||
<!-- violet-->
|
||||
<paire>
|
||||
<point colonne="3" ligne="5" />
|
||||
<point colonne="6" ligne="6" />
|
||||
</paire>
|
||||
<!-- rouge-->
|
||||
<paire>
|
||||
<point colonne="3" ligne="6" />
|
||||
<point colonne="5" ligne="8" />
|
||||
</paire>
|
||||
</puzzle>
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FlowFreeView extends View {
|
||||
private final Puzzle puzzle;
|
||||
private final Paint paint = new Paint();
|
||||
private final int[][] board;
|
||||
private final Map<Integer, List<int[]>> paths = new HashMap<>();
|
||||
|
||||
private int selectedColor = 0;
|
||||
private int cellSize;
|
||||
|
||||
public FlowFreeView(Context context, Puzzle puzzle) {
|
||||
super(context);
|
||||
this.puzzle = puzzle;
|
||||
this.board = new int[puzzle.getSize()][puzzle.getSize()];
|
||||
|
||||
// Initialisation du board avec les points du puzzle
|
||||
for (int[] pair : puzzle.getPairs()) {
|
||||
int col1 = pair[0];
|
||||
int row1 = pair[1];
|
||||
int col2 = pair[2];
|
||||
int row2 = pair[3];
|
||||
|
||||
// Crée une couleur id unique pour chaque paire (1, 2, 3, ...)
|
||||
int colorId = col1 * puzzle.getSize() + row1 + 1;
|
||||
board[row1][col1] = colorId;
|
||||
board[row2][col2] = colorId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
paint.setStrokeWidth(4);
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setColor(Color.BLACK);
|
||||
|
||||
// Affiche la grille
|
||||
for (int i = 0; i <= puzzle.getSize(); i++) {
|
||||
canvas.drawLine(i * cellSize, 0, i * cellSize, puzzle.getSize() * cellSize, paint);
|
||||
canvas.drawLine(0, i * cellSize, puzzle.getSize() * cellSize, i * cellSize, paint);
|
||||
}
|
||||
|
||||
// Affiche les points de couleur
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
for (int row = 0; row < puzzle.getSize(); row++) {
|
||||
for (int col = 0; col < puzzle.getSize(); col++) {
|
||||
int colorId = board[row][col];
|
||||
if (colorId != 0) {
|
||||
paint.setColor(getColorForId(colorId));
|
||||
float cx = col * cellSize + cellSize / 2f;
|
||||
float cy = row * cellSize + cellSize / 2f;
|
||||
canvas.drawCircle(cx, cy, cellSize / 4f, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Affiche les chemins tracés
|
||||
paint.setStrokeWidth(cellSize / 4f);
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
for (Map.Entry<Integer, List<int[]>> entry : paths.entrySet()) {
|
||||
paint.setColor(getColorForId(entry.getKey()));
|
||||
List<int[]> path = entry.getValue();
|
||||
for (int i = 0; i < path.size() - 1; i++) {
|
||||
int[] p1 = path.get(i);
|
||||
int[] p2 = path.get(i + 1);
|
||||
canvas.drawLine(
|
||||
p1[1] * cellSize + cellSize / 2f, p1[0] * cellSize + cellSize / 2f,
|
||||
p2[1] * cellSize + cellSize / 2f, p2[0] * cellSize + cellSize / 2f,
|
||||
paint
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
int col = (int) (event.getX() / cellSize);
|
||||
int row = (int) (event.getY() / cellSize);
|
||||
|
||||
if (col < 0 || row < 0 || col >= puzzle.getSize() || row >= puzzle.getSize())
|
||||
return false;
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
int colorAtCell = board[row][col];
|
||||
if (colorAtCell != 0) {
|
||||
selectedColor = colorAtCell;
|
||||
if (!paths.containsKey(selectedColor)) {
|
||||
paths.put(selectedColor, new ArrayList<>());
|
||||
}
|
||||
// Si on relâche et reprend depuis la dernière case
|
||||
List<int[]> path = paths.get(selectedColor);
|
||||
if (path.isEmpty() || (path.get(path.size() - 1)[0] != row || path.get(path.size() - 1)[1] != col)) {
|
||||
path.add(new int[]{row, col});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (selectedColor != 0) {
|
||||
List<int[]> path = paths.get(selectedColor);
|
||||
int[] last = path.get(path.size() - 1);
|
||||
if (last[0] != row || last[1] != col) {
|
||||
path.add(new int[]{row, col});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
selectedColor = 0; // Permet de reprendre à la prochaine touche
|
||||
break;
|
||||
}
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private int getColorForId(int id) {
|
||||
// Associe une couleur différente à chaque id unique
|
||||
int[] colors = {Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN, Color.DKGRAY, Color.rgb(139, 69, 19)}; // Marron inclus
|
||||
return colors[(id - 1) % colors.length];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class GameActivity extends Activity {
|
||||
private FlowFreeView flowFreeView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String puzzleFile = getIntent().getStringExtra("PUZZLE_FILE");
|
||||
Puzzle puzzle = PuzzleLoader.loadPuzzle(this, puzzleFile);
|
||||
|
||||
if (puzzle == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
FlowFreeView flowFreeView = new FlowFreeView(this, puzzle);
|
||||
setContentView(flowFreeView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// MainActivity.java
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private ListView puzzleListView;
|
||||
private Button settingsButton;
|
||||
private List<String> puzzleList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// Préférences
|
||||
SharedPreferences preferences = getSharedPreferences("FlowFreePrefs", MODE_PRIVATE);
|
||||
|
||||
// Initialisation des vues
|
||||
puzzleListView = findViewById(R.id.puzzle_list_view);
|
||||
settingsButton = findViewById(R.id.settings_button);
|
||||
|
||||
// Chargement des puzzles depuis assets/puzzles
|
||||
try {
|
||||
puzzleList = new ArrayList<>(Arrays.asList(getAssets().list("puzzles")));
|
||||
} catch (IOException e) {
|
||||
puzzleList = new ArrayList<>();
|
||||
}
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, puzzleList);
|
||||
puzzleListView.setAdapter(adapter);
|
||||
|
||||
// Click sur un puzzle
|
||||
puzzleListView.setOnItemClickListener((parent, view, position, id) -> {
|
||||
String selectedPuzzle = puzzleList.get(position);
|
||||
if (!selectedPuzzle.endsWith(".xml")) {
|
||||
Toast.makeText(this, "Puzzle invalide", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(MainActivity.this, GameActivity.class);
|
||||
intent.putExtra("PUZZLE_FILE", selectedPuzzle);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
// Bouton paramètres
|
||||
settingsButton.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Puzzle.java
|
||||
package com.example.flow_free;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Puzzle {
|
||||
private int size;
|
||||
private String name;
|
||||
private List<int[]> pairs;
|
||||
|
||||
public Puzzle(int size, String name, List<int[]> pairs) {
|
||||
this.size = size;
|
||||
this.name = name;
|
||||
this.pairs = pairs;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<int[]> getPairs() {
|
||||
return pairs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class PuzzleLoader {
|
||||
|
||||
public static Puzzle loadPuzzle(Context context, String filename) {
|
||||
// Charge le puzzle via le parser et retourne l'objet Puzzle
|
||||
return PuzzleParser.parsePuzzle(context, filename);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PuzzleParser {
|
||||
|
||||
public static Puzzle parsePuzzle(Context context, String filename) {
|
||||
AssetManager assetManager = context.getAssets();
|
||||
|
||||
try {
|
||||
InputStream inputStream = assetManager.open("puzzles/" + filename);
|
||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setInput(inputStream, "UTF-8");
|
||||
|
||||
int size = -1;
|
||||
String name = filename.replace(".xml", "");
|
||||
List<int[]> pairs = new ArrayList<>();
|
||||
int[] currentPair = new int[4];
|
||||
int pointIndex = 0;
|
||||
|
||||
int eventType = parser.getEventType();
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
String tagName = parser.getName();
|
||||
if (tagName.equals("puzzle")) {
|
||||
size = Integer.parseInt(parser.getAttributeValue(null, "size"));
|
||||
if (parser.getAttributeValue(null, "nom") != null) {
|
||||
name = parser.getAttributeValue(null, "nom");
|
||||
}
|
||||
} else if (tagName.equals("point")) {
|
||||
int col = Integer.parseInt(parser.getAttributeValue(null, "colonne"));
|
||||
int row = Integer.parseInt(parser.getAttributeValue(null, "ligne"));
|
||||
currentPair[pointIndex * 2] = col;
|
||||
currentPair[pointIndex * 2 + 1] = row;
|
||||
pointIndex++;
|
||||
if (pointIndex == 2) {
|
||||
pairs.add(new int[]{currentPair[0], currentPair[1], currentPair[2], currentPair[3]});
|
||||
currentPair = new int[4];
|
||||
pointIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
|
||||
return new Puzzle(size, name, pairs);
|
||||
} catch (IOException | XmlPullParserException | NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
170
Flow_Free/app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -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>
|
||||
18
Flow_Free/app/src/main/res/layout/activity_game.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.example.flow_free.FlowFreeView
|
||||
android:id="@+id/game_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Retour"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
</FrameLayout>
|
||||
37
Flow_Free/app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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:padding="16dp">
|
||||
|
||||
<!-- Titre du jeu -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Flow Free"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="16dp"/>
|
||||
|
||||
<!-- Liste des puzzles -->
|
||||
<ListView
|
||||
android:id="@+id/puzzle_list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@android:color/darker_gray"
|
||||
android:dividerHeight="1dp"/>
|
||||
|
||||
<!-- Bouton Paramètres -->
|
||||
<Button
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Paramètres"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="10dp"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
10
Flow_Free/app/src/main/res/layout/activity_settings.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="achromate_mode"
|
||||
android:title="Mode Achromate"
|
||||
android:summary="Activer le mode achromate (tons de gris)"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -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>
|
||||
BIN
Flow_Free/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
Flow_Free/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
Flow_Free/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
7
Flow_Free/app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Flow_Free" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
5
Flow_Free/app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
3
Flow_Free/app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Flow_Free</string>
|
||||
</resources>
|
||||
9
Flow_Free/app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Flow_Free" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Flow_Free" parent="Base.Theme.Flow_Free" />
|
||||
</resources>
|
||||
13
Flow_Free/app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
Flow_Free/app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
7
Flow_Free/app/src/main/res/xml/preferences.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<CheckBoxPreference
|
||||
android:key="achromate_mode"
|
||||
android:title="Mode Achromate"
|
||||
android:summary="Activer le mode achromate (tons de gris)"
|
||||
android:defaultValue="false"/>
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.flow_free;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||