Android Open Source - CreditCardEntry Main Activity






From Project

Back to project page CreditCardEntry.

License

The source code is released under:

MIT License

If you think the Android project CreditCardEntry 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.devmarvel.creditcardentrydemo;
//from w w w .j a  v a2 s . c om
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

import com.devmarvel.creditcardentry.library.CreditCard;
import com.devmarvel.creditcardentry.library.CreditCardForm;

public class MainActivity extends Activity {

  private LinearLayout linearLayout;
  private CreditCardForm form;

  private Button buttonAuthorize;
  
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    linearLayout = (LinearLayout) findViewById(R.id.layer);
    
    form = new CreditCardForm(this);
    linearLayout.addView(form);
    
    buttonAuthorize = (Button) findViewById(R.id.buttonAuthorize);
    buttonAuthorize.setOnClickListener(new OnClickListener() {
    
      @Override
      public void onClick(View arg0) {
        if(form.isCreditCardValid())
        {
          CreditCard card = form.getCreditCard();
          //Pass credit card to service
        }
        else
        {
          //Alert Credit card invalid
        }
      }
    });
  }

}




Java Source Code List

com.devmarvel.creditcardentry.fields.CreditCardText.java
com.devmarvel.creditcardentry.fields.CreditEntryFieldBase.java
com.devmarvel.creditcardentry.fields.ExpDateText.java
com.devmarvel.creditcardentry.fields.SecurityCodeText.java
com.devmarvel.creditcardentry.fields.ZipCodeText.java
com.devmarvel.creditcardentry.internal.CreditCardEntry.java
com.devmarvel.creditcardentry.internal.CreditCardUtil.java
com.devmarvel.creditcardentry.internal.FlipAnimator.java
com.devmarvel.creditcardentry.library.CreditCardForm.java
com.devmarvel.creditcardentry.library.CreditCard.java
com.devmarvel.creditcardentrydemo.MainActivity.java