mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
AndroidGCS: Fix the getDouble() method for enum fields and make the UAVO
browser properly initialize enums in editing mode
This commit is contained in:
parent
f04930b8cf
commit
ee54ca47f4
@ -91,6 +91,7 @@ public class ObjectEditView extends GridLayout {
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item);
|
||||
adapter.addAll(field.getOptions());
|
||||
((Spinner) fieldValue).setAdapter(adapter);
|
||||
((Spinner) fieldValue).setSelection((int) field.getDouble(idx));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,14 @@ public class UAVObjectField {
|
||||
}
|
||||
|
||||
public double getDouble() { return getDouble(0); };
|
||||
public double getDouble(int index) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public double getDouble(int index) {
|
||||
switch (type) {
|
||||
case ENUM:
|
||||
return ((List<Byte>)data).get(index);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ((Number) getValue(index)).doubleValue();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user