Android Open Source - CreditCardEditText Credit Card Text Watcher






From Project

Back to project page CreditCardEditText.

License

The source code is released under:

Apache License

If you think the Android project CreditCardEditText listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.alihafizji.library;
/*ww  w.  ja  va 2 s .  com*/
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;

/**
 * Created by kauserali on 05/05/14.
 */
public class CreditCardTextWatcher implements TextWatcher {

    private final EditText mEditText;
    private final TextWatcherListener mListener;

    public interface TextWatcherListener {
        void onTextChanged(EditText view, String text);
    }

    public CreditCardTextWatcher(EditText editText, TextWatcherListener listener) {
        mEditText = editText;
        mListener = listener;
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        mListener.onTextChanged(mEditText, s.toString());
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
}




Java Source Code List

com.alihafizji.MainActivity.java
com.alihafizji.library.CreditCardEditText.java
com.alihafizji.library.CreditCardPatterns.java
com.alihafizji.library.CreditCardTextWatcher.java
com.alihafizji.library.CreditCardTypeEnum.java
com.alihafizji.library.StringUtil.java