0

I have a problem with my Android application when used with the Samsung Keyboard on Android 6. When the user types a special char, like a dot or an asterisk, the next key is replaced by the last input char.
Example:

When user types:

mobile.abc  

Application receives:

mobile..bc

Additionally, I recorded a screencast with the behavior: youtube video.

My application is builded with Rhodes/Rhomobile and uses an integrated webkit browser, which the user agent is: Mozilla/5.0 (Linux; Android 6.0.1; SM-A510M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/54.0.2840.68 Mobile Safari/537.36.

The problem occurs only when the predictive text of Samsung Keyboard is turned on and only in Android 6+. I know that it could be an incompatibility between the integrated browser and the samsung keyboard, but I can't ask for all my users to turn it off only for use with my app. So I would like to have a workaround for this.

Thanks in advance by any help

Douglas Lise
  • 1,466
  • 1
  • 20
  • 46

2 Answers2

1

This seems to be a bug. Let's hope for a bugfix.

In the meantime, you can disable predictive text this way:

public class NoSuggestionsWebView extends WebView {
    public NoSuggestionsWebView(Context context) {
        super(context);
    }

    public NoSuggestionsWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public NoSuggestionsWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
        InputConnection ic = super.onCreateInputConnection(outAttrs);

        outAttrs.inputType &= ~EditorInfo.TYPE_MASK_VARIATION; /* clear VARIATION type to be able to set new value */
        outAttrs.inputType |= InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; /* WEB_PASSWORD type will prevent form suggestions */

        return ic;
    }
}

Source

However, I think disabling predictive text for the whole app will hurt UX. Perhaps you can find something in EditorInfo outAttrs to identify the problematic fields?

Community
  • 1
  • 1
gabrielmaldi
  • 2,157
  • 2
  • 23
  • 39
  • I have not access to these settings and classes, because I use a framework with these settings closed. But thanks a lot with your help. – Douglas Lise Nov 04 '16 at 11:52
0

The problem was caused by an update to the Android System WebView that have not been already fixed.
Further the post on AndroidCentral pointed by gabrielmaldi, there is another post referencing the issue.

As of the first post, the WebView version 55.0.2883.36 fixes the problem.

Community
  • 1
  • 1
Douglas Lise
  • 1,466
  • 1
  • 20
  • 46