Java Code Examples for android.view.inputmethod.EditorInfo#TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
The following examples show how to use
android.view.inputmethod.EditorInfo#TYPE_TEXT_VARIATION_WEB_EDIT_TEXT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdapterInputConnection.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@VisibleForTesting AdapterInputConnection(View view, ImeAdapter imeAdapter, EditorInfo outAttrs) { super(view, true); mInternalView = view; mImeAdapter = imeAdapter; mImeAdapter.setInputConnection(this); mSingleLine = true; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_FLAG_NO_EXTRACT_UI; outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT; if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeText) { // Normal text field outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTextArea || imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeContentEditable) { // TextArea or contenteditable. outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NONE; mSingleLine = false; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypePassword) { // Password outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeSearch) { // Search outAttrs.imeOptions |= EditorInfo.IME_ACTION_SEARCH; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeUrl) { // Url // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so // exclude it for now. outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeEmail) { // Email outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTel) { // Telephone // Number and telephone do not have both a Tab key and an // action in default OSK, so set the action to NEXT outAttrs.inputType = InputType.TYPE_CLASS_PHONE; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeNumber) { // Number outAttrs.inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } outAttrs.initialSelStart = imeAdapter.getInitialSelectionStart(); outAttrs.initialSelEnd = imeAdapter.getInitialSelectionEnd(); mLastUpdateSelectionStart = imeAdapter.getInitialSelectionStart(); mLastUpdateSelectionEnd = imeAdapter.getInitialSelectionEnd(); }
Example 2
Source File: AdapterInputConnection.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@VisibleForTesting AdapterInputConnection(View view, ImeAdapter imeAdapter, EditorInfo outAttrs) { super(view, true); mInternalView = view; mImeAdapter = imeAdapter; mImeAdapter.setInputConnection(this); mSingleLine = true; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_FLAG_NO_EXTRACT_UI; outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT; if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeText) { // Normal text field outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTextArea || imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeContentEditable) { // TextArea or contenteditable. outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NONE; mSingleLine = false; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypePassword) { // Password outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeSearch) { // Search outAttrs.imeOptions |= EditorInfo.IME_ACTION_SEARCH; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeUrl) { // Url // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so // exclude it for now. outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeEmail) { // Email outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTel) { // Telephone // Number and telephone do not have both a Tab key and an // action in default OSK, so set the action to NEXT outAttrs.inputType = InputType.TYPE_CLASS_PHONE; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeNumber) { // Number outAttrs.inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } outAttrs.initialSelStart = imeAdapter.getInitialSelectionStart(); outAttrs.initialSelEnd = imeAdapter.getInitialSelectionEnd(); mLastUpdateSelectionStart = imeAdapter.getInitialSelectionStart(); mLastUpdateSelectionEnd = imeAdapter.getInitialSelectionEnd(); }