diff --git a/Flow_Free/.idea/AndroidProjectSystem.xml b/Flow_Free/.idea/AndroidProjectSystem.xml
new file mode 100644
index 0000000..4a53bee
--- /dev/null
+++ b/Flow_Free/.idea/AndroidProjectSystem.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Flow_Free/.idea/compiler.xml b/Flow_Free/.idea/compiler.xml
index b589d56..b86273d 100644
--- a/Flow_Free/.idea/compiler.xml
+++ b/Flow_Free/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Flow_Free/.idea/gradle.xml b/Flow_Free/.idea/gradle.xml
index 0897082..639c779 100644
--- a/Flow_Free/.idea/gradle.xml
+++ b/Flow_Free/.idea/gradle.xml
@@ -4,6 +4,7 @@
-
diff --git a/Flow_Free/.idea/misc.xml b/Flow_Free/.idea/misc.xml
index 8978d23..74dd639 100644
--- a/Flow_Free/.idea/misc.xml
+++ b/Flow_Free/.idea/misc.xml
@@ -1,6 +1,7 @@
+
-
+
diff --git a/Flow_Free/.idea/other.xml b/Flow_Free/.idea/other.xml
deleted file mode 100644
index 22069ff..0000000
--- a/Flow_Free/.idea/other.xml
+++ /dev/null
@@ -1,549 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Flow_Free/.idea/runConfigurations.xml b/Flow_Free/.idea/runConfigurations.xml
new file mode 100644
index 0000000..16660f1
--- /dev/null
+++ b/Flow_Free/.idea/runConfigurations.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Flow_Free/app/src/main/java/com/example/flow_free/MainActivity.java b/Flow_Free/app/src/main/java/com/example/flow_free/MainActivity.java
index fadef6b..4f0c6c9 100644
--- a/Flow_Free/app/src/main/java/com/example/flow_free/MainActivity.java
+++ b/Flow_Free/app/src/main/java/com/example/flow_free/MainActivity.java
@@ -1,4 +1,3 @@
-// MainActivity.java
package com.example.flow_free;
import android.app.Activity;
@@ -45,22 +44,10 @@ public class MainActivity extends Activity {
ArrayAdapter 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);
- });
+ // Utilisation de la classe listener pour les paramètres
+ settingsButton.setOnClickListener(new listener(this, SettingsActivity.class));
- // Bouton paramètres
- settingsButton.setOnClickListener(v -> {
- Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
- startActivity(intent);
- });
+ // Utilisation de la nouvelle classe pour la gestion des clics sur la liste des puzzles
+ puzzleListView.setOnItemClickListener(new PuzzleClickListener(this, puzzleList));
}
-}
+}
\ No newline at end of file
diff --git a/Flow_Free/app/src/main/java/com/example/flow_free/PuzzleClickListener.java b/Flow_Free/app/src/main/java/com/example/flow_free/PuzzleClickListener.java
new file mode 100644
index 0000000..236a9af
--- /dev/null
+++ b/Flow_Free/app/src/main/java/com/example/flow_free/PuzzleClickListener.java
@@ -0,0 +1,34 @@
+package com.example.flow_free;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Toast;
+
+import java.util.List;
+
+public class PuzzleClickListener implements AdapterView.OnItemClickListener {
+
+ private final Context context;
+ private final List puzzleList;
+
+ public PuzzleClickListener(Context context, List puzzleList) {
+ this.context = context;
+ this.puzzleList = puzzleList;
+ }
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ String selectedPuzzle = puzzleList.get(position);
+
+ if (!selectedPuzzle.endsWith(".xml")) {
+ Toast.makeText(context, "Puzzle invalide", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ Intent intent = new Intent(context, GameActivity.class);
+ intent.putExtra("PUZZLE_FILE", selectedPuzzle);
+ context.startActivity(intent);
+ }
+}
\ No newline at end of file