diff --git a/app/src/main/java/legion/muyue/best2048/MainActivity.java b/app/src/main/java/legion/muyue/best2048/MainActivity.java
index d02be60..98bfc8e 100644
--- a/app/src/main/java/legion/muyue/best2048/MainActivity.java
+++ b/app/src/main/java/legion/muyue/best2048/MainActivity.java
@@ -9,8 +9,11 @@ package legion.muyue.best2048;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
+import android.content.ActivityNotFoundException;
import android.content.DialogInterface; // Assurez-vous que cet import est présent
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Uri;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
@@ -25,6 +28,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.gridlayout.widget.GridLayout;
import android.widget.Button;
+import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@@ -482,14 +486,37 @@ public class MainActivity extends AppCompatActivity {
}
/**
- * Affiche une boîte de dialogue simple avec les informations "À Propos".
+ * Affiche la boîte de dialogue "À Propos" en utilisant un layout personnalisé,
+ * incluant des informations sur l'application et un lien cliquable vers le site web.
*/
private void showAboutDialog() {
- new AlertDialog.Builder(this)
- .setTitle(R.string.about_title)
- .setMessage(R.string.about_message) // Pensez à personnaliser ceci dans strings.xml
- .setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss())
- .show();
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ LayoutInflater inflater = getLayoutInflater();
+ View dialogView = inflater.inflate(R.layout.dialog_about, null); // Gonfle le layout
+ builder.setView(dialogView);
+ builder.setCancelable(true); // Permet de fermer
+
+ // Récupère les vues du layout
+ TextView websiteLinkTextView = dialogView.findViewById(R.id.websiteLinkTextView);
+ Button okButton = dialogView.findViewById(R.id.dialogOkButtonAbout);
+
+ final AlertDialog dialog = builder.create();
+
+ // Rend le lien cliquable pour ouvrir le navigateur
+ websiteLinkTextView.setOnClickListener(v -> {
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_website_url)));
+ try {
+ startActivity(browserIntent);
+ } catch (ActivityNotFoundException e) {
+ // Gère le cas où aucun navigateur n'est installé
+ Toast.makeText(this, "Aucun navigateur web trouvé.", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ // Bouton OK pour fermer la dialogue
+ okButton.setOnClickListener(v -> dialog.dismiss());
+
+ dialog.show();
}
diff --git a/app/src/main/res/layout/dialog_about.xml b/app/src/main/res/layout/dialog_about.xml
new file mode 100644
index 0000000..e3a3e89
--- /dev/null
+++ b/app/src/main/res/layout/dialog_about.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 13c1f16..ad42d84 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -60,6 +60,7 @@
Swipe the screen (Up, Down, Left, Right) to move all the tiles.\n\nWhen two tiles with the same number touch, they merge into one!\n\nReach the 2048 tile to win.\n\nThe game is over if the board is full and no moves are possible.About Best 2048Version: 1.0 (University Project)\nDeveloped by: La Legion de Muyue\n(Leader: Muyue, Members: 2 others)\n\nBased on the popular game 2048.
+ Website : legion-muyue.frhttps://legion-muyue.frOKSettingsSettings screen to be implemented.