mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +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
22513bf6c8
commit
d6c2aad62a
@ -91,6 +91,7 @@ public class ObjectEditView extends GridLayout {
|
|||||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item);
|
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item);
|
||||||
adapter.addAll(field.getOptions());
|
adapter.addAll(field.getOptions());
|
||||||
((Spinner) fieldValue).setAdapter(adapter);
|
((Spinner) fieldValue).setAdapter(adapter);
|
||||||
|
((Spinner) fieldValue).setSelection((int) field.getDouble(idx));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,14 @@ public class UAVObjectField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getDouble() { return getDouble(0); };
|
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();
|
return ((Number) getValue(index)).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user