Fix checkbox bug, improve data layout

This commit is contained in:
Michael Mikovsky
2025-02-20 12:57:14 -07:00
parent 38ccf17281
commit 8e2c491273
10 changed files with 341 additions and 229 deletions
@@ -69,15 +69,11 @@ public class checkboxType extends inputType {
public View createView(Context context, Function<dataType, Integer> onUpdate){ public View createView(Context context, Function<dataType, Integer> onUpdate){
checkBox = new CheckBox(context); checkBox = new CheckBox(context);
checkBox.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline6);
checkBox.setText(name); checkBox.setText(name);
setViewValue(default_value); setViewValue(default_value);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> onUpdate.apply(getViewValue()));
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
onUpdate.apply(getViewValue());
}
});
return checkBox; return checkBox;
@@ -112,7 +108,7 @@ public class checkboxType extends inputType {
public void add_individual_view(LinearLayout parent, dataType data){ public void add_individual_view(LinearLayout parent, dataType data){
if(data.isNull()) return; if(data.isNull()) return;
CheckBox cb = new CheckBox(parent.getContext()); CheckBox cb = new CheckBox(parent.getContext());
cb.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline1); cb.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline6);
cb.setText(name); cb.setText(name);
cb.setChecked((int) data.get() == 1); cb.setChecked((int) data.get() == 1);
cb.setEnabled(false); cb.setEnabled(false);
@@ -87,6 +87,10 @@ public class fieldposType extends inputType {
nullify(); nullify();
return; return;
} }
if(((int[]) value)[0] == 255 && ((int[]) value)[1] == 255){
nullify();
return;
}
isBlank = false; isBlank = false;
field.setVisibility(View.VISIBLE); field.setVisibility(View.VISIBLE);
@@ -75,7 +75,6 @@ public class tallyType extends inputType {
public void setViewValue(Object value) { public void setViewValue(Object value) {
if(tally == null) return; if(tally == null) return;
System.out.println(value);
if(intType.isNull((int)value)){ if(intType.isNull((int)value)){
nullify(); nullify();
return; return;
@@ -35,7 +35,6 @@ public class ToggleTitleView extends ConstraintLayout {
OnToggleListener onToggleListener; OnToggleListener onToggleListener;
private static final int default_text_color = 0xffffffff;
public void init(Context context){ public void init(Context context){
LayoutInflater.from(context).inflate(R.layout.view_toggle_title, this, true); LayoutInflater.from(context).inflate(R.layout.view_toggle_title, this, true);
@@ -45,7 +44,10 @@ public class ToggleTitleView extends ConstraintLayout {
toggle_title_description = findViewById(R.id.toggle_title_description); toggle_title_description = findViewById(R.id.toggle_title_description);
toggle_title_checkbox.setOnCheckedChangeListener((compoundButton, checked) -> { toggle_title_checkbox.setOnCheckedChangeListener((compoundButton, checked) -> {
if(checked) // If checkbox has already updated
if(enabled == checked) return;
if (checked)
enable(); enable();
else else
disable(); disable();
@@ -83,6 +85,12 @@ public class ToggleTitleView extends ConstraintLayout {
toggle_title_description.setVisibility(View.VISIBLE); toggle_title_description.setVisibility(View.VISIBLE);
setBackgroundColor(0x00000000); setBackgroundColor(0x00000000);
titleView.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline5); titleView.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline5);
// titleView.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline5); }
public void setEnabled(boolean enabled){
if(enabled)
disable();
else
enable();
} }
} }
@@ -44,22 +44,30 @@ public class TeamsFragment extends Fragment {
team = tmpteam; team = tmpteam;
} }
private static final int background_color = 0x5000ff00;
private static final int unsaved_background_color = 0x2000ff00;
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
binding = FragmentDataTeamsBinding.inflate(inflater, container, false); binding = FragmentDataTeamsBinding.inflate(inflater, container, false);
binding.teamsArea.removeAllViews();
DataManager.reload_match_fields(); DataManager.reload_match_fields();
DataManager.reload_pit_fields(); DataManager.reload_pit_fields();
TableLayout table = new TableLayout(getContext()); binding.dataTypeSpinner.setTitle("Data Mode");
table.setStretchAllColumns(true);
binding.teamsArea.addView(table); List<String> options = new ArrayList<>();
options.add("Individual");
options.add("Compiled");
options.add("History");
binding.dataTypeSpinner.setOptions(options, 0);
binding.dataTypeSpinner.setOnClickListener((item, index) -> {
settingsManager.setDataMode(index);
loadTeam(index);
});
// binding.teamsMainElem.
loadTeam(settingsManager.getDataMode()); loadTeam(settingsManager.getDataMode());
@@ -67,92 +75,57 @@ public class TeamsFragment extends Fragment {
} }
public void loadTeam(int mode) { public void loadTeam(int mode) {
binding.teamsArea.removeAllViews();
LinearLayout ll = new LinearLayout(getContext()); // LinearLayout ll = new LinearLayout(getContext());
ll.setLayoutParams(new LinearLayout.LayoutParams( // ll.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, // ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT // ViewGroup.LayoutParams.WRAP_CONTENT
)); // ));
ll.setOrientation(LinearLayout.VERTICAL); // ll.setOrientation(LinearLayout.VERTICAL);
binding.teamsArea.addView(ll); // binding.teamsArea.addView(ll);
CustomSpinnerView dropdown = new CustomSpinnerView(getContext());
dropdown.setTitle("Data Mode");
List<String> options = new ArrayList<>(); binding.teamName2.setText(String.valueOf(team.teamNumber));
options.add("Individual");
options.add("Compiled");
options.add("History");
dropdown.setOptions(options, mode); binding.teamDescription2.setText(team.getDescription());
dropdown.setOnClickListener((item, index) -> { // tv = new TextView(getContext());
System.out.println(index); // tv.setLayoutParams(new FrameLayout.LayoutParams(
settingsManager.setDataMode(index); // ViewGroup.LayoutParams.MATCH_PARENT,
loadTeam(index); // ViewGroup.LayoutParams.WRAP_CONTENT
}); // ));
// tv.setGravity(Gravity.CENTER_HORIZONTAL);
// tv.setText(team.getDescription());
// tv.setTextSize(16);
// ll.addView(tv);
ll.addView(dropdown); add_pit_data(team);
add_match_data(team, mode);
TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(String.valueOf(team.teamNumber));
tv.setTextSize(28);
ll.addView(tv);
tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(team.teamName);
tv.setTextSize(28);
ll.addView(tv);
tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(team.getDescription());
tv.setTextSize(16);
ll.addView(tv);
add_pit_data(ll, team);
add_match_data(ll, team, mode);
} }
public void add_pit_data(LinearLayout ll, frcTeam team){ public void add_pit_data(frcTeam team){
binding.pitArea.removeAllViews();
final String filename = evcode+"-"+team.teamNumber+".pitscoutdata"; final String filename = evcode+"-"+team.teamNumber+".pitscoutdata";
ll.addView(new MaterialDivider(getContext())); // ll.addView(new MaterialDivider(getContext()));
TextView tv = new TextView(getContext()); // TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams( // tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, // ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT // ViewGroup.LayoutParams.WRAP_CONTENT
)); // ));
tv.setGravity(Gravity.CENTER_HORIZONTAL); // tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setPadding(0,10,0,10); // tv.setPadding(0,10,0,10);
tv.setText("----- Pit data -----"); // tv.setText("----- Pit data -----");
tv.setTextSize(30); // tv.setTextSize(30);
ll.addView(tv); // ll.addView(tv);
ll.addView(new MaterialDivider(getContext())); // ll.addView(new MaterialDivider(getContext()));
if(!fileEditor.fileExist(filename)){ if(!fileEditor.fileExist(filename)){
tv = new TextView(getContext()); TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams( tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
@@ -160,13 +133,13 @@ public class TeamsFragment extends Fragment {
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("No pit data has been collected!"); tv.setText("No pit data has been collected!");
tv.setTextSize(23); tv.setTextSize(23);
ll.addView(tv); binding.pitArea.addView(tv);
return; return;
} }
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(filename, pit_values, pit_transferValues); ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(filename, pit_values, pit_transferValues);
tv = new TextView(getContext()); TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams( tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
@@ -175,7 +148,7 @@ public class TeamsFragment extends Fragment {
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("Pit scouting by " + psda.username); tv.setText("Pit scouting by " + psda.username);
tv.setTextSize(30); tv.setTextSize(30);
ll.addView(tv); binding.pitArea.addView(tv);
for (int a = 0; a < psda.data.array.length; a++) { for (int a = 0; a < psda.data.array.length; a++) {
tv = new TextView(getContext()); tv = new TextView(getContext());
@@ -193,38 +166,24 @@ public class TeamsFragment extends Fragment {
} }
ll.addView(tv);
binding.pitArea.addView(tv);
pit_latest_values[a].add_individual_view(ll, psda.data.array[a]); pit_latest_values[a].add_individual_view(binding.pitArea, psda.data.array[a]);
} }
} }
private int matchIndex = 0;
public void add_match_data(frcTeam team, int mode){
public void add_match_data(LinearLayout ll, frcTeam team, int mode){ binding.matchArea.removeAllViews();
binding.individualViewSelector.setVisibility(View.GONE);
String[] files = fileEditor.getMatchesByTeamNum(evcode, team.teamNumber); String[] files = fileEditor.getMatchesByTeamNum(evcode, team.teamNumber);
ll.addView(new MaterialDivider(getContext()));
TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("----- Match data -----");
tv.setPadding(0,10,0,10);
tv.setTextSize(30);
ll.addView(tv);
ll.addView(new MaterialDivider(getContext()));
if(files.length == 0){ if(files.length == 0){
tv = new TextView(getContext()); TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams( tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
@@ -232,19 +191,19 @@ public class TeamsFragment extends Fragment {
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("No match data has been collected!"); tv.setText("No match data has been collected!");
tv.setTextSize(23); tv.setTextSize(23);
ll.addView(tv); binding.matchArea.addView(tv);
return; return;
} }
switch (mode){ switch (mode){
case 0: case 0:
add_individual_views(ll,files); add_individual_views(files);
break; break;
case 1: case 1:
add_compiled_views(ll,files); add_compiled_views(files);
break; break;
case 2: case 2:
add_history_views(ll,files); add_history_views(files);
break; break;
} }
} }
@@ -252,50 +211,75 @@ public class TeamsFragment extends Fragment {
public void add_individual_views(LinearLayout ll, String[] files) { public void add_individual_views(String[] files) {
for (int i = 0; i < files.length; i++) {
try {
String[] split = files[i].split("-");
int match_num = Integer.parseInt(split[1]);
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
TextView tv = new TextView(getContext()); matchIndex = 0;
binding.individualViewSelector.setVisibility(View.VISIBLE);
binding.matchesPlusBtn.setOnClickListener(view -> {
matchIndex++;
update_individual_view(files);
});
binding.matchesMinusBtn.setOnClickListener(view -> {
matchIndex--;
update_individual_view(files);
});
update_individual_view(files);
}
private void update_individual_view(String[] files){
binding.matchesPlusBtn.setEnabled(matchIndex < files.length - 1);
binding.matchesMinusBtn.setEnabled(matchIndex > 0);
binding.matchArea.removeAllViews();
try {
String[] split = files[matchIndex].split("-");
int match_num = Integer.parseInt(split[1]);
binding.matchNum.setText(split[1]);
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[matchIndex], match_values, match_transferValues);
TextView tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setPadding(0, 40, 0, 5);
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("M" + (match_num) + " " + split[2] + "-" + split[3] + " by " + psda.username);
tv.setTextSize(30);
binding.matchArea.addView(tv);
for (int i = 0; i < psda.data.array.length; i++) {
tv = new TextView(getContext());
tv.setLayoutParams(new FrameLayout.LayoutParams( tv.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
)); ));
tv.setPadding(0, 40, 0, 5);
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText("M" + (match_num) + " " + split[2] + "-" + split[3] + " by " + psda.username); tv.setText(psda.data.array[i].getName());
tv.setTextSize(30); tv.setTextSize(25);
ll.addView(tv);
for (int a = 0; a < psda.data.array.length; a++) { if (psda.data.array[i].isNull()) {
tv = new TextView(getContext()); tv.setBackgroundColor(0xffff0000);
tv.setLayoutParams(new FrameLayout.LayoutParams( tv.setTextColor(0xff000000);
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));
tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(psda.data.array[a].getName());
tv.setTextSize(25);
if (psda.data.array[a].isNull()) {
tv.setBackgroundColor(0xffff0000);
tv.setTextColor(0xff000000);
}
ll.addView(tv);
match_latest_values[a].add_individual_view(ll, psda.data.array[a]);
} }
}catch (Exception e){
e.printStackTrace(); binding.matchArea.addView(tv);
AlertManager.alert("Warning!", "Failure to load file " + files[i]);
match_latest_values[i].add_individual_view(binding.matchArea, psda.data.array[i]);
} }
}catch (Exception e){
e.printStackTrace();
AlertManager.alert("Warning!", "Failure to load file " + files[matchIndex]);
} }
} }
@@ -303,7 +287,7 @@ public class TeamsFragment extends Fragment {
public void add_compiled_views(LinearLayout ll, String[] files){ public void add_compiled_views(String[] files){
dataType[][] data = new dataType[match_latest_values.length][files.length]; dataType[][] data = new dataType[match_latest_values.length][files.length];
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
try { try {
@@ -327,9 +311,9 @@ public class TeamsFragment extends Fragment {
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(match_latest_values[i].name); tv.setText(match_latest_values[i].name);
tv.setTextSize(30); tv.setTextSize(30);
ll.addView(tv); binding.matchArea.addView(tv);
match_latest_values[i].add_compiled_view(ll, data[i]); match_latest_values[i].add_compiled_view(binding.matchArea, data[i]);
} }
} }
@@ -337,7 +321,7 @@ public class TeamsFragment extends Fragment {
public void add_history_views(LinearLayout ll, String[] files){ public void add_history_views(String[] files){
dataType[][] data = new dataType[match_latest_values.length][files.length]; dataType[][] data = new dataType[match_latest_values.length][files.length];
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
try { try {
@@ -361,9 +345,9 @@ public class TeamsFragment extends Fragment {
tv.setGravity(Gravity.CENTER_HORIZONTAL); tv.setGravity(Gravity.CENTER_HORIZONTAL);
tv.setText(match_latest_values[i].name); tv.setText(match_latest_values[i].name);
tv.setTextSize(30); tv.setTextSize(30);
ll.addView(tv); binding.matchArea.addView(tv);
match_latest_values[i].add_history_view(ll, data[i]); match_latest_values[i].add_history_view(binding.matchArea, data[i]);
} }
} }
} }
@@ -65,16 +65,6 @@ public class MatchScoutingFragment extends Fragment {
cur_match_num = settingsManager.getMatchNum();
if(cur_match_num >= event.matches.size()) {
cur_match_num = 0;
settingsManager.setMatchNum(0);
}
update_match_num();
binding.nextButton.setOnClickListener(v -> { binding.nextButton.setOnClickListener(v -> {
if(edited) save(); if(edited) save();
settingsManager.setMatchNum(cur_match_num+1); settingsManager.setMatchNum(cur_match_num+1);
@@ -111,6 +101,14 @@ public class MatchScoutingFragment extends Fragment {
// if(edited) save(); // if(edited) save();
// }); // });
cur_match_num = settingsManager.getMatchNum();
if(cur_match_num >= event.matches.size()) {
cur_match_num = 0;
settingsManager.setMatchNum(0);
}
update_match_num();
create_fields(); create_fields();
update_scouting_data(); update_scouting_data();
@@ -142,15 +140,10 @@ public class MatchScoutingFragment extends Fragment {
int cur_match_num; int cur_match_num;
String username; String username;
String filename; String filename;
boolean edited = false; boolean edited = false;
ToggleTitleView[] titles; ToggleTitleView[] titles;
AutoSaveManager asm = new AutoSaveManager(this::save); AutoSaveManager asm = new AutoSaveManager(this::save);
ArrayList<dataType> dataTypes;
public void save(){ public void save(){
@@ -203,16 +196,11 @@ public class MatchScoutingFragment extends Fragment {
final ToggleTitleView ttv = new ToggleTitleView(getContext()); final ToggleTitleView ttv = new ToggleTitleView(getContext());
ttv.setTitle(DataManager.match_latest_values[i].name); ttv.setTitle(DataManager.match_latest_values[i].name);
ttv.setDescription(DataManager.match_latest_values[i].description); ttv.setDescription(DataManager.match_latest_values[i].description);
// final TextView tv = new TextView(getContext());
// tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
// tv.setText(DataManager.match_latest_values[i].name);
// tv.setPadding(8,8,8,8);
// tv.setTextSize(24);
titles[i] = ttv; titles[i] = ttv;
final View v = DataManager.match_latest_values[i].createView(getContext(), dataType -> { final View v = DataManager.match_latest_values[i].createView(getContext(), dataType -> {
// edited = true; // edited = true;
if(asm.isRunning) if(asm.isRunning)
update_asm(); update_asm();
return 0; return 0;
@@ -225,19 +213,14 @@ public class MatchScoutingFragment extends Fragment {
if(asm.isRunning) if(asm.isRunning)
update_asm(); update_asm();
// System.out.println("Checked!");
if(enabled){ if(enabled){
DataManager.match_latest_values[fi].nullify(); DataManager.match_latest_values[fi].nullify();
}else{ }else
DataManager.match_latest_values[fi].setViewValue(DataManager.match_latest_values[fi].default_value); DataManager.match_latest_values[fi].setViewValue(DataManager.match_latest_values[fi].default_value);
}
}); });
ttv.setOnClickListener(p -> {
// boolean blank = !latest_values[fi].getViewValue().isNull();
// System.out.println(blank);
});
binding.MatchScoutArea.addView(v); binding.MatchScoutArea.addView(v);
} }
@@ -360,6 +343,7 @@ public class MatchScoutingFragment extends Fragment {
ScoutingDataWriter.ParsedScoutingDataResult psdr = ScoutingDataWriter.load(filename, DataManager.match_values, DataManager.match_transferValues); ScoutingDataWriter.ParsedScoutingDataResult psdr = ScoutingDataWriter.load(filename, DataManager.match_values, DataManager.match_transferValues);
dataType[] types = psdr.data.array; dataType[] types = psdr.data.array;
for(int i = 0; i < DataManager.match_latest_values.length; i++){ for(int i = 0; i < DataManager.match_latest_values.length; i++){
// types[i] = latest_values[i].getViewValue(); // types[i] = latest_values[i].getViewValue();
try { try {
@@ -369,12 +353,8 @@ public class MatchScoutingFragment extends Fragment {
DataManager.match_latest_values[i].setViewValue(DataManager.match_latest_values[i].default_value); DataManager.match_latest_values[i].setViewValue(DataManager.match_latest_values[i].default_value);
} }
titles[i].setEnabled(DataManager.match_latest_values[i].isBlank);
if(DataManager.match_latest_values[i].isBlank){
titles[i].disable();
}else{
titles[i].enable();
}
} }
} }
@@ -53,19 +53,17 @@ public class AlertManager {
public static void error(Exception e) { public static void error(Exception e) {
e.printStackTrace(); e.printStackTrace();
((Activity) context).runOnUiThread(new Runnable() { ((Activity) context).runOnUiThread(() -> {
public void run() { StringWriter sw = new StringWriter();
StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(new PrintWriter(sw));
AlertDialog.Builder alert = new AlertDialog.Builder(context); AlertDialog.Builder alert = new AlertDialog.Builder(context);
alert.setMessage(sw.toString()); alert.setMessage(sw.toString());
alert.setTitle(e.getMessage()); alert.setTitle(e.getMessage());
alert.setPositiveButton("OK", null); alert.setPositiveButton("OK", null);
alert.setCancelable(true); alert.setCancelable(true);
alert.create().show(); alert.create().show();
}
}); });
} }
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent"/> <solid android:color="@android:color/transparent"/>
<stroke android:width="2dip" android:color="#424242" /> <stroke android:width="2dip" android:color="#626262" />
<corners android:radius="3dip"/> <corners android:radius="3dip"/>
<padding android:left="0dip" <padding android:left="0dip"
android:top="0dip" android:top="0dip"
+125 -13
View File
@@ -1,24 +1,136 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <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/teamsMainElem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ScrollView <LinearLayout
android:id="@+id/teamsArea"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</ScrollView> <com.ridgebotics.ridgescout.ui.CustomSpinnerView
android:id="@+id/data_type_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout> <TextView
android:id="@+id/team_name2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
android:textSize="24sp"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
<TextView
android:id="@+id/team_description2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textAlignment="center"
app:layout_constraintTop_toBottomOf="@+id/team_name2"
tools:layout_editor_absoluteX="0dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pit Data"
android:textAlignment="center"
android:textSize="24sp"
app:layout_constraintTop_toBottomOf="@+id/team_description2"
tools:layout_editor_absoluteX="0dp" />
<LinearLayout
android:id="@+id/pitArea"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</LinearLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Match Data"
android:textAlignment="center"
android:textSize="24sp"
app:layout_constraintTop_toBottomOf="@+id/team_description2"
tools:layout_editor_absoluteX="0dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/individual_view_selector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible">
<Button
android:id="@+id/matches_minus_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="0dp"
android:text="@string/back"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/match_num"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/match_num"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="0"
android:textAlignment="gravity"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="3dp" />
<Button
android:id="@+id/matches_plus_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="0dp"
android:text="next"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/match_num"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/matchArea"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
@@ -16,7 +17,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"> android:gravity="center">
@@ -26,27 +27,42 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="0dp" android:padding="0dp"
android:text="-" android:text="del"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" /> android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/textView3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Teams" android:text="Teams"
android:textAlignment="gravity" android:textAlignment="gravity"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4" /> android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/teams_plus_btn" android:id="@+id/teams_plus_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="0dp" android:padding="0dp"
android:text="+" android:text="Add"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" /> android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TableLayout <TableLayout
android:id="@+id/teamsTable" android:id="@+id/teamsTable"
@@ -56,7 +72,7 @@
</TableLayout> </TableLayout>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:gravity="center" android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent"> android:layout_width="match_parent">
@@ -66,26 +82,41 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="0dp" android:padding="0dp"
android:text="-" android:text="del"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" /> android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/textView4"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="1dp"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/textView4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="Matches" android:text="Matches"
android:textAlignment="gravity" android:textAlignment="gravity"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"/> android:textAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/matches_plus_btn" android:id="@+id/matches_plus_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="0dp" android:padding="0dp"
android:text="+" android:text="Add"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" /> android:visibility="gone"
</LinearLayout> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.686"
app:layout_constraintStart_toEndOf="@+id/textView4"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TableLayout <TableLayout
android:id="@+id/matchTable" android:id="@+id/matchTable"