Some changes

This commit is contained in:
Astatin3
2024-09-04 19:34:06 -06:00
parent 79c10d1feb
commit 0eca044533
7 changed files with 15 additions and 15 deletions
@@ -25,10 +25,10 @@ public class ScoutingDataWriter {
for(int i = 0; i < data.length; i++){ for(int i = 0; i < data.length; i++){
switch (data[i].getValueType()){ switch (data[i].getValueType()){
case NUM: case NUM:
bb.addInt((int) data[i].get()); bb.addInt((int) data[i].forceGetValue());
break; break;
case STRING: case STRING:
bb.addString((String) data[i].get()); bb.addString((String) data[i].forceGetValue());
break; break;
} }
} }
@@ -62,12 +62,12 @@ public class ScoutingDataWriter {
for(int i = 0; i < values[version].length; i++){ for(int i = 0; i < values[version].length; i++){
switch (objects.get(i+2).getType()){ switch (objects.get(i+2).getType()){
case 1: case 1:
dataTypes[i] = new intType(values[version][i].name, (int) objects.get(i+2).get()); dataTypes[i] = intType.newNull(values[version][i].name);
dataTypes[i].forceSetValue(objects.get(i+2).get());
break; break;
case 2: case 2:
String name = values[version][i].name; dataTypes[i] = stringType.newNull(values[version][i].name);
String value = (String) objects.get(i+2).get(); dataTypes[i].forceSetValue(objects.get(i+2).get());
dataTypes[i] = new stringType(name, value);
break; break;
} }
} }
@@ -31,7 +31,7 @@ public class fields {
new sliderType("Overall Driving Performance", 5, 1, 10), new sliderType("Overall Driving Performance", 5, 1, 10),
new textType("Overall Driving Comments", "None"), new textType("Overall Driving Comments", "None"),
new sliderType("Score area (AMP <-> Speaker)", 5, 1, 10), new sliderType("Score area (AMP <-> Speaker)", 5, 1, 10),
new dropdownType("End Condition", new String[]{"Nothing", "Attempted Climb", "Successful Climbed", "Climbed with multiple robots", "Climbed with trapz"}, 1), new dropdownType("End Condition", new String[]{"Nothing", "Attempted Climb", "Successful Climbed", "Climbed with multiple robots", "Climbed with trap"}, 1),
new dropdownType("Robot Condition", new String[]{"Everything was working", "Something seemed to be broken", "Something was broken", "Missing robot (Joe Johnson)"}, 1), new dropdownType("Robot Condition", new String[]{"Everything was working", "Something seemed to be broken", "Something was broken", "Missing robot (Joe Johnson)"}, 1),
new textType("Other Comments", "None") new textType("Other Comments", "None")
} }
@@ -16,11 +16,11 @@ public class intType extends dataType {
// } // }
public Object get(){ public Object get(){
return (int) forceGetValue()+2; return (int) forceGetValue()-2;
} }
public void set(Object value){ public void set(Object value){
forceSetValue((int) value - 2); forceSetValue((int) value + 2);
} }
public intType(String name, int value) { public intType(String name, int value) {
@@ -25,7 +25,7 @@ public class stringType extends dataType{
public stringType(String name, String value) { public stringType(String name, String value) {
super(name); super(name);
forceSetValue(value+2); forceSetValue(value);
} }
public static stringType newNull(String name){ public static stringType newNull(String name){
@@ -115,7 +115,7 @@ public class dropdownType extends inputType {
// }); // });
return dropdown; return dropdown;
}; }
public void setViewValue(Object value) { public void setViewValue(Object value) {
if(dropdown == null) return; if(dropdown == null) return;
if(intType.isNull((int) value)){ if(intType.isNull((int) value)){
@@ -33,7 +33,7 @@ public class tallyType extends inputType {
public String get_type_name(){return "Dropdown";} public String get_type_name(){return "Dropdown";}
public tallyType(String name, int default_value){ public tallyType(String name, int default_value){
super(name); super(name);
this.default_value = default_value; this.default_value = default_value+2;
} }
@@ -73,14 +73,14 @@ 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); System.out.println(value);
if(((int)value) == 0){ if((int)value == intType.nullval || (int)value == intType.unselectedval){
nullify(); nullify();
return; return;
} }
isBlank = false; isBlank = false;
tally.setVisibility(View.VISIBLE); tally.setVisibility(View.VISIBLE);
tally.setValue((int)value); tally.setValue((int) value-2);
} }
public void nullify(){ public void nullify(){
isBlank = true; isBlank = true;
@@ -303,7 +303,7 @@ public class MatchScoutingFragment extends Fragment {
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();
DataManager.match_latest_values[i].setViewValue(types[i]); DataManager.match_latest_values[i].setViewValue(types[i].get());
if(DataManager.match_latest_values[i].isBlank){ if(DataManager.match_latest_values[i].isBlank){
titles[i].setBackgroundColor(0xffff0000); titles[i].setBackgroundColor(0xffff0000);