diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-01-23 12:44:08 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-01-23 12:44:08 +0100 |
commit | 39fdf4a333378affcca360886701851d84dd9e0b (patch) | |
tree | c2071acd108caee7a0a497f846dee3e9332e1821 /src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java | |
parent | 61408611437785ebe685aadfbca924cbc86340c1 (diff) |
added support for field types jid-single and text-private
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java new file mode 100644 index 00000000..b54940f6 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java @@ -0,0 +1,31 @@ +package eu.siacs.conversations.ui.forms; + +import android.content.Context; +import android.text.InputType; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; + +public class FormJidSingleFieldWrapper extends FormTextFieldWrapper { + + protected FormJidSingleFieldWrapper(Context context, Field field) { + super(context, field); + editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); + editText.setHint(R.string.account_settings_example_jabber_id); + } + + @Override + public boolean validates() { + String value = getValue(); + if (!value.isEmpty()) { + try { + Jid.fromString(value); + } catch (InvalidJidException e) { + return false; + } + } + return super.validates(); + } +} |