Commit d099e27c authored by Christian Strømme's avatar Christian Strømme Committed by Christian Stromme
Browse files

Android: Fix input method hints.


1. Add comment about the magic TYPE_NUMBER_VARIATION_PASSWORD value.
2. ImhHiddenText, ImhNoPredictiveText and ImhSensitiveData should all
   disable suggestions.
3. Only ImhSensitiveData sets TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
4. Don't OR date and time to get DateTime...

Task-number: QTBUG-38080
Change-Id: If456563983130e9af409ffa8cb717ddf259f1d6b
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
parent 0df7ab1c
Branches
Tags
No related merge requests found
Showing with 19 additions and 16 deletions
...@@ -265,30 +265,31 @@ public class QtActivityDelegate ...@@ -265,30 +265,31 @@ public class QtActivityDelegate
} }
if (Build.VERSION.SDK_INT > 10 && (inputHints & ImhHiddenText) != 0) if (Build.VERSION.SDK_INT > 10 && (inputHints & ImhHiddenText) != 0)
inputType |= 0x10; inputType |= 0x10 /* TYPE_NUMBER_VARIATION_PASSWORD */;
} else if ((inputHints & ImhDialableCharactersOnly) != 0) { } else if ((inputHints & ImhDialableCharactersOnly) != 0) {
inputType = android.text.InputType.TYPE_CLASS_PHONE; inputType = android.text.InputType.TYPE_CLASS_PHONE;
} else if ((inputHints & (ImhDate | ImhTime)) != 0) { } else if ((inputHints & (ImhDate | ImhTime)) != 0) {
inputType = android.text.InputType.TYPE_CLASS_DATETIME; inputType = android.text.InputType.TYPE_CLASS_DATETIME;
if ((inputHints & ImhDate) != 0) if ((inputHints & (ImhDate | ImhTime)) != (ImhDate | ImhTime)) {
inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_DATE; if ((inputHints & ImhDate) != 0)
if ((inputHints & ImhTime) != 0) inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_DATE;
inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_TIME; if ((inputHints & ImhTime) != 0)
inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_TIME;
} // else { TYPE_DATETIME_VARIATION_NORMAL(0) }
} else { // CLASS_TEXT } else { // CLASS_TEXT
if ((inputHints & ImhHiddenText) != 0) { if ((inputHints & (ImhEmailCharactersOnly | ImhUrlCharactersOnly)) != 0) {
if ((inputHints & ImhUrlCharactersOnly) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_URI;
imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO;
} else if ((inputHints & ImhEmailCharactersOnly) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
}
} else if ((inputHints & ImhHiddenText) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
} else if ((inputHints & (ImhNoAutoUppercase | ImhNoPredictiveText | ImhSensitiveData)) != 0) { } else if ((inputHints & ImhSensitiveData) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
} }
if ((inputHints & ImhEmailCharactersOnly) != 0)
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
if ((inputHints & ImhUrlCharactersOnly) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_URI;
imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO;
}
if ((inputHints & ImhMultiLine) != 0) if ((inputHints & ImhMultiLine) != 0)
inputType |= android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE; inputType |= android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE;
...@@ -300,8 +301,10 @@ public class QtActivityDelegate ...@@ -300,8 +301,10 @@ public class QtActivityDelegate
inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
} }
if ((inputHints & ImhNoPredictiveText) != 0 || (inputHints & ImhSensitiveData) != 0) if ((inputHints & ImhNoPredictiveText) != 0 || (inputHints & ImhSensitiveData) != 0
|| (inputHints & ImhHiddenText) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; inputType |= android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
} }
if ((inputHints & ImhMultiLine) != 0) if ((inputHints & ImhMultiLine) != 0)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment