mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Fix checkbox bug, improve data layout
This commit is contained in:
@@ -69,15 +69,11 @@ public class checkboxType extends inputType {
|
||||
|
||||
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||
checkBox = new CheckBox(context);
|
||||
checkBox.setTextAppearance(com.google.android.material.R.style.TextAppearance_MaterialComponents_Headline6);
|
||||
checkBox.setText(name);
|
||||
|
||||
setViewValue(default_value);
|
||||
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
onUpdate.apply(getViewValue());
|
||||
}
|
||||
});
|
||||
checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> onUpdate.apply(getViewValue()));
|
||||
|
||||
return checkBox;
|
||||
|
||||
@@ -112,7 +108,7 @@ public class checkboxType extends inputType {
|
||||
public void add_individual_view(LinearLayout parent, dataType data){
|
||||
if(data.isNull()) return;
|
||||
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.setChecked((int) data.get() == 1);
|
||||
cb.setEnabled(false);
|
||||
|
||||
@@ -87,6 +87,10 @@ public class fieldposType extends inputType {
|
||||
nullify();
|
||||
return;
|
||||
}
|
||||
if(((int[]) value)[0] == 255 && ((int[]) value)[1] == 255){
|
||||
nullify();
|
||||
return;
|
||||
}
|
||||
|
||||
isBlank = false;
|
||||
field.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -75,7 +75,6 @@ public class tallyType extends inputType {
|
||||
|
||||
public void setViewValue(Object value) {
|
||||
if(tally == null) return;
|
||||
System.out.println(value);
|
||||
if(intType.isNull((int)value)){
|
||||
nullify();
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,6 @@ public class ToggleTitleView extends ConstraintLayout {
|
||||
OnToggleListener onToggleListener;
|
||||
|
||||
|
||||
private static final int default_text_color = 0xffffffff;
|
||||
|
||||
public void init(Context context){
|
||||
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_checkbox.setOnCheckedChangeListener((compoundButton, checked) -> {
|
||||
if(checked)
|
||||
// If checkbox has already updated
|
||||
if(enabled == checked) return;
|
||||
|
||||
if (checked)
|
||||
enable();
|
||||
else
|
||||
disable();
|
||||
@@ -83,6 +85,12 @@ public class ToggleTitleView extends ConstraintLayout {
|
||||
toggle_title_description.setVisibility(View.VISIBLE);
|
||||
setBackgroundColor(0x00000000);
|
||||
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;
|
||||
}
|
||||
|
||||
private static final int background_color = 0x5000ff00;
|
||||
private static final int unsaved_background_color = 0x2000ff00;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
binding = FragmentDataTeamsBinding.inflate(inflater, container, false);
|
||||
|
||||
binding.teamsArea.removeAllViews();
|
||||
|
||||
DataManager.reload_match_fields();
|
||||
DataManager.reload_pit_fields();
|
||||
|
||||
TableLayout table = new TableLayout(getContext());
|
||||
table.setStretchAllColumns(true);
|
||||
binding.teamsArea.addView(table);
|
||||
binding.dataTypeSpinner.setTitle("Data Mode");
|
||||
|
||||
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());
|
||||
|
||||
@@ -67,92 +75,57 @@ public class TeamsFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void loadTeam(int mode) {
|
||||
binding.teamsArea.removeAllViews();
|
||||
|
||||
LinearLayout ll = new LinearLayout(getContext());
|
||||
ll.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
ll.setOrientation(LinearLayout.VERTICAL);
|
||||
binding.teamsArea.addView(ll);
|
||||
// LinearLayout ll = new LinearLayout(getContext());
|
||||
// ll.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
// ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
// ));
|
||||
// ll.setOrientation(LinearLayout.VERTICAL);
|
||||
// binding.teamsArea.addView(ll);
|
||||
|
||||
|
||||
|
||||
CustomSpinnerView dropdown = new CustomSpinnerView(getContext());
|
||||
dropdown.setTitle("Data Mode");
|
||||
|
||||
List<String> options = new ArrayList<>();
|
||||
options.add("Individual");
|
||||
options.add("Compiled");
|
||||
options.add("History");
|
||||
binding.teamName2.setText(String.valueOf(team.teamNumber));
|
||||
|
||||
dropdown.setOptions(options, mode);
|
||||
binding.teamDescription2.setText(team.getDescription());
|
||||
|
||||
dropdown.setOnClickListener((item, index) -> {
|
||||
System.out.println(index);
|
||||
settingsManager.setDataMode(index);
|
||||
loadTeam(index);
|
||||
});
|
||||
// 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);
|
||||
|
||||
ll.addView(dropdown);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
add_pit_data(team);
|
||||
add_match_data(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";
|
||||
|
||||
ll.addView(new MaterialDivider(getContext()));
|
||||
// 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.setPadding(0,10,0,10);
|
||||
tv.setText("----- Pit data -----");
|
||||
tv.setTextSize(30);
|
||||
ll.addView(tv);
|
||||
// TextView tv = new TextView(getContext());
|
||||
// tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
// ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
// ));
|
||||
// tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
// tv.setPadding(0,10,0,10);
|
||||
// tv.setText("----- Pit data -----");
|
||||
// tv.setTextSize(30);
|
||||
// ll.addView(tv);
|
||||
|
||||
ll.addView(new MaterialDivider(getContext()));
|
||||
// ll.addView(new MaterialDivider(getContext()));
|
||||
|
||||
if(!fileEditor.fileExist(filename)){
|
||||
tv = new TextView(getContext());
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
@@ -160,13 +133,13 @@ public class TeamsFragment extends Fragment {
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText("No pit data has been collected!");
|
||||
tv.setTextSize(23);
|
||||
ll.addView(tv);
|
||||
binding.pitArea.addView(tv);
|
||||
return;
|
||||
}
|
||||
|
||||
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(filename, pit_values, pit_transferValues);
|
||||
|
||||
tv = new TextView(getContext());
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
@@ -175,7 +148,7 @@ public class TeamsFragment extends Fragment {
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText("Pit scouting by " + psda.username);
|
||||
tv.setTextSize(30);
|
||||
ll.addView(tv);
|
||||
binding.pitArea.addView(tv);
|
||||
|
||||
for (int a = 0; a < psda.data.array.length; a++) {
|
||||
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(LinearLayout ll, frcTeam team, int mode){
|
||||
public void add_match_data(frcTeam team, int mode){
|
||||
binding.matchArea.removeAllViews();
|
||||
binding.individualViewSelector.setVisibility(View.GONE);
|
||||
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){
|
||||
tv = new TextView(getContext());
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
@@ -232,19 +191,19 @@ public class TeamsFragment extends Fragment {
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText("No match data has been collected!");
|
||||
tv.setTextSize(23);
|
||||
ll.addView(tv);
|
||||
binding.matchArea.addView(tv);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mode){
|
||||
case 0:
|
||||
add_individual_views(ll,files);
|
||||
add_individual_views(files);
|
||||
break;
|
||||
case 1:
|
||||
add_compiled_views(ll,files);
|
||||
add_compiled_views(files);
|
||||
break;
|
||||
case 2:
|
||||
add_history_views(ll,files);
|
||||
add_history_views(files);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -252,50 +211,75 @@ public class TeamsFragment extends Fragment {
|
||||
|
||||
|
||||
|
||||
public void add_individual_views(LinearLayout ll, String[] files) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
try {
|
||||
String[] split = files[i].split("-");
|
||||
int match_num = Integer.parseInt(split[1]);
|
||||
public void add_individual_views(String[] files) {
|
||||
|
||||
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(
|
||||
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);
|
||||
ll.addView(tv);
|
||||
tv.setText(psda.data.array[i].getName());
|
||||
tv.setTextSize(25);
|
||||
|
||||
for (int a = 0; a < psda.data.array.length; a++) {
|
||||
tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||
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]);
|
||||
if (psda.data.array[i].isNull()) {
|
||||
tv.setBackgroundColor(0xffff0000);
|
||||
tv.setTextColor(0xff000000);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
AlertManager.alert("Warning!", "Failure to load file " + files[i]);
|
||||
|
||||
binding.matchArea.addView(tv);
|
||||
|
||||
|
||||
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];
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
try {
|
||||
@@ -327,9 +311,9 @@ public class TeamsFragment extends Fragment {
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText(match_latest_values[i].name);
|
||||
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];
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
try {
|
||||
@@ -361,9 +345,9 @@ public class TeamsFragment extends Fragment {
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText(match_latest_values[i].name);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-34
@@ -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 -> {
|
||||
if(edited) save();
|
||||
settingsManager.setMatchNum(cur_match_num+1);
|
||||
@@ -111,6 +101,14 @@ public class MatchScoutingFragment extends Fragment {
|
||||
// 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();
|
||||
update_scouting_data();
|
||||
|
||||
@@ -142,15 +140,10 @@ public class MatchScoutingFragment extends Fragment {
|
||||
int cur_match_num;
|
||||
String username;
|
||||
String filename;
|
||||
|
||||
boolean edited = false;
|
||||
|
||||
ToggleTitleView[] titles;
|
||||
|
||||
AutoSaveManager asm = new AutoSaveManager(this::save);
|
||||
|
||||
ArrayList<dataType> dataTypes;
|
||||
|
||||
|
||||
|
||||
public void save(){
|
||||
@@ -203,16 +196,11 @@ public class MatchScoutingFragment extends Fragment {
|
||||
final ToggleTitleView ttv = new ToggleTitleView(getContext());
|
||||
ttv.setTitle(DataManager.match_latest_values[i].name);
|
||||
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;
|
||||
|
||||
|
||||
final View v = DataManager.match_latest_values[i].createView(getContext(), dataType -> {
|
||||
// edited = true;
|
||||
// edited = true;
|
||||
if(asm.isRunning)
|
||||
update_asm();
|
||||
return 0;
|
||||
@@ -225,19 +213,14 @@ public class MatchScoutingFragment extends Fragment {
|
||||
if(asm.isRunning)
|
||||
update_asm();
|
||||
|
||||
// System.out.println("Checked!");
|
||||
|
||||
if(enabled){
|
||||
DataManager.match_latest_values[fi].nullify();
|
||||
}else{
|
||||
}else
|
||||
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);
|
||||
}
|
||||
@@ -360,6 +343,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
ScoutingDataWriter.ParsedScoutingDataResult psdr = ScoutingDataWriter.load(filename, DataManager.match_values, DataManager.match_transferValues);
|
||||
dataType[] types = psdr.data.array;
|
||||
|
||||
|
||||
for(int i = 0; i < DataManager.match_latest_values.length; i++){
|
||||
// types[i] = latest_values[i].getViewValue();
|
||||
try {
|
||||
@@ -369,12 +353,8 @@ public class MatchScoutingFragment extends Fragment {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
((Activity) context).runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
((Activity) context).runOnUiThread(() -> {
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(context);
|
||||
alert.setMessage(sw.toString());
|
||||
alert.setTitle(e.getMessage());
|
||||
alert.setPositiveButton("OK", null);
|
||||
alert.setCancelable(true);
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(context);
|
||||
alert.setMessage(sw.toString());
|
||||
alert.setTitle(e.getMessage());
|
||||
alert.setPositiveButton("OK", null);
|
||||
alert.setCancelable(true);
|
||||
|
||||
alert.create().show();
|
||||
}
|
||||
alert.create().show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/transparent"/>
|
||||
<stroke android:width="2dip" android:color="#424242" />
|
||||
<stroke android:width="2dip" android:color="#626262" />
|
||||
<corners android:radius="3dip"/>
|
||||
<padding android:left="0dip"
|
||||
android:top="0dip"
|
||||
|
||||
@@ -1,24 +1,136 @@
|
||||
<?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/teamsMainElem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
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">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/teamsArea"
|
||||
<LinearLayout
|
||||
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>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
@@ -16,7 +17,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
@@ -26,27 +27,42 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:text="-"
|
||||
android:text="del"
|
||||
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
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Teams"
|
||||
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
|
||||
android:id="@+id/teams_plus_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:text="+"
|
||||
android:text="Add"
|
||||
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
|
||||
android:id="@+id/teamsTable"
|
||||
@@ -56,7 +72,7 @@
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
@@ -66,26 +82,41 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:text="-"
|
||||
android:text="del"
|
||||
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
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Matches"
|
||||
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
|
||||
android:id="@+id/matches_plus_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:text="+"
|
||||
android:text="Add"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
android:visibility="gone"
|
||||
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
|
||||
android:id="@+id/matchTable"
|
||||
|
||||
Reference in New Issue
Block a user