Java Code Examples for android.text.InputType#TYPE_CLASS_NUMBER

The following examples show how to use android.text.InputType#TYPE_CLASS_NUMBER . 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 vote down vote up
/**
 * 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: ActionTestsBase.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
protected void doTestActionKey(final String tag, final InputMethodSubtype subtype,
        final EditorInfo editorInfo, final ExpectedActionKey expectedKey) {
    // Test text layouts.
    editorInfo.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL;
    final KeyboardLayoutSet layoutSet = createKeyboardLayoutSet(subtype, editorInfo);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_ALPHABET, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS_SHIFTED, expectedKey);
    // Test phone number layouts.
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE_SYMBOLS, expectedKey);
    // Test normal number layout.
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_NUMBER, expectedKey);
    // Test number password layout.
    editorInfo.inputType =
            InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
    final KeyboardLayoutSet passwordSet = createKeyboardLayoutSet(subtype, editorInfo);
    assertActionKey(tag, passwordSet, KeyboardId.ELEMENT_NUMBER, expectedKey);
}
 
Example 3
Source File: HtmlInput.java    From WiFiAfterConnect with Apache License 2.0 6 votes vote down vote up
public int getAndroidInputType () {
   	if (matchType (HtmlInput.TYPE_PASSWORD))
   		return InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD;
   	else if (matchType (HtmlInput.TYPE_EMAIL))
   		return InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
   	else if (matchType (TYPE_TEXT))
   		return InputType.TYPE_CLASS_TEXT;
   	else if (matchType (TYPE_NUMBER))
   		return InputType.TYPE_CLASS_NUMBER;
   	else if (matchType (TYPE_TEL))
   		return InputType.TYPE_CLASS_NUMBER;
   	else if (matchType (TYPE_DATE))
   		return InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_DATE;
   	else if (matchType (TYPE_DATETIME) |matchType (TYPE_DATETIME_LOCAL))
   		return InputType.TYPE_CLASS_DATETIME;
   	else if (matchType (TYPE_TIME))
   		return InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_TIME;
   	return 0;
}
 
Example 4
Source File: InputValidator.java    From AndroidVerify with Apache License 2.0 6 votes vote down vote up
/**
 * Get validator automatically according to EditText inputType
 */
private void autoValidator() {
    if(mEditText != null) {
        switch (mEditText.getInputType()) {
            case InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS:
                mValidatorNumber = IS_EMAIL;
                break;
            case InputType.TYPE_CLASS_PHONE:
                mValidatorNumber = IS_PHONE_NUMBER;
                break;
            case InputType.TYPE_CLASS_NUMBER:
                mValidatorNumber = IS_NUMERIC;
                break;
        }
    }
}
 
Example 5
Source File: GridPasswordView.java    From AndroidFrame with Apache License 2.0 6 votes vote down vote up
@Override
public void setPasswordType(PasswordType passwordType) {
    boolean visible = getPassWordVisibility();
    int inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
    switch (passwordType) {

        case TEXT:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
            break;

        case TEXTVISIBLE:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
            break;

        case TEXTWEB:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
            break;
    }

    for (TextView textView : mViewArr)
        textView.setInputType(inputType);

    setPasswordVisibility(visible);
}
 
Example 6
Source File: SubjectBaseActivity.java    From Primary with GNU General Public License v3.0 5 votes vote down vote up
private void showSoftKeyboard(final EditText view, ViewGroup keypadarea, String defaultInput) {

        view.clearFocus();

        if (defaultInput != null) {
            view.setText(defaultInput);
            view.setSelection(defaultInput.length());
        }
        boolean isnumeric = ((view.getInputType() & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER)
                         || ((view.getInputType() & InputType.TYPE_CLASS_DATETIME) == InputType.TYPE_CLASS_DATETIME);

        int whichkeyboard = Integer.parseInt(appPreferences.getString("keyboard_preference", "1"));
        int whichkeypad = Integer.parseInt(appPreferences.getString("keypad_preference", "1"));

        boolean gkeyboardAvail = getResources().getBoolean(R.bool.game_keyboard_available);
        boolean gkeypadAvail = getResources().getBoolean(R.bool.game_keypad_available);

        if (isnumeric && gkeypadAvail && whichkeypad == 1 && keypadarea != null) {
            Keyboard.showNumberpad(this, view, keypadarea, mNumpadkeyMap);

        } else if (!isnumeric && gkeyboardAvail && whichkeyboard == 1 && keypadarea != null) {
            Keyboard.showKeyboard(this, view, keypadarea, mKeyboardkeyMap);

        } else if (whichkeypad == 2 || whichkeyboard == 2 || (isnumeric && !gkeypadAvail) || (!isnumeric && !gkeyboardAvail)) {
            showSystemKeyboard(view);
        }


    }
 
Example 7
Source File: NewTraitDialog.java    From Field-Book with GNU General Public License v2.0 5 votes vote down vote up
public void prepareFields(int index) {
    TraitFormat traitFormat = traitFormats.getTraitFormatByIndex(index);

    details.setHint(traitFormat.detailsBox().getParameterHint());
    def.setHint(traitFormat.defaultBox().getParameterHint());
    minimum.setHint(traitFormat.minimumBox().getParameterHint());
    maximum.setHint(traitFormat.maximumBox().getParameterHint());

    defBox.setVisibility(viewVisibility(traitFormat.isDefBoxVisible()));
    def.setVisibility(viewVisibility(traitFormat.defaultBox().getParameterVisibility()));
    minBox.setVisibility(viewVisibility(traitFormat.minimumBox().getParameterVisibility()));
    maxBox.setVisibility(viewVisibility(traitFormat.maximumBox().getParameterVisibility()));
    bool.setVisibility(viewVisibility(traitFormat.isBooleanVisible()));
    categoryBox.setVisibility(viewVisibility(traitFormat.categoriesBox().getParameterVisibility()));

    minimum.setText(traitFormat.minimumBox().getParameterDefaultValue());
    maximum.setText(traitFormat.maximumBox().getParameterDefaultValue());
    def.setText(traitFormat.defaultBox().getParameterDefaultValue());

    if (traitFormat.isNumericInputType()) {
        final int inputType = InputType.TYPE_CLASS_NUMBER |
                InputType.TYPE_NUMBER_FLAG_DECIMAL;
        def.setInputType(inputType);
        minimum.setInputType(inputType);
        maximum.setInputType(inputType);
    }
}
 
Example 8
Source File: InputAttributes.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
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 9
Source File: KeyboardLayoutSet.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static int getKeyboardMode(final EditorInfo editorInfo) {
    final int inputType = editorInfo.inputType;
    final int variation = inputType & InputType.TYPE_MASK_VARIATION;

    switch (inputType & InputType.TYPE_MASK_CLASS) {
    case InputType.TYPE_CLASS_NUMBER:
        return KeyboardId.MODE_NUMBER;
    case InputType.TYPE_CLASS_DATETIME:
        switch (variation) {
        case InputType.TYPE_DATETIME_VARIATION_DATE:
            return KeyboardId.MODE_DATE;
        case InputType.TYPE_DATETIME_VARIATION_TIME:
            return KeyboardId.MODE_TIME;
        default: // InputType.TYPE_DATETIME_VARIATION_NORMAL
            return KeyboardId.MODE_DATETIME;
        }
    case InputType.TYPE_CLASS_PHONE:
        return KeyboardId.MODE_PHONE;
    case InputType.TYPE_CLASS_TEXT:
        if (InputTypeUtils.isEmailVariation(variation)) {
            return KeyboardId.MODE_EMAIL;
        } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) {
            return KeyboardId.MODE_URL;
        } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
            return KeyboardId.MODE_IM;
        } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
            return KeyboardId.MODE_TEXT;
        } else {
            return KeyboardId.MODE_TEXT;
        }
    default:
        return KeyboardId.MODE_TEXT;
    }
}
 
Example 10
Source File: KeyboardLayoutSet.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static int getKeyboardMode(final EditorInfo editorInfo) {
    final int inputType = editorInfo.inputType;
    final int variation = inputType & InputType.TYPE_MASK_VARIATION;

    switch (inputType & InputType.TYPE_MASK_CLASS) {
        case InputType.TYPE_CLASS_NUMBER:
            return KeyboardId.MODE_NUMBER;
        case InputType.TYPE_CLASS_DATETIME:
            switch (variation) {
                case InputType.TYPE_DATETIME_VARIATION_DATE:
                    return KeyboardId.MODE_DATE;
                case InputType.TYPE_DATETIME_VARIATION_TIME:
                    return KeyboardId.MODE_TIME;
                default: // InputType.TYPE_DATETIME_VARIATION_NORMAL
                    return KeyboardId.MODE_DATETIME;
            }
        case InputType.TYPE_CLASS_PHONE:
            return KeyboardId.MODE_PHONE;
        case InputType.TYPE_CLASS_TEXT:
            if (InputTypeUtils.isEmailVariation(variation)) {
                return KeyboardId.MODE_EMAIL;
            } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) {
                return KeyboardId.MODE_URL;
            } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
                return KeyboardId.MODE_IM;
            } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
                return KeyboardId.MODE_TEXT;
            } else {
                return KeyboardId.MODE_TEXT;
            }
        default:
            return KeyboardId.MODE_TEXT;
    }
}
 
Example 11
Source File: InputAttributes.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static String toInputClassString(final int inputClass) {
    switch (inputClass) {
    case InputType.TYPE_CLASS_TEXT:
        return "TYPE_CLASS_TEXT";
    case InputType.TYPE_CLASS_PHONE:
        return "TYPE_CLASS_PHONE";
    case InputType.TYPE_CLASS_NUMBER:
        return "TYPE_CLASS_NUMBER";
    case InputType.TYPE_CLASS_DATETIME:
        return "TYPE_CLASS_DATETIME";
    default:
        return String.format("unknownInputClass<0x%08x>", inputClass);
    }
}
 
Example 12
Source File: AdapterInputConnection.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@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 13
Source File: DigitInputView.java    From oneHookLibraryAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
    outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
    return null;
}
 
Example 14
Source File: JoH.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public int getInputType() {
    return InputType.TYPE_CLASS_NUMBER;
}
 
Example 15
Source File: InPlaceEditView.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
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: AdapterInputConnection.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@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: JoH.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public int getInputType() {
    return InputType.TYPE_CLASS_NUMBER;
}
 
Example 18
Source File: PinRestoreEntryFragment.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
private PinKeyboardType getPinEntryKeyboardType() {
  boolean isNumeric = (pinEntry.getInputType() & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_NUMBER;

  return isNumeric ? PinKeyboardType.NUMERIC : PinKeyboardType.ALPHA_NUMERIC;
}
 
Example 19
Source File: TextFieldImpl.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
void setConstraints(int constraints) {
	this.constraints = constraints;

	if (textview != null) {
		int inputtype;

		switch (constraints & TextField.CONSTRAINT_MASK) {
			default:
			case TextField.ANY:
				inputtype = InputType.TYPE_CLASS_TEXT;
				break;

			case TextField.EMAILADDR:
				inputtype = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
				break;

			case TextField.NUMERIC:
				inputtype = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED;
				break;

			case TextField.PHONENUMBER:
				inputtype = InputType.TYPE_CLASS_PHONE;
				break;

			case TextField.URL:
				inputtype = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI;
				break;

			case TextField.DECIMAL:
				inputtype = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL;
				break;
		}

		if ((constraints & TextField.PASSWORD) != 0 ||
				(constraints & TextField.SENSITIVE) != 0) {
			inputtype = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
		}

		if ((constraints & TextField.UNEDITABLE) != 0) {
			inputtype = InputType.TYPE_NULL;
		}

		if ((constraints & TextField.NON_PREDICTIVE) != 0) {
			inputtype |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
		}

		if ((constraints & TextField.INITIAL_CAPS_WORD) != 0) {
			inputtype |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
		}

		if ((constraints & TextField.INITIAL_CAPS_SENTENCE) != 0) {
			inputtype |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
		}

		textview.setInputType(inputtype);
		if ((constraints & TextField.CONSTRAINT_MASK) == TextField.ANY) {
			textview.setSingleLine(false);
		}
	}
}
 
Example 20
Source File: ItemPicker.java    From libcommon with Apache License 2.0 4 votes vote down vote up
@Override
public int getInputType() {
          return InputType.TYPE_CLASS_NUMBER;
      }