diff --git a/app/src/main/java/fr/iutfbleau/sae/MainActivity.java b/app/src/main/java/fr/iutfbleau/sae/MainActivity.java index c89f7af..2237e74 100644 --- a/app/src/main/java/fr/iutfbleau/sae/MainActivity.java +++ b/app/src/main/java/fr/iutfbleau/sae/MainActivity.java @@ -7,21 +7,38 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.widget.Button; - +/** + * {@code MainActivity} is the activity that displays the main menu. + * + * @autor Alexeï Kadir, Lyanis Souidi, Hugo Dimitrijevic + * @version 1.0 + */ public class MainActivity extends AppCompatActivity { - + /** + * The {@code Button} that starts the game when clicked. + */ private Button play; - + /** + * The {@code Button} that opens the settings when clicked. + */ private Button settings; - + /** + * The {@code Button} that exits the application when clicked. + */ private Button exit; - + /** + * The {@code MainController} that controls the main menu. + */ private MainController mainController; - + /** + * Creates the main menu. + * + * @param savedInstanceState The saved instance state. + */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/fr/iutfbleau/sae/MainController.java b/app/src/main/java/fr/iutfbleau/sae/MainController.java index cb5f20d..3374163 100644 --- a/app/src/main/java/fr/iutfbleau/sae/MainController.java +++ b/app/src/main/java/fr/iutfbleau/sae/MainController.java @@ -9,23 +9,41 @@ import android.view.View; import java.util.prefs.Preferences; - +/** + * {@code MainController} is a class that controls the main menu by recieving + * events from the {@code MainActivity}. + * + * @autor Alexeï Kadir, Lyanis Souidi, Hugo Dimitrijevic + * @version 1.0 + */ public class MainController implements View.OnClickListener { - + /** + * The key of the preference that stores the size of the cross. + */ private static final String SIZE_PREFERENCE_KEY = "size_preference"; - + /** + * The key of the preference that stores whether the game is in hard mode. + */ private static final String HARD_MODE_PREFERENCE_KEY = "hard_mode_preference"; - + /** + * The {@code Activity} that contains the main menu. + */ private final Activity activity; - + /** + * Creates the main menu controller. + * + * @param activity The {@code Activity} that contains the main menu. + */ public MainController(Activity activity) { this.activity = activity; } - + /** + * Starts a new game with the settings from the preferences. + */ public void play() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.activity); @@ -40,17 +58,25 @@ public class MainController implements View.OnClickListener { this.activity.startActivity(intent); } - + /** + * Opens the settings. + */ public void openSettings() { this.activity.startActivity(new Intent(this.activity, SettingsActivity.class)); } - + /** + * Exits the application. + */ public void exit() { this.activity.finish(); } - + /** + * Handles a click event from the main menu. + * + * @param view The {@code View} that was clicked. + */ @Override public void onClick(View view) { int id = view.getId();