Loading repository data…
Loading repository data…
10bis / repository
A compact credit card input field that combines the number date and cvv into a single field
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A compact credit card input field that combines the number date and cvv into a single field
Add JitPack to your repositories
repositories {
maven { url "https://jitpack.io" }
}
And then add the dependency to your dependencies
dependencies {
implementation "com.github.10bis:compactCreditInput:$latest_version"
}
Add the view to your layout file
<com.tenbis.library.views.CompactCreditCardInput
android:id="@+id/compact_credit_card_input"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
You can further customize the field in your layout file by changing
card_backgroundcard_number_background_colorcard_date_background_colorcard_cvv_background_colorlabel_textlabel_text_colorlabel_text_fonttext_fonttext_colorhint_colorcard_number_hintcard_date_hintcard_cvv_hintOr in your code
cardBackgroundcardNumberBackgroundColorcardDateBackgroundColorcardCvvBackgroundColorlabelTextlabelTextColorlabelTextFonttextFonttextColorhintColorcardNumberHintcardDateHintcardCvvHintThe library notifies when a change occur using the OnCreditCardStateChanged interface
Once all fields have valid inputs
onCreditCardValid(creditCard: CreditCard)
Once a valid card number is entered
onCreditCardNumberValid(creditCardNumber: String)
Once a valid expiration date is entered
onCreditCardExpirationDateValid(month: Int, year: Int)
Once a valid cvv is entered
onCreditCardCvvValid(cvv: String)
Once the card type is found
onCreditCardTypeFound(cardType: CardType)
Once one of the fields is invalid
onInvalidCardTyped()
You can subscribe to events by calling
compactCreditCardInput.addOnCreditCardStateChangedListener(OnCreditCardStateChanged)
You can unsubscribe from events by calling
compactCreditCardInput.removeOnCreditCardStateChangedListener(OnCreditCardStateChanged)
The library can clean it self automatically when it has an attached Lifecycle
You can attach your lifecycle by calling
compactCreditCardInput.attachLifecycle(Lifecycle)
If you don't want to attach the lifecycle just call
compactCreditCardInput.onDestroy()
When your'e done with the field
Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
Please read CHANGELOG for details on what changes we're made
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details