From bb894c2ca127675581e0620b9fc37cadadb0cbda Mon Sep 17 00:00:00 2001 From: martins Date: Sun, 19 Mar 2023 22:36:49 +0100 Subject: [PATCH] debutMenu --- app/.gitignore | 1 + app/build.gradle | 45 +++++ app/proguard-rules.pro | 21 ++ .../mastermind/ExampleInstrumentedTest.kt | 24 +++ app/src/main/AndroidManifest.xml | 28 +++ .../mastermind/MasterMindActivity.java | 19 ++ .../com/example/mastermind/MenuActivity.java | 23 +++ .../menu/ObservateurMenuDebutPartie.java | 33 ++++ .../mastermind/util/UtilTypePartie.java | 6 + .../drawable-v24/ic_launcher_foreground.xml | 30 +++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../main/res/layout/activity_master_mind.xml | 9 + app/src/main/res/layout/activity_menu.xml | 77 ++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../res/mipmap-anydpi-v33/ic_launcher.xml | 6 + app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes app/src/main/res/values-night/themes.xml | 16 ++ app/src/main/res/values/colors.xml | 12 ++ app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/themes.xml | 16 ++ app/src/main/res/xml/backup_rules.xml | 13 ++ .../main/res/xml/data_extraction_rules.xml | 19 ++ .../com/example/mastermind/ExampleUnitTest.kt | 17 ++ build.gradle | 6 + gradle.properties | 23 +++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++++++++++++++++++ gradlew.bat | 89 +++++++++ settings.gradle | 16 ++ 40 files changed, 923 insertions(+) create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/mastermind/ExampleInstrumentedTest.kt create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/example/mastermind/MasterMindActivity.java create mode 100644 app/src/main/java/com/example/mastermind/MenuActivity.java create mode 100644 app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java create mode 100644 app/src/main/java/com/example/mastermind/util/UtilTypePartie.java create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_master_mind.xml create mode 100644 app/src/main/res/layout/activity_menu.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-anydpi-v33/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/main/res/xml/backup_rules.xml create mode 100644 app/src/main/res/xml/data_extraction_rules.xml create mode 100644 app/src/test/java/com/example/mastermind/ExampleUnitTest.kt create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..68cdd7c --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'com.example.mastermind' + compileSdk 33 + + defaultConfig { + applicationId "com.example.mastermind" + minSdk 19 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildToolsVersion '33' +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.5.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/mastermind/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/mastermind/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..8119dd2 --- /dev/null +++ b/app/src/androidTest/java/com/example/mastermind/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.mastermind + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.mastermind", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3b848c9 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/mastermind/MasterMindActivity.java b/app/src/main/java/com/example/mastermind/MasterMindActivity.java new file mode 100644 index 0000000..7b045f4 --- /dev/null +++ b/app/src/main/java/com/example/mastermind/MasterMindActivity.java @@ -0,0 +1,19 @@ +package com.example.mastermind; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +public class MasterMindActivity extends AppCompatActivity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_master_mind); + Intent data=this.getIntent(); + System.out.println(data.getBooleanExtra("vide", false)); + System.out.println(data.getIntExtra("nbJoeur", 1)); + } +} diff --git a/app/src/main/java/com/example/mastermind/MenuActivity.java b/app/src/main/java/com/example/mastermind/MenuActivity.java new file mode 100644 index 0000000..db717cd --- /dev/null +++ b/app/src/main/java/com/example/mastermind/MenuActivity.java @@ -0,0 +1,23 @@ +package com.example.mastermind; + +import android.os.Bundle; +import android.widget.CheckBox; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.example.mastermind.controller.menu.ObservateurMenuDebutPartie; +import com.example.mastermind.util.UtilTypePartie; + +public class MenuActivity extends AppCompatActivity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_menu); + this.findViewById(R.id.unJoeur) + .setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.UN_JOEUR, (CheckBox) this.findViewById(R.id.vide))); + this.findViewById(R.id.deuxJoeur) + .setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.DEUX_JOEUR, (CheckBox) this.findViewById(R.id.vide))); + } +} diff --git a/app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java b/app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java new file mode 100644 index 0000000..87fe4d1 --- /dev/null +++ b/app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java @@ -0,0 +1,33 @@ +package com.example.mastermind.controller.menu; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.CheckBox; + +import androidx.appcompat.app.AppCompatActivity; +import com.example.mastermind.MasterMindActivity; + +public class ObservateurMenuDebutPartie implements View.OnClickListener { + + private AppCompatActivity menu; + + private int typePartie; + + private CheckBox vide; + + + public ObservateurMenuDebutPartie(AppCompatActivity menu, int type, CheckBox vide){ + this.menu=menu; + this.typePartie=type; + this.vide=vide; + } + + @Override + public void onClick(View view) { + Intent mastermind = new Intent(menu, MasterMindActivity.class); + mastermind.putExtra("nbJoeur", typePartie); + mastermind.putExtra("vide", vide.isActivated()); + menu.startActivity(mastermind); + } +} diff --git a/app/src/main/java/com/example/mastermind/util/UtilTypePartie.java b/app/src/main/java/com/example/mastermind/util/UtilTypePartie.java new file mode 100644 index 0000000..f0c6e67 --- /dev/null +++ b/app/src/main/java/com/example/mastermind/util/UtilTypePartie.java @@ -0,0 +1,6 @@ +package com.example.mastermind.util; + +public abstract class UtilTypePartie { + public static final int UN_JOEUR=1; + public static final int DEUX_JOEUR=2; +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_master_mind.xml b/app/src/main/res/layout/activity_master_mind.xml new file mode 100644 index 0000000..ce385f9 --- /dev/null +++ b/app/src/main/res/layout/activity_master_mind.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_menu.xml b/app/src/main/res/layout/activity_menu.xml new file mode 100644 index 0000000..0c7a6d4 --- /dev/null +++ b/app/src/main/res/layout/activity_menu.xml @@ -0,0 +1,77 @@ + + + + + + + + +