debutMenu

This commit is contained in:
2023-03-19 22:36:49 +01:00
commit bb894c2ca1
40 changed files with 923 additions and 0 deletions

View File

@@ -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));
}
}

View File

@@ -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)));
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}