From e33112dcb0d3b650a18eea4e5594e07d536dbbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexe=C3=AF=20KADIR?= Date: Thu, 4 Apr 2024 21:54:13 +0200 Subject: [PATCH] Added comments for Game Activity. --- .../java/fr/iutfbleau/sae/GameActivity.java | 65 +++++++++++++++---- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/fr/iutfbleau/sae/GameActivity.java b/app/src/main/java/fr/iutfbleau/sae/GameActivity.java index 40e11d2..a11da65 100644 --- a/app/src/main/java/fr/iutfbleau/sae/GameActivity.java +++ b/app/src/main/java/fr/iutfbleau/sae/GameActivity.java @@ -12,39 +12,68 @@ import android.widget.TextView; import java.util.HashSet; import java.util.Set; - +/** + * {@code GameActivity} is the activity that displays the game. + * + * @autor Alexeï Kadir, Lyanis Souidi, Hugo Dimitrijevic + * @version 1.0 + */ public class GameActivity extends AppCompatActivity { - + /** + * The key used to store the size of the cross in the {@code Intent}. + */ public static final String SIZE_KEY = "SIZE"; - + /** + * The default size of the cross. + */ public static final int DEFAULT_SIZE = 10; - + /** + * The key used to store whether the game is in hard mode in the {@code Intent}. + */ public static final String HARD_MODE_KEY = "HARD_MODE"; - + /** + * Whether the game is in hard mode by default. + */ public static final boolean DEFAULT_HARD_MODE = false; - + /** + * The key used to store the {@code Set} of {@code Line}s in the {@code Bundle}. + */ private static final String LINES_KEY = "LINES"; - + /** + * The key used to store the x-coordinate of the offset in the {@code Bundle}. + */ private static final String OFFSET_X_KEY = "OFFSET_X"; - + /** + * The key used to store the y-coordinate of the offset in the {@code Bundle}. + */ private static final String OFFSET_Y_KEY = "OFFSET_Y"; - + /** + * The {@code GameView} that displays the game. + */ private GameView view; - + /** + * The {@code GameModel} that represents the game. + */ private GameModel model; - + /** + * The {@code GameController} that controls the game. + */ private GameController controller; - + /** + * Initializes the activity. + * + * @param savedState The saved state of the activity. + */ @Override protected void onCreate(Bundle savedState) { super.onCreate(savedState); @@ -61,7 +90,11 @@ public class GameActivity extends AppCompatActivity { this.controller = new GameController(this, this.view, this.model); } - + /** + * Saves the state of the activity in the specified {@code Bundle}. + * + * @param state The state of the activity. + */ @Override protected void onSaveInstanceState(@NonNull Bundle state) { super.onSaveInstanceState(state); @@ -74,7 +107,11 @@ public class GameActivity extends AppCompatActivity { state.putInt(OFFSET_Y_KEY, offset.y); } - + /** + * Restores the state of the activity. + * + * @param savedState The saved state of the activity. + */ @Override protected void onRestoreInstanceState(@NonNull Bundle savedState) { super.onSaveInstanceState(savedState);