android.text.InputFilter.LengthFilter源码实例Demo

类android.text.InputFilter.LengthFilter源码实例Demo

下面列出了android.text.InputFilter.LengthFilter 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android-card-form   文件: CardEditText.java
private void updateCardType() {
    CardType type = CardType.forCardNumber(getText().toString());
    if (mCardType != type) {
        mCardType = type;

        InputFilter[] filters = { new LengthFilter(mCardType.getMaxCardLength()) };
        setFilters(filters);
        invalidate();

        if (mOnCardTypeChangedListener != null) {
            mOnCardTypeChangedListener.onCardTypeChanged(mCardType);
        }
    }
}
 
源代码2 项目: android-card-form   文件: MobileNumberEditText.java
private void init() {
    if (isInEditMode()) {
        return;
    }

    setInputType(InputType.TYPE_CLASS_PHONE);
    InputFilter[] filters = { new LengthFilter(14) };
    setFilters(filters);
    addTextChangedListener(new PhoneNumberFormattingTextWatcher());
}
 
源代码3 项目: android-card-form   文件: CvvEditText.java
/**
 * Sets the card type associated with the security code type. {@link CardType#AMEX} has a
 * different icon and length than other card types. Typically handled through
 * {@link com.braintreepayments.cardform.view.CardEditText.OnCardTypeChangedListener#onCardTypeChanged(com.braintreepayments.cardform.utils.CardType)}.
 *
 * @param cardType Type of card represented by the current value of card number input.
 */
public void setCardType(CardType cardType) {
    mCardType = cardType;

    InputFilter[] filters = { new LengthFilter(cardType.getSecurityCodeLength()) };
    setFilters(filters);

    setContentDescription(getContext().getString(cardType.getSecurityCodeName()));
    setFieldHint(cardType.getSecurityCodeName());

    invalidate();
}
 
源代码4 项目: android-card-form   文件: CvvEditText.java
private void init() {
    setInputType(InputType.TYPE_CLASS_NUMBER);
    setFilters(new InputFilter[]{new LengthFilter(DEFAULT_MAX_LENGTH)});
    addTextChangedListener(this);
}
 
private void setInputFilters() {
    LengthFilter lengthFilter = new LengthFilter(MAX_NUM_CHARS);
    DigitsOnlyFilter digitsOnlyFilter = DigitsOnlyFilter.newInstance(MAX_NUM_CHARS);
    InputFilter[] filters = { lengthFilter, digitsOnlyFilter};
    setFilters(filters);
}
 
源代码6 项目: android-card-form   文件: CountryCodeEditText.java
private void init() {
    setInputType(InputType.TYPE_CLASS_PHONE);
    InputFilter[] filters = { new LengthFilter(4) };
    setFilters(filters);
}
 
源代码7 项目: android-card-form   文件: PostalCodeEditText.java
private void init() {
    setInputType(InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS);
    InputFilter[] filters = { new LengthFilter(16) };
    setFilters(filters);
}
 
private void init() {
    setInputType(InputType.TYPE_CLASS_TEXT);
    InputFilter[] filters = { new LengthFilter(255) };
    setFilters(filters);
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 同包方法