diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java index eba0f12d9..6cb357a90 100644 --- a/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java @@ -40,6 +40,15 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper { } @Override + protected void setValues(List<String> values) { + if (values.size() == 0) { + checkBox.setChecked(false); + } else { + checkBox.setChecked(Boolean.parseBoolean(values.get(0))); + } + } + + @Override public boolean validates() { if (checkBox.isChecked() || !field.isRequired()) { return true; @@ -63,4 +72,9 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper { protected int getLayoutResource() { return R.layout.form_boolean; } + + @Override + void setReadOnly(boolean readOnly) { + checkBox.setEnabled(!readOnly); + } } |