Correction bug > Choix d'un mot de passe avec une pièce vide alors que que non autorisée

This commit is contained in:
Mathis CHAIGNEAU 2023-04-08 13:42:19 +02:00
parent 901c514158
commit cdc3597786
8 changed files with 13 additions and 9 deletions

View File

@ -16,27 +16,33 @@ public class ChoixDuMotDePasse extends AppCompatActivity {
private UnePiece un, deux, trois, quatre;
private boolean vide;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choix_du_mot_de_passe);
this.vide = this.getIntent().getBooleanExtra("vide", false);
this.un=(UnePiece) this.findViewById(R.id.code1);
this.deux=(UnePiece) this.findViewById(R.id.code2);
this.trois=(UnePiece) this.findViewById(R.id.code3);
this.quatre=(UnePiece) this.findViewById(R.id.code4);
boolean t=this.getIntent().getBooleanExtra("vide", false);
this.un.setOnTouchListener(new MonOnTouchListener(this.un, t));
this.deux.setOnTouchListener(new MonOnTouchListener(this.deux, t));
this.trois.setOnTouchListener(new MonOnTouchListener(this.trois, t));
this.quatre.setOnTouchListener(new MonOnTouchListener(this.quatre, t));
this.un.setOnTouchListener(new MonOnTouchListener(this.un, this.vide));
this.deux.setOnTouchListener(new MonOnTouchListener(this.deux, this.vide));
this.trois.setOnTouchListener(new MonOnTouchListener(this.trois, this.vide));
this.quatre.setOnTouchListener(new MonOnTouchListener(this.quatre, this.vide));
this.findViewById(R.id.bouton_valider_code).setOnTouchListener(new OnTouchBoutonValider(this));
}
public void start(){
if(!this.vide && (this.un.getColor()==6 || this.deux.getColor()==6 || this.trois.getColor()==6 || this.quatre.getColor()==6)){
return;
}
Intent mastermind=new Intent(this, MasterMindActivity.class);
Intent data=this.getIntent();
mastermind.putExtra("vide", data.getBooleanExtra("vide", false));

View File

@ -14,10 +14,8 @@ public class MonOnTouchListener implements View.OnTouchListener {
public MonOnTouchListener(UnePiece p, boolean t){
this.detector=new GestureDetector(new MonGestureListener(p));
this.detector.setOnDoubleTapListener(new MonOnDoubleTapListener(p));
if(t==false){
this.detector.setIsLongpressEnabled(t);
}
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {