added check box screen
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
android:name=".MakeTeleActivity"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name=".MakeCheckActivity"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -63,24 +63,24 @@ public class EventsActivity extends AppCompatActivity {
|
||||
String Eventa2 = eventa2.getText().toString();
|
||||
String Eventa3 = eventa3.getText().toString();
|
||||
String Eventa4 = eventa4.getText().toString();
|
||||
if (Eventn1.matches("") ||
|
||||
if (Eventn1.matches("") ||
|
||||
Eventn2.matches("") ||
|
||||
Eventa1.matches("") ||
|
||||
Eventa2.matches("")) {
|
||||
Toast.makeText(this, "fill at least events 1 and 2", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Data.setEventn1(Eventn1);
|
||||
Data.setEventn2(Eventn2);
|
||||
Data.setEventn3(Eventn3);
|
||||
Data.setEventn4(Eventn4);
|
||||
Data.setEventn1(Eventn1);
|
||||
Data.setEventn2(Eventn2);
|
||||
Data.setEventn3(Eventn3);
|
||||
Data.setEventn4(Eventn4);
|
||||
|
||||
Data.setEventa1(Eventa1);
|
||||
Data.setEventa2(Eventa2);
|
||||
Data.setEventa3(Eventa3);
|
||||
Data.setEventa4(Eventa4);
|
||||
Data.setEventa1(Eventa1);
|
||||
Data.setEventa2(Eventa2);
|
||||
Data.setEventa3(Eventa3);
|
||||
Data.setEventa4(Eventa4);
|
||||
|
||||
Intent intent = new Intent(this, ColorActivity.class);
|
||||
startActivity(intent); }
|
||||
Intent intent = new Intent(this, ColorActivity.class);
|
||||
startActivity(intent); }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,8 @@ import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -21,8 +17,6 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class MakeAutoActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.example.generator;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
|
||||
public class MakeCheckActivity extends AppCompatActivity {
|
||||
|
||||
private EditText ScoreObjects;
|
||||
private EditText Ob1;
|
||||
private EditText Ob2;
|
||||
private EditText Ob3;
|
||||
private EditText Ob4;
|
||||
private EditText Ob5;
|
||||
private EditText Ob6;
|
||||
private EditText Ob7;
|
||||
private EditText Ob8;
|
||||
private EditText Ob9;
|
||||
|
||||
private String ColorP = "";
|
||||
private String ColorS = "";
|
||||
private int mainColorResP = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_make_check);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
EditText ScoreObjects = (EditText) findViewById(R.id.NumCheckBox);
|
||||
EditText Ob1 = (EditText) findViewById(R.id.CheckBox1);
|
||||
EditText Ob2 = (EditText) findViewById(R.id.CheckBox2);
|
||||
EditText Ob3 = (EditText) findViewById(R.id.CheckBox3);
|
||||
EditText Ob4 = (EditText) findViewById(R.id.CheckBox4);
|
||||
Ob1.setVisibility(View.GONE);
|
||||
Ob2.setVisibility(View.GONE);
|
||||
Ob3.setVisibility(View.GONE);
|
||||
Ob4.setVisibility(View.GONE);
|
||||
|
||||
|
||||
|
||||
MaterialButton backButton = findViewById(R.id.backButton);
|
||||
MaterialButton nextButton = findViewById(R.id.nextButton);
|
||||
backButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeAutoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
if (EventsActivity.Data.getColorS() != null) {
|
||||
ColorS = EventsActivity.Data.getColorS();
|
||||
}
|
||||
if (EventsActivity.Data.getColorP() != null) {
|
||||
ColorP = EventsActivity.Data.getColorP();
|
||||
}
|
||||
|
||||
switch (ColorP) {
|
||||
case "Green": mainColorResP = R.color.greenMain; break;
|
||||
case "Blue": mainColorResP = R.color.blueMain; break;
|
||||
case "Pink": mainColorResP = R.color.pinkMain; break;
|
||||
case "Purple": mainColorResP = R.color.purpleMain; break;
|
||||
case "Red": mainColorResP = R.color.redMain; break;
|
||||
case "Yellow": mainColorResP = R.color.yellowMain; break;
|
||||
default: mainColorResP = R.color.orangeMain; break;
|
||||
}
|
||||
|
||||
|
||||
if (mainColorResP != 0) {
|
||||
int actualColor = ContextCompat.getColor(this, mainColorResP);
|
||||
ColorStateList tintList = ColorStateList.valueOf(actualColor);
|
||||
|
||||
ViewCompat.setBackgroundTintList(nextButton, tintList);
|
||||
ViewCompat.setBackgroundTintList(backButton, tintList);
|
||||
|
||||
nextButton.setStrokeWidth(0);
|
||||
backButton.setStrokeWidth(0);
|
||||
}
|
||||
|
||||
backButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeStartingActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
nextButton.setOnClickListener((v) -> {
|
||||
EventsActivity.Data.setScoreOb1(Ob1.getText().toString());
|
||||
EventsActivity.Data.setScoreOb2(Ob2.getText().toString());
|
||||
EventsActivity.Data.setScoreOb3(Ob3.getText().toString());
|
||||
EventsActivity.Data.setScoreOb4(Ob4.getText().toString());
|
||||
EventsActivity.Data.setScoreOb5(Ob5.getText().toString());
|
||||
EventsActivity.Data.setScoreOb6(Ob6.getText().toString());
|
||||
EventsActivity.Data.setScoreOb7(Ob7.getText().toString());
|
||||
EventsActivity.Data.setScoreOb8(Ob8.getText().toString());
|
||||
EventsActivity.Data.setScoreOb9(Ob9.getText().toString());
|
||||
EventsActivity.Data.setNumScoreOb(ScoreObjects.getText().toString());
|
||||
Intent intent = new Intent(this, MakeAutoActivity2.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
ScoreObjects.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String ScoreNum = ScoreObjects.getText().toString();
|
||||
View[] objectives = {
|
||||
Ob1, Ob2, Ob3, Ob4
|
||||
};
|
||||
|
||||
int score = ScoreNum.isEmpty() ? 0 : Integer.parseInt(ScoreNum);
|
||||
|
||||
for (int i = 0; i < objectives.length; i++) {
|
||||
objectives[i].setVisibility(i < score ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class MakeTeleActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
nextButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeAutoActivity.class);
|
||||
Intent intent = new Intent(this, MakeCheckActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
139
Generator/app/src/main/res/layout/activity_make_check.xml
Normal file
139
Generator/app/src/main/res/layout/activity_make_check.xml
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
tools:context=".ColorActivity">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPine4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="Number of Check boxes"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/CheckBox1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:hint="Check Box 1"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text|textCapSentences"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toStartOf="@+id/CheckBox2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/NumCheckBox" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/CheckBox2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:hint="Check Box 2"
|
||||
android:inputType="text|textCapSentences"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/CheckBox1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/NumCheckBox" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/CheckBox3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:hint="Check Box 3"
|
||||
android:inputType="text|textCapSentences"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toStartOf="@+id/CheckBox4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/CheckBox1" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/CheckBox4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:hint="Check Box 4"
|
||||
android:inputType="text|textCapSentences"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/CheckBox3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/CheckBox2" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/NumCheckBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="Number of CheckBoxes, 1-4"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:digits="12340"
|
||||
android:maxLength="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/nextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:backgroundTint="@color/orangeMain"
|
||||
android:text="Next"
|
||||
app:cornerRadius="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/backButton" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/backButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:backgroundTint="@color/orangeMain"
|
||||
android:text="Back"
|
||||
app:cornerRadius="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/nextButton"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="there is 2 check boxes by defualt you can't edit, in auto 'doesn't have auto' and in teleop 'robot dead'"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toTopOf="@+id/backButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/CheckBox3" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user