Work on improving null and undefined states

This commit is contained in:
Astatin3
2024-09-07 11:36:07 -06:00
parent 0eca044533
commit 665c11c9d8
6 changed files with 11 additions and 6 deletions
@@ -61,13 +61,15 @@ public class ScoutingDataWriter {
for(int i = 0; i < values[version].length; i++){
switch (objects.get(i+2).getType()){
case 1:
case 1: // Int
dataTypes[i] = intType.newNull(values[version][i].name);
dataTypes[i].forceSetValue(objects.get(i+2).get());
System.out.println("Loaded INT: " + values[version][i].name + ", ("+ dataTypes[i].get() +")");
break;
case 2:
case 2: // String
dataTypes[i] = stringType.newNull(values[version][i].name);
dataTypes[i].forceSetValue(objects.get(i+2).get());
System.out.println("Loaded STR: " + values[version][i].name + ", ("+ dataTypes[i].get() +")");
break;
}
}
@@ -3,6 +3,7 @@ package com.astatin3.scoutingapp2025.types.data;
public class intType extends dataType {
public static final int nullval = 0;
public static final int unselectedval = 1;
public static final int offset = 2;
public valueTypes getValueType() {
return valueTypes.NUM;
@@ -25,7 +26,7 @@ public class intType extends dataType {
public intType(String name, int value) {
super(name);
forceSetValue(value+2);
set(value);
}
public static intType newNull(String name){
@@ -19,7 +19,6 @@ public abstract class inputType {
public static final int notesType = 253;
public static final int tallyType = 252;
public enum inputTypes {
// USERNAME,
SLIDER,
DROPDOWN,
NOTES_INPUT,
@@ -79,8 +79,8 @@ public class sliderType extends inputType {
}
});
return slider;
}
public void setViewValue(Object value) {
if(slider == null) return;
if(intType.isNull((int) value)){
@@ -33,7 +33,7 @@ public class tallyType extends inputType {
public String get_type_name(){return "Dropdown";}
public tallyType(String name, int default_value){
super(name);
this.default_value = default_value+2;
this.default_value = default_value;
}
@@ -1,5 +1,7 @@
package com.astatin3.scoutingapp2025.types.input;
import static com.astatin3.scoutingapp2025.types.data.intType.offset;
import android.content.Context;
import android.graphics.Color;
import android.text.Editable;
@@ -28,6 +30,7 @@ import java.util.List;
import java.util.function.Function;
public class textType extends inputType {
public int get_byte_id() {return notesType;}
public inputTypes getInputType(){return inputTypes.NOTES_INPUT;}
public dataType.valueTypes getValueType(){return dataType.valueTypes.STRING;}