1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

AndroidGCS: Suppress some warnings related to not implementing the STRING uavfield type properly.

This commit is contained in:
James Cotton 2012-08-26 22:26:34 -05:00
parent a75e4e4e6f
commit 8cc49d125a
2 changed files with 32 additions and 19 deletions

View File

@ -93,6 +93,14 @@ public class ObjectEditView extends GridLayout {
((Spinner) fieldValue).setAdapter(adapter);
((Spinner) fieldValue).setSelection((int) field.getDouble(idx));
break;
case BITFIELD:
fieldValue = new EditText(context);
((EditText)fieldValue).setText(field.getValue(idx).toString());
((EditText)fieldValue).setInputType(InputType.TYPE_CLASS_NUMBER);
break;
case STRING:
fieldValue = new EditText(context);
((EditText)fieldValue).setText(field.getValue(idx).toString());
}
addView(fieldValue, new GridLayout.LayoutParams(spec(row), spec(1)));

View File

@ -578,6 +578,12 @@ public class UAVObjectField {
((ArrayList<Byte>) data).add((byte) 0);
}
break;
case STRING:
((ArrayList<Byte>) data).clear();
for(int index = 0; index < numElements; ++index) {
((ArrayList<Byte>) data).add((byte) 0);
}
break;
}
}
@ -633,7 +639,7 @@ public class UAVObjectField {
numBytesPerElement = 1;
break;
case STRING:
data = new ArrayList<String>(this.numElements);
data = new ArrayList<Byte>(this.numElements);
numBytesPerElement = 1;
break;
default:
@ -650,15 +656,9 @@ public class UAVObjectField {
*/
protected Long bound (Object val) {
switch(type) {
case ENUM:
case STRING:
return 0L;
case FLOAT32:
return ((Number) val).longValue();
}
long num = ((Number) val).longValue();
long num = 0;
if (isNumeric())
num = ((Number) val).longValue();
switch(type) {
case INT8:
@ -703,6 +703,11 @@ public class UAVObjectField {
if(num > 255)
return (long) 255;
return num;
case FLOAT32:
return ((Number) val).longValue();
case ENUM:
case STRING:
return 0L;
}
return num;