Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5ff5dbf authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Handle the Tab key by moving to the next textfield. And ensure

there is always a way to get to the next field.

http://b/issue?id=2414236 and http://b/issue?id=2414229
parent 7040ce78
Loading
Loading
Loading
Loading
+17 −24
Original line number Diff line number Diff line
@@ -145,6 +145,12 @@ import java.util.ArrayList;
                break;
        }

        if (KeyEvent.KEYCODE_TAB == keyCode) {
            if (down) {
                onEditorAction(EditorInfo.IME_ACTION_NEXT);
            }
            return true;
        }
        Spannable text = (Spannable) getText();
        int oldLength = text.length();
        // Normally the delete key's dom events are sent via onTextChanged.
@@ -819,6 +825,7 @@ import java.util.ArrayList;
                break;
            case 2: // PASSWORD
                inPassword = true;
                imeOptions |= EditorInfo.IME_ACTION_GO;
                break;
            case 3: // SEARCH
                imeOptions |= EditorInfo.IME_ACTION_SEARCH;
@@ -826,20 +833,22 @@ import java.util.ArrayList;
            case 4: // EMAIL
                // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents EMAIL_ADDRESS
                // from working, so exclude it for now.
                inputType = EditorInfo.TYPE_CLASS_TEXT
                        | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
                imeOptions |= EditorInfo.IME_ACTION_GO;
                break;
            case 5: // NUMBER
                inputType = EditorInfo.TYPE_CLASS_NUMBER;
                inputType |= EditorInfo.TYPE_CLASS_NUMBER;
                // Number and telephone do not have both a Tab key and an
                // action, so set the action to NEXT
                imeOptions |= EditorInfo.IME_ACTION_NEXT;
                break;
            case 6: // TELEPHONE
                inputType = EditorInfo.TYPE_CLASS_PHONE;
                inputType |= EditorInfo.TYPE_CLASS_PHONE;
                imeOptions |= EditorInfo.IME_ACTION_NEXT;
                break;
            case 7: // URL
                // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents URI
                // from working, so exclude it for now.
                inputType = EditorInfo.TYPE_CLASS_TEXT
                        | EditorInfo.TYPE_TEXT_VARIATION_URI;
                // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so
                // exclude it for now.
                imeOptions |= EditorInfo.IME_ACTION_GO;
                break;
            default:
                break;
@@ -855,22 +864,6 @@ import java.util.ArrayList;
                    mWebView.requestFormData(name, mNodePointer);
                }
            }
            if (type != 3 /* SEARCH */) {
                int action = mWebView.nativeTextFieldAction();
                switch (action) {
                    // Keep in sync with CachedRoot::ImeAction
                    case 0: // NEXT
                        imeOptions |= EditorInfo.IME_ACTION_NEXT;
                        break;
                    case 1: // GO
                        imeOptions |= EditorInfo.IME_ACTION_GO;
                        break;
                    case -1: // FAILURE
                    case 2: // DONE
                        imeOptions |= EditorInfo.IME_ACTION_DONE;
                        break;
                }
            }
        }
        mSingle = single;
        setMaxLength(maxLength);
+0 −2
Original line number Diff line number Diff line
@@ -6784,8 +6784,6 @@ public class WebView extends AbsoluteLayout
    private native void     nativeSetFindIsUp();
    private native void     nativeSetFollowedLink(boolean followed);
    private native void     nativeSetHeightCanMeasure(boolean measure);
    // Returns a value corresponding to CachedFrame::ImeAction
    /* package */ native int  nativeTextFieldAction();
    private native int      nativeTextGeneration();
    // Never call this version except by updateCachedTextfield(String) -
    // we always want to pass in our generation number.