Java Code Examples for android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE
The following examples show how to use
android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE .
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: InputAttributes.java From openboard with GNU General Public License v3.0 | 6 votes |
private static String toFlagsString(final int flags) { final ArrayList<String> flagsArray = new ArrayList<>(); if (0 != (flags & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)) flagsArray.add("TYPE_TEXT_FLAG_NO_SUGGESTIONS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_IME_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_WORDS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_WORDS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)) flagsArray.add("TYPE_TEXT_FLAG_CAP_SENTENCES"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_CHARACTERS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_CORRECT"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_COMPLETE"); return flagsArray.isEmpty() ? "" : Arrays.toString(flagsArray.toArray()); }
Example 2
Source File: InputAttributes.java From Indic-Keyboard with Apache License 2.0 | 6 votes |
private static String toFlagsString(final int flags) { final ArrayList<String> flagsArray = new ArrayList<>(); if (0 != (flags & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)) flagsArray.add("TYPE_TEXT_FLAG_NO_SUGGESTIONS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_IME_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_WORDS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_WORDS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)) flagsArray.add("TYPE_TEXT_FLAG_CAP_SENTENCES"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_CHARACTERS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_CORRECT"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_COMPLETE"); return flagsArray.isEmpty() ? "" : Arrays.toString(flagsArray.toArray()); }
Example 3
Source File: InputAttributes.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 6 votes |
private static String toFlagsString(final int flags) { final ArrayList<String> flagsArray = new ArrayList<>(); if (0 != (flags & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)) flagsArray.add("TYPE_TEXT_FLAG_NO_SUGGESTIONS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE)) flagsArray.add("TYPE_TEXT_FLAG_IME_MULTI_LINE"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_WORDS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_WORDS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)) flagsArray.add("TYPE_TEXT_FLAG_CAP_SENTENCES"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS)) flagsArray.add("TYPE_TEXT_FLAG_CAP_CHARACTERS"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_CORRECT"); if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE)) flagsArray.add("TYPE_TEXT_FLAG_AUTO_COMPLETE"); return flagsArray.isEmpty() ? "" : Arrays.toString(flagsArray.toArray()); }
Example 4
Source File: InputTestsBase.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); mEditText = new MyEditText(getContext()); final int inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_MULTI_LINE; mEditText.setInputType(inputType); mEditText.setEnabled(true); mLastCursorPos = 0; if (null == Looper.myLooper()) { Looper.prepare(); } setupService(); mLatinIME = getService(); setDebugMode(true); mPreviousBigramPredictionSettings = setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, true, true /* defaultValue */); mPreviousAutoCorrectSetting = setBooleanPreference(Settings.PREF_AUTO_CORRECTION, DEFAULT_AUTO_CORRECTION, DEFAULT_AUTO_CORRECTION); mLatinIME.onCreate(); EditorInfo ei = new EditorInfo(); final InputConnection ic = mEditText.onCreateInputConnection(ei); final LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final ViewGroup vg = new FrameLayout(getContext()); mInputView = inflater.inflate(R.layout.input_view, vg); ei = enrichEditorInfo(ei); mLatinIME.onCreateInputMethodInterface().startInput(ic, ei); mLatinIME.setInputView(mInputView); mLatinIME.onBindInput(); mLatinIME.onCreateInputView(); mLatinIME.onStartInputView(ei, false); mInputConnection = ic; changeLanguage("en_US"); // Run messages to avoid the messages enqueued by startInputView() and its friends // to run on a later call and ruin things. We need to wait first because some of them // can be posted with a delay (notably, MSG_RESUME_SUGGESTIONS) sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS); runMessages(); }
Example 5
Source File: ChatFragmentSendMessageHelper.java From revolution-irc with GNU General Public License v3.0 | 5 votes |
public void setAutocorrectEnabled(boolean enabled) { boolean wasMultiline = (mSendText.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; if (enabled) mSendText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); else mSendText.setInputType(InputType.TYPE_CLASS_TEXT); if (wasMultiline) mSendText.setInputType(mSendText.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE); }
Example 6
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 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: 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 9
Source File: ReactEditText.java From react-native-GPay with MIT License | 4 votes |
private boolean isMultiline() { return (getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 10
Source File: KeyboardId.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 4 votes |
public boolean isMultiLine() { return (mEditorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 11
Source File: KeyboardId.java From simple-keyboard with Apache License 2.0 | 4 votes |
public boolean isMultiLine() { return (mEditorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 12
Source File: InputAttributes.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 4 votes |
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode, final String packageNameForPrivateImeOptions) { mEditorInfo = editorInfo; mPackageNameForPrivateImeOptions = packageNameForPrivateImeOptions; mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null; final int inputType = null != editorInfo ? editorInfo.inputType : 0; final int inputClass = inputType & InputType.TYPE_MASK_CLASS; mInputType = inputType; mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType) || InputTypeUtils.isVisiblePasswordInputType(inputType); if (inputClass != InputType.TYPE_CLASS_TEXT) { // If we are not looking at a TYPE_CLASS_TEXT field, the following strange // cases may arise, so we do a couple sanity checks for them. If it's a // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction // of the flags. if (null == editorInfo) { Log.w(TAG, "No editor info for this field. Bug?"); } else if (InputType.TYPE_NULL == inputType) { // TODO: We should honor TYPE_NULL specification. Log.i(TAG, "InputType.TYPE_NULL is specified"); } else if (inputClass == 0) { // TODO: is this check still necessary? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); } mShouldShowSuggestions = false; mInputTypeNoAutoCorrect = false; mApplicationSpecifiedCompletionOn = false; mShouldInsertSpacesAutomatically = false; mShouldShowVoiceInputKey = false; mDisableGestureFloatingPreviewText = false; mIsGeneralTextInput = false; return; } // inputClass == InputType.TYPE_CLASS_TEXT final int variation = inputType & InputType.TYPE_MASK_VARIATION; final boolean flagNoSuggestions = 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); final boolean flagMultiLine = 0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE); final boolean flagAutoCorrect = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); final boolean flagAutoComplete = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); // TODO: Have a helper method in InputTypeUtils // Make sure that passwords are not displayed in {@link SuggestionStripView}. final boolean shouldSuppressSuggestions = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || InputType.TYPE_TEXT_VARIATION_FILTER == variation || flagNoSuggestions || flagAutoComplete; mShouldShowSuggestions = !shouldSuppressSuggestions; mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType); final boolean noMicrophone = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || hasNoMicrophoneKeyOption(); mShouldShowVoiceInputKey = !noMicrophone; mDisableGestureFloatingPreviewText = InputAttributes.inPrivateImeOptions( mPackageNameForPrivateImeOptions, NO_FLOATING_GESTURE_PREVIEW, editorInfo); // If it's a browser edit field and auto correct is not ON explicitly, then // disable auto correction, but keep suggestions on. // If NO_SUGGESTIONS is set, don't do prediction. // If it's not multiline and the autoCorrect flag is not set, then don't correct mInputTypeNoAutoCorrect = (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect) || flagNoSuggestions || (!flagAutoCorrect && !flagMultiLine); mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; // If we come here, inputClass is always TYPE_CLASS_TEXT mIsGeneralTextInput = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_PHONETIC != variation && InputType.TYPE_TEXT_VARIATION_URI != variation && InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD != variation; }
Example 13
Source File: InputAttributes.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 4 votes |
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) { mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null; final int inputType = null != editorInfo ? editorInfo.inputType : 0; final int inputClass = inputType & InputType.TYPE_MASK_CLASS; mInputType = inputType; mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType) || InputTypeUtils.isVisiblePasswordInputType(inputType); if (inputClass != InputType.TYPE_CLASS_TEXT) { // If we are not looking at a TYPE_CLASS_TEXT field, the following strange // cases may arise, so we do a couple sanity checks for them. If it's a // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction // of the flags. if (null == editorInfo) { Log.w(TAG, "No editor info for this field. Bug?"); } else if (InputType.TYPE_NULL == inputType) { // TODO: We should honor TYPE_NULL specification. Log.i(TAG, "InputType.TYPE_NULL is specified"); } else if (inputClass == 0) { // TODO: is this check still necessary? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); } mShouldShowSuggestions = false; mInputTypeNoAutoCorrect = false; mApplicationSpecifiedCompletionOn = false; mShouldInsertSpacesAutomatically = false; return; } // inputClass == InputType.TYPE_CLASS_TEXT final int variation = inputType & InputType.TYPE_MASK_VARIATION; final boolean flagNoSuggestions = 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); final boolean flagMultiLine = 0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE); final boolean flagAutoCorrect = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); final boolean flagAutoComplete = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); // TODO: Have a helper method in InputTypeUtils // Make sure that passwords are not displayed in {@link SuggestionStripView}. final boolean shouldSuppressSuggestions = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || InputType.TYPE_TEXT_VARIATION_FILTER == variation || flagNoSuggestions || flagAutoComplete; mShouldShowSuggestions = !shouldSuppressSuggestions; mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType); // If it's a browser edit field and auto correct is not ON explicitly, then // disable auto correction, but keep suggestions on. // If NO_SUGGESTIONS is set, don't do prediction. // If it's not multiline and the autoCorrect flag is not set, then don't correct mInputTypeNoAutoCorrect = (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect) || flagNoSuggestions || (!flagAutoCorrect && !flagMultiLine); mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; }
Example 14
Source File: KeyboardId.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 4 votes |
public boolean isMultiLine() { return (mEditorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 15
Source File: InPlaceEditView.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
private int getAndroidInputType(int codenameOneInputType, boolean multiline) { int type = mInputTypeMap.get(codenameOneInputType, -1); if (type == -1) { if (!multiline && hasConstraint(codenameOneInputType, TextArea.NUMERIC)) { type = InputType.TYPE_CLASS_NUMBER; } else if (!multiline && hasConstraint(codenameOneInputType, TextArea.DECIMAL)) { type = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED; } else if (!multiline && hasConstraint(codenameOneInputType, TextArea.EMAILADDR)) { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); } else if (hasConstraint(codenameOneInputType, TextArea.INITIAL_CAPS_SENTENCE)) { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); } else if (hasConstraint(codenameOneInputType, TextArea.INITIAL_CAPS_WORD)) { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); } else if (!multiline && hasConstraint(codenameOneInputType, TextArea.PASSWORD)) { type = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; } else if (!multiline && hasConstraint(codenameOneInputType, TextArea.PHONENUMBER)) { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_PHONE); } else if (!multiline && hasConstraint(codenameOneInputType, TextArea.URL)) { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); } else { type = makeNonPredictive(codenameOneInputType, InputType.TYPE_CLASS_TEXT); } } // If we're editing standard text, disable auto complete. // The name of the flag is a little misleading. From the docs: // the text editor is performing auto-completion of the text being entered // based on its own semantics, which it will present to the user as they type. // This generally means that the input method should not be showing candidates itself, // but can expect for the editor to supply its own completions/candidates from // InputMethodSession.displayCompletions(). if ((type & InputType.TYPE_CLASS_TEXT) != 0 && (type & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) == 0) { type |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; } if (multiline) { type |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; } return type; }
Example 16
Source File: InputAttributes.java From Indic-Keyboard with Apache License 2.0 | 4 votes |
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode, final String packageNameForPrivateImeOptions) { mEditorInfo = editorInfo; mPackageNameForPrivateImeOptions = packageNameForPrivateImeOptions; mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null; final int inputType = null != editorInfo ? editorInfo.inputType : 0; final int inputClass = inputType & InputType.TYPE_MASK_CLASS; mInputType = inputType; mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType) || InputTypeUtils.isVisiblePasswordInputType(inputType); if (inputClass != InputType.TYPE_CLASS_TEXT) { // If we are not looking at a TYPE_CLASS_TEXT field, the following strange // cases may arise, so we do a couple sanity checks for them. If it's a // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction // of the flags. if (null == editorInfo) { Log.w(TAG, "No editor info for this field. Bug?"); } else if (InputType.TYPE_NULL == inputType) { // TODO: We should honor TYPE_NULL specification. Log.i(TAG, "InputType.TYPE_NULL is specified"); } else if (inputClass == 0) { // TODO: is this check still necessary? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); } mShouldShowSuggestions = false; mInputTypeNoAutoCorrect = false; mApplicationSpecifiedCompletionOn = false; mShouldInsertSpacesAutomatically = false; mShouldShowVoiceInputKey = false; mDisableGestureFloatingPreviewText = false; mIsGeneralTextInput = false; mNoLearning = false; return; } // inputClass == InputType.TYPE_CLASS_TEXT final int variation = inputType & InputType.TYPE_MASK_VARIATION; final boolean flagNoSuggestions = 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); final boolean flagMultiLine = 0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE); final boolean flagAutoCorrect = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); final boolean flagAutoComplete = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); // TODO: Have a helper method in InputTypeUtils // Make sure that passwords are not displayed in {@link SuggestionStripView}. final boolean shouldSuppressSuggestions = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || InputType.TYPE_TEXT_VARIATION_FILTER == variation || flagNoSuggestions || flagAutoComplete; mShouldShowSuggestions = !shouldSuppressSuggestions; mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType); final boolean noMicrophone = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || hasNoMicrophoneKeyOption(); mShouldShowVoiceInputKey = !noMicrophone; mDisableGestureFloatingPreviewText = InputAttributes.inPrivateImeOptions( mPackageNameForPrivateImeOptions, NO_FLOATING_GESTURE_PREVIEW, editorInfo); // If it's a browser edit field and auto correct is not ON explicitly, then // disable auto correction, but keep suggestions on. // If NO_SUGGESTIONS is set, don't do prediction. // If it's not multiline and the autoCorrect flag is not set, then don't correct mInputTypeNoAutoCorrect = (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect) || flagNoSuggestions || (!flagAutoCorrect && !flagMultiLine); mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; // If we come here, inputClass is always TYPE_CLASS_TEXT mIsGeneralTextInput = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_PHONETIC != variation && InputType.TYPE_TEXT_VARIATION_URI != variation && InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD != variation; mNoLearning = (editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING) != 0; }
Example 17
Source File: KeyboardId.java From openboard with GNU General Public License v3.0 | 4 votes |
public boolean isMultiLine() { return (mEditorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 18
Source File: KeyboardId.java From Indic-Keyboard with Apache License 2.0 | 4 votes |
public boolean isMultiLine() { return (mEditorInfo.inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }
Example 19
Source File: InputAttributes.java From openboard with GNU General Public License v3.0 | 4 votes |
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode, final String packageNameForPrivateImeOptions) { mEditorInfo = editorInfo; mPackageNameForPrivateImeOptions = packageNameForPrivateImeOptions; mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null; final int inputType = null != editorInfo ? editorInfo.inputType : 0; final int inputClass = inputType & InputType.TYPE_MASK_CLASS; mInputType = inputType; mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType) || InputTypeUtils.isVisiblePasswordInputType(inputType); if (inputClass != InputType.TYPE_CLASS_TEXT) { // If we are not looking at a TYPE_CLASS_TEXT field, the following strange // cases may arise, so we do a couple sanity checks for them. If it's a // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction // of the flags. if (null == editorInfo) { Log.w(TAG, "No editor info for this field. Bug?"); } else if (InputType.TYPE_NULL == inputType) { // TODO: We should honor TYPE_NULL specification. Log.i(TAG, "InputType.TYPE_NULL is specified"); } else if (inputClass == 0) { // TODO: is this check still necessary? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); } mShouldShowSuggestions = false; mInputTypeNoAutoCorrect = false; mApplicationSpecifiedCompletionOn = false; mShouldInsertSpacesAutomatically = false; mShouldShowVoiceInputKey = false; mDisableGestureFloatingPreviewText = false; mIsGeneralTextInput = false; mNoLearning = false; return; } // inputClass == InputType.TYPE_CLASS_TEXT final int variation = inputType & InputType.TYPE_MASK_VARIATION; final boolean flagNoSuggestions = 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); final boolean flagMultiLine = 0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE); final boolean flagAutoCorrect = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); final boolean flagAutoComplete = 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); // TODO: Have a helper method in InputTypeUtils // Make sure that passwords are not displayed in {@link SuggestionStripView}. final boolean shouldSuppressSuggestions = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || InputType.TYPE_TEXT_VARIATION_FILTER == variation //|| flagNoSuggestions || flagAutoComplete; mShouldShowSuggestions = !shouldSuppressSuggestions; mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType); final boolean noMicrophone = mIsPasswordField || InputTypeUtils.isEmailVariation(variation) || InputType.TYPE_TEXT_VARIATION_URI == variation || hasNoMicrophoneKeyOption(); mShouldShowVoiceInputKey = !noMicrophone; mDisableGestureFloatingPreviewText = InputAttributes.inPrivateImeOptions( mPackageNameForPrivateImeOptions, NO_FLOATING_GESTURE_PREVIEW, editorInfo); // If it's a browser edit field and auto correct is not ON explicitly, then // disable auto correction, but keep suggestions on. // If NO_SUGGESTIONS is set, don't do prediction. // If it's not multiline and the autoCorrect flag is not set, then don't correct mInputTypeNoAutoCorrect = (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect) || flagNoSuggestions || (!flagAutoCorrect && !flagMultiLine); mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; // If we come here, inputClass is always TYPE_CLASS_TEXT mIsGeneralTextInput = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_PHONETIC != variation && InputType.TYPE_TEXT_VARIATION_URI != variation && InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD != variation && InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != variation && InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD != variation; mNoLearning = (editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING) != 0; }
Example 20
Source File: EditTextController.java From NexusDialog with Apache License 2.0 | 2 votes |
/** * Indicates whether this text box has multi-line enabled. * * @return true if this text box has multi-line enabled, or false otherwise */ public boolean isMultiLine() { return (inputType | InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0; }