use of org.jivesoftware.smackx.xdata.FormField in project xabber-android by redsolution.
the class Feature method getSecurityOptions.
public Collection<SecurityValue> getSecurityOptions() {
FormField field = getField(SECURITY_FIELD);
if (field == null) {
return null;
}
Collection<SecurityValue> collection = new ArrayList<>();
List<FormField.Option> options = field.getOptions();
for (FormField.Option option : options) {
collection.add(SecurityValue.fromString(option.getValue()));
}
return collection;
}
use of org.jivesoftware.smackx.xdata.FormField in project xabber-android by redsolution.
the class Feature method getLoggingOptions.
public Collection<LoggingValue> getLoggingOptions() {
FormField field = getField(LOGGING_FIELD);
if (field == null) {
return null;
}
Collection<LoggingValue> collection = new ArrayList<>();
List<FormField.Option> options = field.getOptions();
for (FormField.Option option : options) {
collection.add(LoggingValue.fromString(option.getValue()));
}
return collection;
}
use of org.jivesoftware.smackx.xdata.FormField in project xabber-android by redsolution.
the class Feature method createDataForm.
public static DataForm createDataForm(DataFormType type) {
DataForm dataForm = new DataForm(DataForm.Type.fromString(type.toString()));
FormField typeField = new FormField(FORM_TYPE_FIELD);
typeField.addValue(FORM_TYPE_VALUE);
typeField.setType(FormField.Type.hidden);
dataForm.addField(typeField);
return dataForm;
}
use of org.jivesoftware.smackx.xdata.FormField in project xabber-android by redsolution.
the class Feature method addRequiredBooleanField.
private static void addRequiredBooleanField(DataForm dataForm, String name, String label, boolean value) {
FormField field = new FormField(name);
field.setRequired(true);
field.setLabel(label);
field.addValue(Boolean.valueOf(value).toString());
field.setType(FormField.Type.bool);
dataForm.addField(field);
}
use of org.jivesoftware.smackx.xdata.FormField in project xabber-android by redsolution.
the class Feature method addSecurityField.
public static void addSecurityField(DataForm dataForm, SecurityValue[] options, SecurityValue value) {
FormField field = new FormField(SECURITY_FIELD);
field.setRequired(false);
field.setLabel("Minimum security level");
field.setType(FormField.Type.list_single);
if (options != null)
for (SecurityValue loggingValue : options) field.addOption(loggingValue.createOption());
field.addValue(value.name());
dataForm.addField(field);
}
Aggregations