added a new tab fragment for teleop
This commit is contained in:
@@ -55,6 +55,10 @@
|
||||
android:name=".MakeAutoActivity3"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name=".MakeTeleActivity"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -27,8 +27,10 @@ public class Data {
|
||||
private String ScoreOb8;
|
||||
private String ScoreOb9;
|
||||
private String NumScoreOb = "0";
|
||||
private int[] NumButtonOb = new int[9];
|
||||
private int[] NumButtonObAuto = new int[9];
|
||||
private int[] NumButtonObTeleop = new int[9];
|
||||
private int[] valueButtonsAuto = new int[81];
|
||||
private int[] valueButtonsTele = new int[81];
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
@@ -202,10 +204,10 @@ public class Data {
|
||||
return ScoreOb9;
|
||||
}
|
||||
|
||||
public void setNumButtonOb(int[] NumButtonOb) {this.NumButtonOb = NumButtonOb;}
|
||||
public void setNumButtonObAuto(int[] NumButtonOb) {this.NumButtonObAuto = NumButtonOb;}
|
||||
|
||||
public int[] getNumButtonOb() {
|
||||
return NumButtonOb;
|
||||
public int[] getNumButtonObAuto() {
|
||||
return NumButtonObAuto;
|
||||
}
|
||||
|
||||
public void setValueButtonsAuto(int[] valueButtonsAuto) {this.valueButtonsAuto = valueButtonsAuto;}
|
||||
@@ -214,5 +216,17 @@ public class Data {
|
||||
return valueButtonsAuto;
|
||||
}
|
||||
|
||||
public void setValueButtonsTele(int[] valueButtonsTele) {this.valueButtonsTele = valueButtonsTele;}
|
||||
|
||||
public int[] getValueButtonsTele(int[] valueButtonsTeleop) {
|
||||
return valueButtonsTele;
|
||||
}
|
||||
|
||||
public void setNumButtonObTeleop(int[] NumButtonObTeleop) {this.NumButtonObTeleop = NumButtonObTeleop;}
|
||||
|
||||
public int[] getNumButtonObTeleop() {
|
||||
return NumButtonObTeleop;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,9 @@ 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.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@@ -18,6 +21,8 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class MakeAutoActivity extends AppCompatActivity {
|
||||
|
||||
@@ -123,26 +128,28 @@ public class MakeAutoActivity extends AppCompatActivity {
|
||||
Intent intent = new Intent(this, MakeAutoActivity2.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
ScoreObjects.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
|
||||
ScoreObjects.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
boolean handled = false;
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
String ScoreNum = ScoreObjects.getText().toString();
|
||||
View[] objectives = {
|
||||
Ob1, Ob2, Ob3, Ob4, Ob5,
|
||||
Ob6, Ob7, Ob8, Ob9
|
||||
};
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
int score = ScoreNum.isEmpty() ? 0 : Integer.parseInt(ScoreNum);
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String ScoreNum = ScoreObjects.getText().toString();
|
||||
View[] objectives = {
|
||||
Ob1, Ob2, Ob3, Ob4, Ob5,
|
||||
Ob6, Ob7, Ob8, Ob9
|
||||
};
|
||||
|
||||
for (int i = 0; i < objectives.length; i++) {
|
||||
objectives[i].setVisibility(i < score ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
handled = true;
|
||||
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);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class MakeAutoActivity2 extends AppCompatActivity {
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragmentContainer, new Tabs())
|
||||
.replace(R.id.fragmentContainer, new TabAuto())
|
||||
.commit();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MakeAutoActivity2 extends AppCompatActivity {
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
Fragment targetFragment = Tabs.newInstance(tab.getPosition());
|
||||
Fragment targetFragment = TabAuto.newInstance(tab.getPosition());
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragmentContainer, targetFragment)
|
||||
@@ -72,7 +72,7 @@ public class MakeAutoActivity2 extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
nextButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeAutoActivity.class);
|
||||
Intent intent = new Intent(this, MakeTeleActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.example.generator;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
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 androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
public class MakeTeleActivity extends AppCompatActivity {
|
||||
|
||||
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_tele);
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragmentContainer, new TabTeleop())
|
||||
.commit();
|
||||
}
|
||||
|
||||
TabLayout tabLayout = findViewById(R.id.tabLayout);
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
Fragment targetFragment = TabTeleop.newInstance(tab.getPosition());
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragmentContainer, targetFragment)
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {}
|
||||
});
|
||||
|
||||
if (EventsActivity.Data.getColorS() != null) {
|
||||
ColorS = EventsActivity.Data.getColorS();
|
||||
}
|
||||
if (EventsActivity.Data.getColorP() != null) {
|
||||
ColorP = EventsActivity.Data.getColorP();
|
||||
}
|
||||
|
||||
MaterialButton backButton = findViewById(R.id.backButton);
|
||||
MaterialButton nextButton = findViewById(R.id.nextButton);
|
||||
|
||||
backButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeAutoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
nextButton.setOnClickListener((v) -> {
|
||||
Intent intent = new Intent(this, MakeAutoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,16 +16,16 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Tabs extends Fragment {
|
||||
public class TabAuto extends Fragment {
|
||||
|
||||
private static final String ARG_POSITION = "tab_position";
|
||||
|
||||
public Tabs() {
|
||||
public TabAuto() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static Tabs newInstance(int position) {
|
||||
Tabs fragment = new Tabs();
|
||||
public static TabAuto newInstance(int position) {
|
||||
TabAuto fragment = new TabAuto();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_POSITION, position);
|
||||
fragment.setArguments(args);
|
||||
@@ -46,7 +46,7 @@ public class Tabs extends Fragment {
|
||||
|
||||
TextView elementTitle = view.findViewById(R.id.text1);
|
||||
elementTitle.setText("Object " + (tabPosition + 1));
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonOb();
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonObAuto();
|
||||
|
||||
|
||||
EditText ToAdd = view.findViewById(R.id.toAdd);
|
||||
@@ -103,9 +103,9 @@ public class Tabs extends Fragment {
|
||||
EventsActivity.Data.setNumScoreOb(input);
|
||||
|
||||
int score = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonOb();
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonObAuto();
|
||||
NumButtonOb[tabPosition] = score;
|
||||
EventsActivity.Data.setNumButtonOb(NumButtonOb);
|
||||
EventsActivity.Data.setNumButtonObAuto(NumButtonOb);
|
||||
Log.d("score", Arrays.toString(NumButtonOb));
|
||||
|
||||
|
||||
295
Generator/app/src/main/java/com/example/generator/TabTeleop.java
Normal file
295
Generator/app/src/main/java/com/example/generator/TabTeleop.java
Normal file
@@ -0,0 +1,295 @@
|
||||
package com.example.generator;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TabTeleop extends Fragment {
|
||||
|
||||
private static final String ARG_POSITION = "tab_position";
|
||||
|
||||
public TabTeleop() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static TabTeleop newInstance(int position) {
|
||||
TabTeleop fragment = new TabTeleop();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_POSITION, position);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
public int[] NumButtonOb = new int[9];
|
||||
public int[] valueButtonsTeleop = new int[81];
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_tab1, container, false);
|
||||
|
||||
|
||||
int tabPosition = getArguments() != null ? getArguments().getInt(ARG_POSITION, 0) : 0;
|
||||
|
||||
TextView elementTitle = view.findViewById(R.id.text1);
|
||||
elementTitle.setText("Object " + (tabPosition + 1));
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonObTeleop();
|
||||
|
||||
|
||||
EditText ToAdd = view.findViewById(R.id.toAdd);
|
||||
EditText ToAdd2 = view.findViewById(R.id.toAdd2);
|
||||
EditText ToAdd3 = view.findViewById(R.id.toAdd3);
|
||||
EditText ToAdd4 = view.findViewById(R.id.toAdd4);
|
||||
EditText ToAdd5 = view.findViewById(R.id.toAdd5);
|
||||
EditText ToAdd6 = view.findViewById(R.id.toAdd6);
|
||||
EditText ToAdd7 = view.findViewById(R.id.toAdd7);
|
||||
EditText ToAdd8 = view.findViewById(R.id.toAdd8);
|
||||
EditText ToAdd9 = view.findViewById(R.id.toAdd9);
|
||||
|
||||
|
||||
|
||||
EditText numOfButton = view.findViewById(R.id.numOfButton);
|
||||
View[] buttons = {
|
||||
view.findViewById(R.id.toAdd),
|
||||
view.findViewById(R.id.toAdd2),
|
||||
view.findViewById(R.id.toAdd3),
|
||||
view.findViewById(R.id.toAdd4),
|
||||
view.findViewById(R.id.toAdd5),
|
||||
view.findViewById(R.id.toAdd6),
|
||||
view.findViewById(R.id.toAdd7),
|
||||
view.findViewById(R.id.toAdd8),
|
||||
view.findViewById(R.id.toAdd9)
|
||||
};
|
||||
for (int o = 0; o < buttons.length; o++) {
|
||||
buttons[o].setVisibility(o < NumButtonOb[tabPosition] ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (NumButtonOb[tabPosition] == 0) {
|
||||
|
||||
}else {
|
||||
numOfButton.setText(String.valueOf(NumButtonOb[tabPosition]));
|
||||
}
|
||||
|
||||
valueButtonsTeleop = EventsActivity.Data.getNumButtonObTeleop();
|
||||
|
||||
EditText[] toAddFields = {ToAdd, ToAdd2, ToAdd3, ToAdd4, ToAdd5, ToAdd6, ToAdd7, ToAdd8, ToAdd9};
|
||||
|
||||
for (int i = 0; i < toAddFields.length; i++) {
|
||||
int val = valueButtonsTeleop[tabPosition * 9 + i];
|
||||
toAddFields[i].setText(val == 0 ? "" : String.valueOf(val));
|
||||
}
|
||||
|
||||
|
||||
numOfButton.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 input = s.toString();
|
||||
int score = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
NumButtonOb = EventsActivity.Data.getNumButtonObTeleop();
|
||||
NumButtonOb[tabPosition] = score;
|
||||
EventsActivity.Data.setNumButtonObTeleop(NumButtonOb);
|
||||
Log.d("score", Arrays.toString(NumButtonOb));
|
||||
|
||||
|
||||
for (int o = 0; o < buttons.length; o++) {
|
||||
buttons[o].setVisibility(o < NumButtonOb[tabPosition] ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
ToAdd.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd2.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 1] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd3.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 2] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd4.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 3] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd5.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 4] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd6.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 5] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd7.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 6] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd8.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 7] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd9.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 input = s.toString();
|
||||
valueButtonsTeleop = EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
valueButtonsTeleop[tabPosition * 9 + 8] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.getValueButtonsTele(valueButtonsTeleop);
|
||||
Log.d("score", Arrays.toString(valueButtonsTeleop));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,19 @@
|
||||
android:background="@color/black"
|
||||
tools:context=".MakeAutoActivity2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPine4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="Auto"
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPine3"
|
||||
android:layout_width="0dp"
|
||||
@@ -18,21 +31,22 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine4" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine3"
|
||||
app:tabIndicatorColor="@color/orangeMain"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="@color/orangeMain"
|
||||
app:tabTextColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine3">
|
||||
app:tabTextColor="@color/white">
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
132
Generator/app/src/main/res/layout/activity_make_tele.xml
Normal file
132
Generator/app/src/main/res/layout/activity_make_tele.xml
Normal file
@@ -0,0 +1,132 @@
|
||||
<?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=".MakeTeleActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPine4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="TeleOp"
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPine3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="Number of buttons per object"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine4" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textPine3"
|
||||
app:tabIndicatorColor="@color/orangeMain"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="@color/orangeMain"
|
||||
app:tabTextColor="@color/white">
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="6" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="7" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="8" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="9" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nextButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tabLayout" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
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" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
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" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
tools:context=".Tabs">
|
||||
tools:context=".TabAuto">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
209
Generator/app/src/main/res/layout/fragment_tab_t.xml
Normal file
209
Generator/app/src/main/res/layout/fragment_tab_t.xml
Normal file
@@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
tools:context=".TabTeleop">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="Element 1"
|
||||
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/numOfButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Amount of buttons"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:ems="10"
|
||||
android:text="How much to add per button"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/numOfButton" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 1"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 2"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 3"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd2" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 4"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd3" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 5"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd4" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd6"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 6"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd5" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd7"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 7"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd6" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd8"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 8"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd7" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/toAdd9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="1234567890"
|
||||
android:hint="Button 9"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toAdd8" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user