Coder Social home page Coder Social logo

morristech / creditcardedittext-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sathley/creditcardedittext

0.0 1.0 0.0 101 KB

A very simple android custom view based on EditText that lets you validate credit card numbers.

License: MIT License

Java 100.00%

creditcardedittext-1's Introduction

CreditCardEditText

Android Arsenal

A very simple custom view based on EditText that lets you validate credit card numbers.

USAGE

Simply add the CreditCardNumberEditText module into your app and add it as a dependency. Place the view in your layout example like this

<com.sathley.customviews.creditcardedittext.CcnEditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="Enter credit card number here..."
        android:id="@+id/CcnEditText"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="26dp"></com.sathley.customviews.creditcardedittext.CcnEditText>

You are free to customize it as you wish or extend it further. Then from your activity code, you can call the validate() function on the view anytime to check the validity of the text entered into it. It returns an enum value depicting the credit card type or if its an invalid number.

CcnEditText editText = (CcnEditText) findViewById(R.id.CcnEditText);
CcnTypeEnum type = editText.validate();

P.S. : Ccn is short for credit card number.

SUPPORTED CARD TYPES

The view identifies the folowing credit card types -

  • VISA
  • MASTERCARD
  • DISCOVER
  • JAPANESE_CREDIT_BUREAU
  • AMERICAN_EXPRESS
  • CHINA_UNIONPAY
  • MAESTRO

Kindly let me know your feedback or any feature requests. I'm available at [email protected]

creditcardedittext-1's People

Contributors

sathley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.