added check box screen
This commit is contained in:
@@ -31,10 +31,10 @@ public class Data {
|
|||||||
private String ScoreOb8;
|
private String ScoreOb8;
|
||||||
private String ScoreOb9;
|
private String ScoreOb9;
|
||||||
private String NumScoreOb = "0";
|
private String NumScoreOb = "0";
|
||||||
private int[] NumButtonObAuto = new int[0];
|
private int[] NumButtonObAuto = new int[9];
|
||||||
private int[] NumButtonObTeleop = new int[0];
|
private int[] NumButtonObTeleop = new int[9];
|
||||||
private int[] valueButtonsAuto = new int[0];
|
private int[] valueButtonsAuto = new int[81];
|
||||||
private int[] valueButtonsTele = new int[0];
|
private int[] valueButtonsTele = new int[81];
|
||||||
|
|
||||||
private int numCheckBoxes;
|
private int numCheckBoxes;
|
||||||
|
|
||||||
@@ -285,6 +285,8 @@ public class Data {
|
|||||||
public String getCheckBox4() {
|
public String getCheckBox4() {
|
||||||
return CheckBox4;
|
return CheckBox4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.google.android.material.button.MaterialButton;
|
|||||||
|
|
||||||
public class MakeCheckActivity extends AppCompatActivity {
|
public class MakeCheckActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private EditText ScoreObjects;
|
private EditText CheckBoxObjects;
|
||||||
private EditText Ob1;
|
private EditText Ob1;
|
||||||
private EditText Ob2;
|
private EditText Ob2;
|
||||||
private EditText Ob3;
|
private EditText Ob3;
|
||||||
@@ -46,7 +46,7 @@ public class MakeCheckActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
EditText ScoreObjects = (EditText) findViewById(R.id.NumCheckBox);
|
EditText CheckBoxObjects = (EditText) findViewById(R.id.NumCheckBox);
|
||||||
EditText Ob1 = (EditText) findViewById(R.id.CheckBox1);
|
EditText Ob1 = (EditText) findViewById(R.id.CheckBox1);
|
||||||
EditText Ob2 = (EditText) findViewById(R.id.CheckBox2);
|
EditText Ob2 = (EditText) findViewById(R.id.CheckBox2);
|
||||||
EditText Ob3 = (EditText) findViewById(R.id.CheckBox3);
|
EditText Ob3 = (EditText) findViewById(R.id.CheckBox3);
|
||||||
@@ -103,26 +103,26 @@ public class MakeCheckActivity extends AppCompatActivity {
|
|||||||
EventsActivity.Data.setCheckBox2(Ob2.getText().toString());
|
EventsActivity.Data.setCheckBox2(Ob2.getText().toString());
|
||||||
EventsActivity.Data.setCheckBox3(Ob3.getText().toString());
|
EventsActivity.Data.setCheckBox3(Ob3.getText().toString());
|
||||||
EventsActivity.Data.setCheckBox4(Ob4.getText().toString());
|
EventsActivity.Data.setCheckBox4(Ob4.getText().toString());
|
||||||
EventsActivity.Data.setNumCheckBoxes(ScoreObjects.getText().toString().isEmpty() ? 0 : Integer.parseInt(ScoreObjects.getText().toString()));
|
EventsActivity.Data.setNumCheckBoxes(Integer.parseInt(CheckBoxObjects.getText().toString()));
|
||||||
Intent intent = new Intent(this, MakeAutoActivity2.class);
|
Intent intent = new Intent(this, MakeAutoActivity2.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
ScoreObjects.addTextChangedListener(new TextWatcher() {
|
CheckBoxObjects.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
String ScoreNum = ScoreObjects.getText().toString();
|
String CheckBoxNum = CheckBoxObjects.getText().toString();
|
||||||
View[] objectives = {
|
View[] objectives = {
|
||||||
Ob1, Ob2, Ob3, Ob4
|
Ob1, Ob2, Ob3, Ob4
|
||||||
};
|
};
|
||||||
|
|
||||||
int score = ScoreNum.isEmpty() ? 0 : Integer.parseInt(ScoreNum);
|
int CheckBox = CheckBoxNum.isEmpty() ? 0 : Integer.parseInt(CheckBoxNum);
|
||||||
|
|
||||||
for (int i = 0; i < objectives.length; i++) {
|
for (int i = 0; i < objectives.length; i++) {
|
||||||
objectives[i].setVisibility(i < score ? View.VISIBLE : View.GONE);
|
objectives[i].setVisibility(i < CheckBox ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user