android+信用卡绑定,专门用于信用卡号码输入的Android EditText

625332134c6f4d4600884b99daebf603.png625332134c6f4d4600884b99daebf603.png625332134c6f4d4600884b99daebf603.png625332134c6f4d4600884b99daebf603.png

625332134c6f4d4600884b99daebf603.png

Custom EditText for entering Credit Card numbers, this EditText will also display the image of the card number type being entered (after entering the second digit). And supports adding a separator (spaces or dashes) after every four digits.

This version supports Visa, MasterCard, American Express and Discover cards.

Installation via Gradle:

Step 1. Add the JitPack repository to your root build.gradle at the end of repositories:

allprojects {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

Step 2. Add the dependency

dependencies {

...

compile 'com.github.Mostafa-MA-Saleh:EditCredit:1.7.1'

}

Changelog

v 1.7.1

Added support for Discover cards.

v 1.6.3

Minor bug fixes.

v 1.6.1

Updated the demo app to include the gravity options.

Added the ability to change the drawable gravity.

Deprecated setSeparator(int) and replaced it with setSeparator(Separator).

Deprecated setDisabledCards(int) and replaced it with setDisabledCards(Card...).

The minSDK is now 14 (because of AppCompat).

v 1.5.0

Added support for American Express.

Added the ability to disable cards.

Lowered the minSDK to 9.

Changed the demo app icon.

v 1.0.1

Changed the package name.

v 1.0

Initial Version.

Summary

XML attributes

Name

Description

values

separator

Sets the separator style

no_separator

spaces

dashes

drawableGravity

Sets the the location of the card drawable

start

end

left

right

disabledCards

Sets disabled cards

this can be multiple values seperated by "|"

(eg. app:disabledCards="visa|amex")

none

visa

mastercard

amex

discover

Public Methods

return

Name/Description

String

getTextWithoutSeparator()

Returns the card number without the separators.

boolean

isCardValid()

Validates the entered card number.

void

setSeparator(int)

Sets the separator style. This method has been depracted, use setSeparator(Separator) instead

void

setSeparator(Separator)

Sets the separator style.

void

setDisabledCards(int)

Sets the disabled cards. This method has been depracted, use setDisabledCards(Card...) instead

void

setDisabledCards(Card...)

Sets the disabled cards.

void

setDrawableGravity(Gravity)

Sets the location of the card drawable.

Usage

EditCredit can be used just like a normal EditText

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:disabledCards="visa|amex"

app:drawableGravity="end"

app:separator="spaces" />

Donation

If this project helps you, and you wanna buy me a cup of coffee.

625332134c6f4d4600884b99daebf603.png

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or

distribute this software, either in source code form or as a compiled

binary, for any purpose, commercial or non-commercial, and by any

means.

In jurisdictions that recognize copyright laws, the author or authors

of this software dedicate any and all copyright interest in the

software to the public domain. We make this dedication for the benefit

of the public at large and to the detriment of our heirs and

successors. We intend this dedication to be an overt act of

relinquishment in perpetuity of all present and future rights to this

software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR

OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,

ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值