Android: Show correct keyboard when using Gboard and Japanese layout

In 71a63836ed a workaround for Samsung
devices using ImhNoPredictiveText was included as there is a bug on
those devices. However this causes a problem with other keyboards such
as Gboard when using languages such as Japanese, as it would not show
the right keyboard at all and only showed a qwerty one in those cases.

Therefore we default to not working around the issue as it is more of a
problem to not allow certain keyboard layouts as opposed to having
predictive text even if it is turned off. For those who want to disable
predictive text and as such have the consequences of not showing some
keyboard layouts, they can set the
QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT environment
variable.

[ChangeLog][Platform Specific Changes][Android] Text fields with
ImhNoPredictiveText set are no longer working around keyboards that
disregard this setting. To enforce the workaround then the environment
variable - QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT
should be set.

Change-Id: I9ace7ba96ebad68987b53783e25067b66c002f25
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Andy Shaw 2019-02-11 11:33:56 +01:00
parent 8880ef7931
commit 11c728713f

View File

@ -346,7 +346,9 @@ public class QtActivityDelegate
}
} else if ((inputHints & ImhHiddenText) != 0) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
} else if ((inputHints & ImhSensitiveData) != 0 || (inputHints & ImhNoPredictiveText) != 0) {
} else if ((inputHints & ImhSensitiveData) != 0 ||
((inputHints & ImhNoPredictiveText) != 0 &&
System.getenv("QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT") != null)) {
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
}