Android EditText For Credit Card Numbers

Overview

Android Arsenal JitPack Playstore Donate


Edit Credit Logo

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 {
  ...
  implementation 'com.github.Mostafa-MA-Saleh:EditCredit:2.2.0'
}

Changelog

v 2.2.0

  • Added support for Diners Club cards.
  • Removed the deprecated methods and constants.
  • Updated dependencies.
  • Other minor improvements.

v 2.1.3

  • Updated dependencies.
  • Minor enhancements.

v 2.1.2

  • Added instant experience to the demo app.
  • Minor enhancements.

v 2.1.1

  • Reduced the drawables' sizes.
  • Fixed the blurry card images on some devices.
  • Updated the target SDK.
  • Added dark mode support to the demo app.
  • Other minor enhancements.

v 2.1.0

  • Fixed the card icon size on Android Pie (API 28).

v 2.0.0

  • Added the ability to get the card type.
  • Rewrote the library in kotlin.
  • Migrated to AndroidX.

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
diners

Public Methods

return Name/Description
Card getCardType()
Returns the current card type.
String getTextWithoutSeparator()
Returns the card number without the separators.
boolean isCardValid()
Validates the entered card number.
void setSeparator(Separator)
Sets the separator style.
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

<mostafa.ma.saleh.gmail.com.editcredit.EditCredit
        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.

PayPal

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 <http://unlicense.org>
You might also like...
Use Android Data Binding wih Live Data to glue View Model and Android

Gruop-C Spliff Summary Use Android Data Binding wih Live Data to glue View Model and Android. Asynchronous communications implemented with KotlinX Cor

DogglersApp - Criação de um App para estudo de RecyclerView no Android Studio. Parte do curso Android Basics in Kotlin

Dogglers - Starter Code Starter code for the second independent project for Android Basics in Kotlin. Introduction This is the starter code for the Do

Basic-Android-Project - A Basic Android Project with proper structure and all necessary dependencies

Basic-Android-Project A Basic Android Project with proper structure and all nece

Android Data Managment System Android UI - Kotlin- Firebase
Android Data Managment System Android UI - Kotlin- Firebase

DataManagmentSystem Data Managment System Android UI - Kotlin- Firebase Android Data Managment System App Design And Kotlin with Firebase The project

Tictactoe-android-app - Simple TicTacToe Android app written in Kotlin
Tictactoe-android-app - Simple TicTacToe Android app written in Kotlin

TicTacToe Android App This is a simple example of TicTacToe game as Android app

Android login spring - Android login against spring backend

Android Jetpack Compose login implementation with JWT tokens against our own bac

Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt
Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt

Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt.

Android library to help enter, and more importantly, leave, android "Immersive Mode".

Immersive Lock Android has various ways to full screen an application including locking the screen to prevent accidentally leaving the app. This is pa

Proxidize Android - Create 5G/4G Mobile Proxies on Android Phones
Proxidize Android - Create 5G/4G Mobile Proxies on Android Phones

Proxidize Android is an Android application that allows anyone to create a 5G or 4G mobile proxy using their phone. Learn more about Proxidize on https://proxidize.com/

Comments
  • Logo Proposal For EditCredit

    Logo Proposal For EditCredit

    Hello Sir. I'm a UI/UX and Graphics Designer. I want propose a logo for your github project. Would you mind if I propose logo for your application as my Open Source Contribution?

    Thanks before. Regards, @iqbalhood

    enhancement 
    opened by iqbalhood 5
Releases(3.0.1)
Owner
Mostafa Said
I’ve always liked challenges, and for me there is nothing more challenging than writing programs, because it’s always pushing me to learn and try new things.
Mostafa Said
Api Rest Card Game made in Kotlin with Ktor

ApiRest-CardGame "Card Game API" is a project made in Kotlin with Ktor. The API allows you to manage a simple card game deck (shuffle, take a card, pu

null 0 Dec 4, 2021
AppD-Task1 - A simple basic app with use of card view and toast

AppD-Task1 Made a simple basic app with use of card view and toast. Screenshots

Akshat Singh 0 Jan 29, 2022
AndroidIDE - an IDE for Android to develop full featured Android apps on Android smartphones.

AndroidIDE - an IDE for Android to develop full featured Android apps on Android smartphones.

Akash Yadav 615 Dec 27, 2022
Aggregated Android news, articles, podcasts and conferences about Android Development

DroidFeed Curated news feed for Android Developers! Stay up to date with the latest Android Development news. Built for the Android developer communit

Dogan Gulcan 183 Dec 2, 2022
Shreyas Patil 2.2k Jan 4, 2023
🎓 Learning Kotlin Coroutines for Android by example. 🚀 Sample implementations for real-world Android use cases. 🛠 Unit tests included!

Kotlin Coroutines - Use Cases on Android ?? Learning Kotlin Coroutines for Android by example. ?? Sample implementations for real-world Android use ca

Lukas Lechner 2.1k Jan 3, 2023
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project

Welcome to Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project ?? Codelab de android para practicar apps Android con Kotlin ?? Homepage

null 0 Oct 23, 2021
Meu primeiro aplicativo Android desenvolvido com Kotlin e Android Studio.

Cálculos 3 em 1 Este é um aplicativo Android que oferece três tipos de cálculos: calcular o IMC, calcular o valor do IPVA e converter medidas. Esse ap

Viviane Bresolin 0 Oct 30, 2021