Java Code Examples for android.text.InputType#TYPE_CLASS_TEXT
The following examples show how to use
android.text.InputType#TYPE_CLASS_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: DigitsKeyListener.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Returns the input type for the listener. */ public int getInputType() { int contentType; if (mNeedsAdvancedInput) { contentType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL; } else { contentType = InputType.TYPE_CLASS_NUMBER; if (mSign) { contentType |= InputType.TYPE_NUMBER_FLAG_SIGNED; } if (mDecimal) { contentType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; } } return contentType; }
Example 2
Source File: CharInputType.java From MaskFormatter with Apache License 2.0 | 6 votes |
public static int getKeyboardTypeForNextChar(char nextChar) { if (Character.isDigit(nextChar)) { return InputType.TYPE_CLASS_NUMBER; } switch (nextChar) { case 'd': return InputType.TYPE_CLASS_NUMBER; case 'A': case 'Z': case '%': return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; } return InputType.TYPE_CLASS_TEXT; }
Example 3
Source File: GridPasswordView.java From AndroidFrame with Apache License 2.0 | 6 votes |
private void setCustomAttr(TextView view) { if (mTextColor != null) view.setTextColor(mTextColor); view.setTextSize(mTextSize); int inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD; switch (mPasswordType) { case 1: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; break; case 2: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; break; case 3: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; break; } view.setInputType(inputType); view.setTransformationMethod(mTransformationMethod); }
Example 4
Source File: FreeScrollingTextField.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION | EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI; if (_inputConnection == null) { _inputConnection = this.new TextFieldInputConnection(this); } else { _inputConnection.resetComposingState(); } return _inputConnection; }
Example 5
Source File: AbstractEditComponent.java From ucar-weex-core with Apache License 2.0 | 5 votes |
private int getInputType(String type) { int inputType; switch (type) { case Constants.Value.TEXT: inputType = InputType.TYPE_CLASS_TEXT; break; case Constants.Value.DATE: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.DATETIME: inputType = InputType.TYPE_CLASS_DATETIME; break; case Constants.Value.EMAIL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case Constants.Value.PASSWORD: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; getHostView().setTransformationMethod(PasswordTransformationMethod.getInstance()); break; case Constants.Value.TEL: inputType = InputType.TYPE_CLASS_PHONE; break; case Constants.Value.TIME: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.URL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI; break; case Constants.Value.NUMBER: inputType = InputType.TYPE_CLASS_NUMBER; break; default: inputType = InputType.TYPE_CLASS_TEXT; } return inputType; }
Example 6
Source File: SDLActivity.java From android-port with GNU General Public License v3.0 | 5 votes |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; }
Example 7
Source File: FreeScrollingTextField.java From CodeEditor with Apache License 2.0 | 5 votes |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION | EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI; if (_inputConnection == null) { _inputConnection = this.new TextFieldInputConnection(this); } else { _inputConnection.resetComposingState(); } return _inputConnection; }
Example 8
Source File: SearchView.java From zhangshangwuda with Apache License 2.0 | 5 votes |
/** * Updates the auto-complete text view. */ private void updateSearchAutoComplete() { // TODO mQueryTextView.setDropDownAnimationStyle(0); // no animation mQueryTextView.setThreshold(mSearchable.getSuggestThreshold()); mQueryTextView.setImeOptions(mSearchable.getImeOptions()); int inputType = mSearchable.getInputType(); // We only touch this if the input type is set up for text (which it almost certainly // should be, in the case of search!) if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) { // The existence of a suggestions authority is the proxy for "suggestions // are available here" inputType &= ~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; if (mSearchable.getSuggestAuthority() != null) { inputType |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; // TYPE_TEXT_FLAG_AUTO_COMPLETE means that the text editor is performing // auto-completion based on its own semantics, which it will present to the user // as they type. This generally means that the input method should not show its // own candidates, and the spell checker should not be in action. The text editor // supplies its candidates by calling InputMethodManager.displayCompletions(), // which in turn will call InputMethodSession.displayCompletions(). inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; } } mQueryTextView.setInputType(inputType); if (mSuggestionsAdapter != null) { mSuggestionsAdapter.changeCursor(null); } // attach the suggestions adapter, if suggestions are available // The existence of a suggestions authority is the proxy for "suggestions available here" if (mSearchable.getSuggestAuthority() != null) { mSuggestionsAdapter = new SuggestionsAdapter(getContext(), this, mSearchable, mOutsideDrawablesCache); mQueryTextView.setAdapter(mSuggestionsAdapter); ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement( mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY); } }
Example 9
Source File: InputAttributes.java From openboard with GNU General Public License v3.0 | 5 votes |
private static String toVariationString(final int inputClass, final int variation) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return toTextVariationString(variation); case InputType.TYPE_CLASS_NUMBER: return toNumberVariationString(variation); case InputType.TYPE_CLASS_DATETIME: return toDatetimeVariationString(variation); default: return ""; } }
Example 10
Source File: SDLActivity.java From simpleSDL with MIT License | 5 votes |
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; }
Example 11
Source File: CopyTextItem.java From passman-android with GNU General Public License v3.0 | 5 votes |
@OnClick(R.id.copy_btn_toggle_visible) public void toggleVisibility() { switch (text.getInputType()) { case InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD: text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); toggle.setImageDrawable(getResources().getDrawable(R.drawable.ic_eye_off_grey)); break; case InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); toggle.setImageDrawable(getResources().getDrawable(R.drawable.ic_eye_grey)); break; } }
Example 12
Source File: PasswordEntryActivity.java From spark-setup-android with Apache License 2.0 | 5 votes |
private void togglePasswordVisibility(boolean showPassword) { int inputType; if (showPassword) { inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; } else { inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; } passwordBox.setInputType(inputType); }
Example 13
Source File: DateTimeKeyListener.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public int getInputType() { if (mNeedsAdvancedInput) { return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL; } else { return InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_NORMAL; } }
Example 14
Source File: SearchView.java From zen4android with MIT License | 5 votes |
/** * Updates the auto-complete text view. */ private void updateSearchAutoComplete() { // TODO mQueryTextView.setDropDownAnimationStyle(0); // no animation mQueryTextView.setThreshold(mSearchable.getSuggestThreshold()); mQueryTextView.setImeOptions(mSearchable.getImeOptions()); int inputType = mSearchable.getInputType(); // We only touch this if the input type is set up for text (which it almost certainly // should be, in the case of search!) if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) { // The existence of a suggestions authority is the proxy for "suggestions // are available here" inputType &= ~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; if (mSearchable.getSuggestAuthority() != null) { inputType |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; // TYPE_TEXT_FLAG_AUTO_COMPLETE means that the text editor is performing // auto-completion based on its own semantics, which it will present to the user // as they type. This generally means that the input method should not show its // own candidates, and the spell checker should not be in action. The text editor // supplies its candidates by calling InputMethodManager.displayCompletions(), // which in turn will call InputMethodSession.displayCompletions(). inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; } } mQueryTextView.setInputType(inputType); if (mSuggestionsAdapter != null) { mSuggestionsAdapter.changeCursor(null); } // attach the suggestions adapter, if suggestions are available // The existence of a suggestions authority is the proxy for "suggestions available here" if (mSearchable.getSuggestAuthority() != null) { mSuggestionsAdapter = new SuggestionsAdapter(getContext(), this, mSearchable, mOutsideDrawablesCache); mQueryTextView.setAdapter(mSuggestionsAdapter); ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement( mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY); } }
Example 15
Source File: AbstractEditComponent.java From weex-uikit with MIT License | 5 votes |
private int getInputType(String type) { int inputType; switch (type) { case Constants.Value.TEXT: inputType = InputType.TYPE_CLASS_TEXT; break; case Constants.Value.DATE: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.DATETIME: inputType = InputType.TYPE_CLASS_DATETIME; break; case Constants.Value.EMAIL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case Constants.Value.PASSWORD: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; getHostView().setTransformationMethod(PasswordTransformationMethod.getInstance()); break; case Constants.Value.TEL: inputType = InputType.TYPE_CLASS_PHONE; break; case Constants.Value.TIME: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.URL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI; break; default: inputType = InputType.TYPE_CLASS_TEXT; } return inputType; }
Example 16
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 17
Source File: NumberPicker.java From NumberPicker with MIT License | 4 votes |
public int getInputType() { return InputType.TYPE_CLASS_TEXT; }
Example 18
Source File: ContactSelectionActivity.java From Silence with GNU General Public License v3.0 | 4 votes |
public static boolean isTextInput(EditText editText) { return (editText.getInputType() & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT; }
Example 19
Source File: NumberPicker.java From NewXmPluginSDK with Apache License 2.0 | 4 votes |
public int getInputType() { return InputType.TYPE_CLASS_TEXT; }
Example 20
Source File: EditTextViewModel.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @Override public FieldViewModel withValue(String data) { return new AutoValue_EditTextViewModel(uid(), label(), mandatory(), data, programStageSection(), null, editable(), null, description(), dataElement(),listCategoryOption(), storeBy(),row(), column(), categoryOptionCombo(),catCombo(), hint(), maxLines(), InputType.TYPE_CLASS_TEXT, valueType(), warning(), error()); }