diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f2ee054..7ea4ffe 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,6 +11,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.MasterMind"
tools:targetApi="31">
+
diff --git a/app/src/main/java/com/example/mastermind/vue/mastermind/setting/SettingActivity.java b/app/src/main/java/com/example/mastermind/ChoixDuMotDePasse.java
similarity index 55%
rename from app/src/main/java/com/example/mastermind/vue/mastermind/setting/SettingActivity.java
rename to app/src/main/java/com/example/mastermind/ChoixDuMotDePasse.java
index 71bf33a..6bf2afc 100644
--- a/app/src/main/java/com/example/mastermind/vue/mastermind/setting/SettingActivity.java
+++ b/app/src/main/java/com/example/mastermind/ChoixDuMotDePasse.java
@@ -1,14 +1,14 @@
-package com.example.mastermind.vue.mastermind.setting;
+package com.example.mastermind;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
-public class SettingActivity extends AppCompatActivity {
+public class ChoixDuMotDePasse extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_setting);
+ setContentView(R.layout.activity_choix_du_mot_de_passe);
}
}
\ 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
index 7b045f4..78fe96c 100644
--- a/app/src/main/java/com/example/mastermind/MasterMindActivity.java
+++ b/app/src/main/java/com/example/mastermind/MasterMindActivity.java
@@ -13,7 +13,7 @@ public class MasterMindActivity extends AppCompatActivity {
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));
+ System.out.println(data.getIntArrayExtra("code"));
}
}
diff --git a/app/src/main/java/com/example/mastermind/MenuActivity.java b/app/src/main/java/com/example/mastermind/MenuActivity.java
index db717cd..c3d0a46 100644
--- a/app/src/main/java/com/example/mastermind/MenuActivity.java
+++ b/app/src/main/java/com/example/mastermind/MenuActivity.java
@@ -15,9 +15,9 @@ public class MenuActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
- this.findViewById(R.id.unJoeur)
+ this.findViewById(R.id.unJoueur)
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.UN_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
- this.findViewById(R.id.deuxJoeur)
+ this.findViewById(R.id.deuxJoueur)
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.DEUX_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
}
}
diff --git a/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureDetector.java b/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureDetector.java
new file mode 100644
index 0000000..1918d90
--- /dev/null
+++ b/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureDetector.java
@@ -0,0 +1,15 @@
+package com.example.mastermind.controller.mastermind;
+
+import android.os.Handler;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+public class MonGestureDetector extends GestureDetector {
+
+ public MonGestureDetector(@NonNull OnGestureListener listener, @Nullable Handler handler) {
+ super(listener, handler);
+ }
+}
diff --git a/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureListener.java b/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureListener.java
new file mode 100644
index 0000000..81b36d8
--- /dev/null
+++ b/app/src/main/java/com/example/mastermind/controller/mastermind/MonGestureListener.java
@@ -0,0 +1,38 @@
+package com.example.mastermind.controller.mastermind;
+
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+
+public class MonGestureListener implements GestureDetector.OnGestureListener {
+ @Override
+ public boolean onDown(@NonNull MotionEvent motionEvent) {
+ return false;
+ }
+
+ @Override
+ public void onShowPress(@NonNull MotionEvent motionEvent) {
+
+ }
+
+ @Override
+ public boolean onSingleTapUp(@NonNull MotionEvent motionEvent) {
+ return false;
+ }
+
+ @Override
+ public boolean onScroll(@NonNull MotionEvent motionEvent, @NonNull MotionEvent motionEvent1, float v, float v1) {
+ return false;
+ }
+
+ @Override
+ public void onLongPress(@NonNull MotionEvent motionEvent) {
+
+ }
+
+ @Override
+ public boolean onFling(@NonNull MotionEvent motionEvent, @NonNull MotionEvent motionEvent1, float v, float v1) {
+ return false;
+ }
+}
diff --git a/app/src/main/java/com/example/mastermind/controller/mastermind/ObservateurTouchListener.java b/app/src/main/java/com/example/mastermind/controller/mastermind/ObservateurTouchListener.java
new file mode 100644
index 0000000..48895bd
--- /dev/null
+++ b/app/src/main/java/com/example/mastermind/controller/mastermind/ObservateurTouchListener.java
@@ -0,0 +1,14 @@
+package com.example.mastermind.controller.mastermind;
+
+import android.view.MotionEvent;
+import android.view.View;
+
+public class ObservateurTouchListener implements View.OnTouchListener {
+
+
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+
+ return true;
+ }
+}
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
index 87fe4d1..6f3dc05 100644
--- a/app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java
+++ b/app/src/main/java/com/example/mastermind/controller/menu/ObservateurMenuDebutPartie.java
@@ -6,8 +6,12 @@ import android.view.View;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
+
+import com.example.mastermind.ChoixDuMotDePasse;
import com.example.mastermind.MasterMindActivity;
+import java.util.Random;
+
public class ObservateurMenuDebutPartie implements View.OnClickListener {
private AppCompatActivity menu;
@@ -25,9 +29,24 @@ public class ObservateurMenuDebutPartie implements View.OnClickListener {
@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);
+ if(typePartie == 1){
+ Intent mastermind = new Intent(menu, MasterMindActivity.class);
+ mastermind.putExtra("vide", vide.isChecked());
+
+ Random r=new Random();
+ int tab[]=new int[4];
+ tab[0]=r.nextInt(6);
+ tab[1]=r.nextInt(6);
+ tab[2]=r.nextInt(6);
+ tab[3]=r.nextInt(6);
+ mastermind.putIntegerArrayListExtra("code", )
+
+ menu.startActivity(mastermind);
+ }
+ if(typePartie ==2){
+ Intent choixCode = new Intent(menu, ChoixDuMotDePasse.class);
+ choixCode.putExtra("vide", vide.isChecked());
+ menu.startActivity(choixCode);
+ }
}
}
diff --git a/app/src/main/java/com/example/mastermind/util/MonPaint.java b/app/src/main/java/com/example/mastermind/util/MonPaint.java
new file mode 100644
index 0000000..255c6fc
--- /dev/null
+++ b/app/src/main/java/com/example/mastermind/util/MonPaint.java
@@ -0,0 +1,67 @@
+package com.example.mastermind.util;
+
+import android.graphics.Paint;
+
+public abstract class MonPaint {
+ private static Paint rouge;
+ private static Paint verte;
+ private static Paint bleue;
+ private static Paint jaune;
+ private static Paint blanche;
+ private static Paint noir;
+
+ private static void istanciate(){
+ MonPaint.rouge=new Paint();
+ MonPaint.rouge.setColor(0xffff0000);
+
+ MonPaint.verte=new Paint();
+ MonPaint.verte.setColor(0xff00ff00);
+
+ MonPaint.bleue=new Paint();
+ MonPaint.bleue.setColor(0xff0000ff);
+
+ MonPaint.jaune=new Paint();
+ MonPaint.jaune.setColor(0xffffff00);
+
+ MonPaint.blanche=new Paint();
+ MonPaint.blanche.setColor(0xffffffff);
+
+ MonPaint.noir=new Paint();
+ MonPaint.noir.setColor(0xff000000);
+ }
+
+ public static Paint getVerte(){
+ if(MonPaint.verte== null){
+ MonPaint.istanciate();
+ }
+ return MonPaint.verte;
+ }
+
+ public static Paint getJaune(){
+ if(MonPaint.jaune== null){
+ MonPaint.istanciate();
+ }
+ return MonPaint.jaune;
+ }
+
+ public static Paint getBleue(){
+ if(MonPaint.bleue== null){
+ MonPaint.istanciate();
+ }
+ return MonPaint.bleue;
+ }
+
+ public static Paint getBlanche(){
+ if(MonPaint.blanche== null){
+ MonPaint.istanciate();
+ }
+ return MonPaint.blanche;
+ }
+
+ public static Paint getNoir(){
+ if(MonPaint.noir== null){
+ MonPaint.istanciate();
+ }
+ return MonPaint.noir;
+ }
+}
diff --git a/app/src/main/java/com/example/mastermind/vue/UnePiece.java b/app/src/main/java/com/example/mastermind/vue/UnePiece.java
new file mode 100644
index 0000000..ab4f841
--- /dev/null
+++ b/app/src/main/java/com/example/mastermind/vue/UnePiece.java
@@ -0,0 +1,25 @@
+package com.example.mastermind.vue;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import com.example.mastermind.util.MonPaint;
+
+public class UnePiece extends View {
+
+
+ public UnePiece(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawArc(0, 0, 50, 50, 0, (float) (Math.PI*2), false, MonPaint.getNoir());
+ }
+}
diff --git a/app/src/main/res/layout/activity_choix_du_mot_de_passe.xml b/app/src/main/res/layout/activity_choix_du_mot_de_passe.xml
new file mode 100644
index 0000000..466e6ed
--- /dev/null
+++ b/app/src/main/res/layout/activity_choix_du_mot_de_passe.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
index 0a7853e..9366a35 100644
--- a/app/src/main/res/layout/activity_menu.xml
+++ b/app/src/main/res/layout/activity_menu.xml
@@ -10,22 +10,21 @@
android:layout_height="wrap_content"
android:text="1.0.1 all right reserved"
android:textColor="@color/white"
- android:textSize="10dp"/>
+ android:textSize="15dp"/>
+ android:gravity="center"
+ android:text="MasterMind"
+ android:textAlignment="center"
+ android:textColor="@color/white"
+ android:textSize="60dp" />
+ android:layout_alignParentBottom="true" />