当前位置: 首页>>代码示例>>Java>>正文


Java InputType.TYPE_CLASS_TEXT属性代码示例

本文整理汇总了Java中android.text.InputType.TYPE_CLASS_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Java InputType.TYPE_CLASS_TEXT属性的具体用法?Java InputType.TYPE_CLASS_TEXT怎么用?Java InputType.TYPE_CLASS_TEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.text.InputType的用法示例。


在下文中一共展示了InputType.TYPE_CLASS_TEXT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: autoValidator

/**
 * 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;
        }
    }
}
 
开发者ID:pchmn,项目名称:AndroidVerify,代码行数:18,代码来源:InputValidator.java

示例2: getType

private int getType(EditType editType) {
    int type;
    switch (editType) {
        case phone:
            type = InputType.TYPE_CLASS_PHONE;
            break;
        case number:
            type = InputType.TYPE_CLASS_NUMBER;
            break;
        case numberDecimal:
            type = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL;
            break;
        case textPassword:
            type = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
            break;
        case numberPassword:
            type = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
            break;
        default:
            type = InputType.TYPE_CLASS_TEXT;
    }
    return type;
}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:23,代码来源:EditTextWatcher.java

示例3: setKeyboardType

@ReactProp(name = "keyboardType")
public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) {
  int flagsToSet = InputType.TYPE_CLASS_TEXT;
  if (KEYBOARD_TYPE_NUMERIC.equalsIgnoreCase(keyboardType)) {
    flagsToSet = INPUT_TYPE_KEYBOARD_NUMBERED;
  } else if (KEYBOARD_TYPE_EMAIL_ADDRESS.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT;
  } else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) {
    flagsToSet = InputType.TYPE_CLASS_PHONE;
  }
  updateStagedInputTypeFlag(
      view,
      INPUT_TYPE_KEYBOARD_NUMBERED | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS |
          InputType.TYPE_CLASS_TEXT,
      flagsToSet);
  checkPasswordType(view);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ReactTextInputManager.java

示例4: onCreateInputConnection

@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
            | 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;

    return ic;
}
 
开发者ID:mattiascibien,项目名称:sdl2-cross-platform-vs2017,代码行数:10,代码来源:SDLActivity.java

示例5: toInputClassString

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);
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:14,代码来源:InputAttributes.java

示例6: getKeyboardMode

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;
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:34,代码来源:KeyboardLayoutSet.java

示例7: toggleVisibility

@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;
    }
}
 
开发者ID:nextcloud,项目名称:passman-android,代码行数:13,代码来源:CopyTextItem.java

示例8: getInputType

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;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:35,代码来源:AbstractEditComponent.java

示例9: getInputType

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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:38,代码来源:AbstractEditComponent.java

示例10: onCreateInputConnection

@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;
}
 
开发者ID:suikki,项目名称:simpleSDL,代码行数:10,代码来源:SDLActivity.java

示例11: getKeyboardMode

/**
 * 获取输入法键盘类型.
 */
private int getKeyboardMode(final EditorInfo editorInfo) {
    if (editorInfo == null) {
        return KeyBoardID.MODE_TEXT;
    }
    //
    final int inputType = editorInfo.inputType;
    final int variation = inputType & InputType.TYPE_MASK_VARIATION;
    // 根据 eidttext inputtype 返回软键盘类型.
    switch (inputType & InputType.TYPE_MASK_CLASS) {
        case InputType.TYPE_CLASS_NUMBER: // 数字键盘.
            // return KeyBoardID.MODE_NUMBER;
        case InputType.TYPE_CLASS_PHONE: // 显示符号键盘. phone拨号.
            // return KeyBoardID.MODE_PHONE;
        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_TEXT: // 显示输入字母的软键盘.
            if (KeyBoardUtils.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;
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:41,代码来源:EmojiIME.java

示例12: onStartInput

@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
    super.onStartInput(attribute, restarting);

    //get settings
    MyConfig.setSoundOn(sharedPref.getBoolean("play_sound", true));
    MyConfig.setSwitchIme(sharedPref.getBoolean("switch_ime", false));

    mComposing.setLength(0);

    if (!restarting) {
        // clear shift states.
        mMetaState = 0;
    }

    mPredictionOn = false;
    mCompletionOn = false;

    //initializing state base on the type of text being edited
    switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
        case InputType.TYPE_CLASS_NUMBER:
        case InputType.TYPE_CLASS_DATETIME:
            //Numbers and dates default to the symbols keyboard
            mCurKeyboard = getSymbolsKeyboard(getLocaleId());
            break;
        case InputType.TYPE_CLASS_PHONE:
            //Phones will default to phone keyboard
            switch (getLocaleId()) {
                case 1:
                    mCurKeyboard = enSymbolsKeyboard;
                    break;
                case 2:
                    mCurKeyboard = mySymbolsShiftedKeyboard;
                    break;
            }
            break;
        case InputType.TYPE_CLASS_TEXT:
            // for general text editing, default to normal alphabetic keyboard and doing predictive text
            mCurKeyboard = getKeyboard(getLocaleId());
            mPredictionOn = true;

            //looking for variation of text to modify the behavior
            int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
            if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
                //do not display prediction
                mPredictionOn = false;
            }

            if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == InputType.TYPE_TEXT_VARIATION_URI || variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
                //prediction will not be useful for e-mail and URIs.
                mPredictionOn = false;
            }

            if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
                //displaying prediction supplied by the editor if the input field is auto complete text view
                mPredictionOn = false;
                mCompletionOn = isFullscreenMode();
            }

            //looking at the current state of the editor to decide whether alphabetic keyboard should start out shifted
            updateShiftKeyState(attribute);
            break;

        default:
            //for all other input types, default to alphabetic keyboard of appropriate subtype
            mCurKeyboard = getKeyboard(getLocaleId());
            updateShiftKeyState(attribute);
    }
    //updating the label on enter key depending on what the application says it will do
    mCurKeyboard.setImeOptions(getResources(), attribute.imeOptions);
}
 
开发者ID:YehtutHl,项目名称:myan,代码行数:71,代码来源:SmartMyan.java

示例13: isTextInput

static boolean isTextInput(EditText editText) {
  return (editText.getInputType() & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:3,代码来源:ContactFilterToolbar.java

示例14: init

private void init(Context context, AttributeSet attrs) {
    //抗锯齿和位图滤波
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);

    //读取xml文件中的配置
    if (attrs != null) {
        TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PowerfulEditText);
        for (int i = 0; i < array.getIndexCount(); i++) {
            int attr = array.getIndex(i);

            switch (attr) {
                case R.styleable.PowerfulEditText_clearDrawable:
                    mClearResId = array.getResourceId(attr, DEFAULT_CLEAR_RES);
                    break;

                case R.styleable.PowerfulEditText_visibleDrawable:
                    mVisibleResId = array.getResourceId(attr, DEFAULT_VISIBLE_RES);
                    break;

                case R.styleable.PowerfulEditText_invisibleDrawable:
                    mInvisibleResId = array.getResourceId(attr, DEFAULT_INVISIBLE_RES);
                    break;

                case R.styleable.PowerfulEditText_BtnWidth:
                    mBtnWidth = array.getDimensionPixelSize(attr, DEFAULT_BUTTON_WIDTH);
                    break;

                case R.styleable.PowerfulEditText_BtnSpacing:
                    mBtnPadding = array.getDimensionPixelSize(attr, DEFAULT_BUTTON_PADDING);
                    break;

                case R.styleable.PowerfulEditText_borderStyle:
                    mBorderStyle = array.getString(attr);
                    break;

                case R.styleable.PowerfulEditText_styleColor:
                    mStyleColor = array.getColor(attr, DEFAULT_STYLE_COLOR);
                    break;
            }
        }
        array.recycle();
    }

    //初始化按钮显示的Bitmap
    mBitmapClear = createBitmap(context, mClearResId, DEFAULT_CLEAR_RES);
    mBitmapVisible = createBitmap(context, mVisibleResId, DEFAULT_VISIBLE_RES);
    mBitmapInvisible = createBitmap(context, mInvisibleResId, DEFAULT_INVISIBLE_RES);
    //如果自定义,则使用自定义的值,否则使用默认值
    if (mBtnPadding == 0) {
        mBtnPadding = DEFAULT_BUTTON_PADDING;
    }
    if (mBtnWidth == 0) {
        mBtnWidth = DEFAULT_BUTTON_WIDTH;
    }
    //给文字设置一个padding,避免文字和按钮重叠了
    mTextPaddingRight = mBtnPadding * 4 + mBtnWidth * 2;

    //按钮出现和消失的动画
    mGoneAnimator = ValueAnimator.ofFloat(1f, 0f).setDuration(ANIMATOR_TIME);
    mVisibleAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(ANIMATOR_TIME);

    //是否是密码样式
    isPassword =
            getInputType() == (InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);

}
 
开发者ID:AndroidWJC,项目名称:PowerfulEditText,代码行数:66,代码来源:PowerfulEditText.java

示例15: getInputType

public int getInputType() {
    return InputType.TYPE_CLASS_TEXT;
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:3,代码来源:NumberPicker.java


注:本文中的android.text.InputType.TYPE_CLASS_TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。