TYPE_CLASS_NUMBER源码实例Demo

android.view.inputmethod.EditorInfo#TYPE_CLASS_NUMBER源码实例Demo

下面列出了android.view.inputmethod.EditorInfo#TYPE_CLASS_NUMBER 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FirefoxReality   文件: KeyboardWidget.java
private void resetKeyboardLayout() {
    if ((mEditorInfo.inputType & EditorInfo.TYPE_CLASS_NUMBER) == EditorInfo.TYPE_CLASS_NUMBER) {
        mKeyboardView.setKeyboard(getSymbolsKeyboard());
    } else {
        mKeyboardView.setKeyboard(mCurrentKeyboard.getAlphabeticKeyboard());
    }
    handleShift(false);
    updateCandidates();
}
 
源代码2 项目: PinView   文件: PinView.java
private static boolean isPasswordInputType(int inputType) {
    final int variation =
            inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
    return variation
            == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)
            || variation
            == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD)
            || variation
            == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
}
 
源代码3 项目: android-otpview-pinview   文件: OtpView.java
private static boolean isPasswordInputType(int inputType) {
  final int variation =
      inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
  return variation
      == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)
      || variation
      == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD)
      || variation
      == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
}
 
源代码4 项目: NoiseCapture   文件: SettingsFragment.java
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    if(preference instanceof EditTextPreference && newValue instanceof String) {
        EditText prefText = ((EditTextPreference) preference).getEditText();
        int editorType = prefText.getInputType();
        if(EditorInfo.TYPE_CLASS_NUMBER == (EditorInfo.TYPE_CLASS_NUMBER & editorType)) {
            // Try to convert to double
            double res;
            try {
                res = Double.valueOf((String)newValue);
            } catch (NumberFormatException ex) {
                return false;
            }
            if(EditorInfo.TYPE_NUMBER_FLAG_SIGNED != (EditorInfo.TYPE_NUMBER_FLAG_SIGNED & editorType)) {
                // Must be superior than 0
                if(res < 0) {
                    return false;
                }
            }
            if(EditorInfo.TYPE_NUMBER_FLAG_SIGNED != (EditorInfo.TYPE_NUMBER_FLAG_SIGNED & editorType)) {
                // Must be an integer
                if(Double.compare(res % 1,0) != 0) {
                    return false;
                }
            }
        }
        return true;
    }
    return true;
}
 
源代码5 项目: android-otpview-pinview   文件: OtpView.java
private static boolean isNumberInputType(int inputType) {
  return inputType == EditorInfo.TYPE_CLASS_NUMBER;
}
 
源代码6 项目: CodenameOne   文件: CodenameOneView.java
public void setInputType(EditorInfo editorInfo) {

        /**
         * do not use the enter key to fire some kind of action!
         */
//        editorInfo.imeOptions |= EditorInfo.IME_ACTION_NONE;
        Component txtCmp = Display.getInstance().getCurrent().getFocused();
        if (txtCmp != null && txtCmp instanceof TextArea) {
            TextArea txt = (TextArea) txtCmp;
            if (txt.isSingleLineTextArea()) {
                editorInfo.imeOptions |= EditorInfo.IME_ACTION_DONE;

            } else {
                editorInfo.imeOptions |= EditorInfo.IME_ACTION_NONE;
            }
            int inputType = 0;
            int constraint = txt.getConstraint();
            if ((constraint & TextArea.PASSWORD) == TextArea.PASSWORD) {
                constraint = constraint ^ TextArea.PASSWORD;
            }
            switch (constraint) {
                case TextArea.NUMERIC:
                    inputType = EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED;
                    break;
                case TextArea.DECIMAL:
                    inputType = EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL;
                    break;
                case TextArea.PHONENUMBER:
                    inputType = EditorInfo.TYPE_CLASS_PHONE;
                    break;
                case TextArea.EMAILADDR:
                    inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
                    break;
                case TextArea.URL:
                    inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_URI;
                    break;
                default:
                    inputType = EditorInfo.TYPE_CLASS_TEXT;
                    break;

            }

            editorInfo.inputType = inputType;
        }
    }