debutMenu
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
23
app/src/main/java/com/example/mastermind/MenuActivity.java
Normal file
23
app/src/main/java/com/example/mastermind/MenuActivity.java
Normal 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)));
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user