├── settings.gradle ├── .DS_Store ├── paymentKitDroid ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ ├── .DS_Store │ │ │ └── paymentkit │ │ │ ├── PaymentCard.java │ │ │ ├── views │ │ │ ├── InterceptEditText.java │ │ │ ├── CVVEditText.java │ │ │ ├── CardIcon.java │ │ │ ├── CardNumHolder.java │ │ │ ├── ExpirationEditText.java │ │ │ ├── CardNumEditText.java │ │ │ └── FieldHolder.java │ │ │ ├── CardType.java │ │ │ ├── util │ │ │ ├── ToastUtils.java │ │ │ └── ViewUtils.java │ │ │ └── ValidateCreditCard.java │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── checkout_card_cvc.png │ │ │ ├── checkout_card_amex.png │ │ │ ├── checkout_card_master.png │ │ │ ├── checkout_card_paypal.png │ │ │ ├── checkout_card_visa.png │ │ │ ├── textfield_default.9.png │ │ │ ├── textfield_disabled.9.png │ │ │ ├── textfield_pressed.9.png │ │ │ ├── textfield_selected.9.png │ │ │ ├── checkout_card_discover.png │ │ │ ├── checkout_default_card.png │ │ │ ├── checkout_payment_icons.png │ │ │ ├── checkout_accepted_cards.png │ │ │ ├── textfield_pressed_holo.9.png │ │ │ ├── textfield_longpress_holo.9.png │ │ │ ├── textfield_search_default.9.png │ │ │ ├── textfield_search_pressed.9.png │ │ │ ├── textfield_search_selected.9.png │ │ │ ├── textfield_default_holo_dark.9.png │ │ │ ├── textfield_default_holo_light.9.png │ │ │ ├── textfield_disabled_holo_dark.9.png │ │ │ ├── textfield_disabled_selected.9.png │ │ │ ├── textfield_focused_holo_dark.9.png │ │ │ ├── textfield_focused_holo_light.9.png │ │ │ ├── textfield_activated_holo_dark.9.png │ │ │ ├── textfield_activated_holo_light.9.png │ │ │ ├── textfield_bg_default_holo_dark.9.png │ │ │ ├── textfield_bg_focused_holo_dark.9.png │ │ │ ├── textfield_disabled_holo_light.9.png │ │ │ ├── textfield_search_empty_default.9.png │ │ │ ├── textfield_search_empty_pressed.9.png │ │ │ ├── textfield_bg_activated_holo_dark.9.png │ │ │ ├── textfield_bg_disabled_holo_dark.9.png │ │ │ ├── textfield_search_empty_selected.9.png │ │ │ ├── textfield_search_default_holo_dark.9.png │ │ │ ├── textfield_search_default_holo_light.9.png │ │ │ ├── textfield_disabled_focused_holo_dark.9.png │ │ │ ├── textfield_disabled_focused_holo_light.9.png │ │ │ ├── textfield_multiline_default_holo_dark.9.png │ │ │ ├── textfield_multiline_default_holo_light.9.png │ │ │ ├── textfield_multiline_disabled_holo_dark.9.png │ │ │ ├── textfield_multiline_focused_holo_dark.9.png │ │ │ ├── textfield_multiline_focused_holo_light.9.png │ │ │ ├── textfield_bg_disabled_focused_holo_dark.9.png │ │ │ ├── textfield_multiline_activated_holo_dark.9.png │ │ │ ├── textfield_multiline_activated_holo_light.9.png │ │ │ ├── textfield_multiline_disabled_holo_light.9.png │ │ │ ├── textfield_multiline_disabled_focused_holo_dark.9.png │ │ │ └── textfield_multiline_disabled_focused_holo_light.9.png │ │ ├── drawable-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── checkout_card_cvc.png │ │ │ ├── checkout_card_amex.png │ │ │ ├── checkout_card_master.png │ │ │ ├── checkout_card_paypal.png │ │ │ ├── checkout_card_visa.png │ │ │ ├── checkout_card_discover.png │ │ │ ├── checkout_default_card.png │ │ │ └── checkout_payment_icons.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── checkout_card_amex.png │ │ │ ├── checkout_card_cvc.png │ │ │ ├── checkout_card_visa.png │ │ │ ├── checkout_card_master.png │ │ │ ├── checkout_card_paypal.png │ │ │ ├── checkout_default_card.png │ │ │ ├── checkout_card_discover.png │ │ │ └── checkout_payment_icons.png │ │ ├── drawable-ldpi │ │ │ ├── checkout_card_cvc.png │ │ │ ├── checkout_card_amex.png │ │ │ ├── checkout_card_master.png │ │ │ ├── checkout_card_paypal.png │ │ │ ├── checkout_card_visa.png │ │ │ ├── checkout_card_discover.png │ │ │ ├── checkout_default_card.png │ │ │ └── checkout_payment_icons.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── drawable │ │ │ ├── checkout_header_gradient.xml │ │ │ ├── toast_background.xml │ │ │ ├── checkout_next_btn_bg.xml │ │ │ ├── edit_text.xml │ │ │ └── edit_text_holo_light.xml │ │ └── layout │ │ │ ├── toast.xml │ │ │ ├── card_holder.xml │ │ │ └── field_holder.xml │ │ └── AndroidManifest.xml ├── libs │ └── nineoldandroids-2.4.0.jar └── build.gradle ├── pKExample ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── layout │ │ │ ├── activity_main.xml │ │ │ └── add_credit_card.xml │ │ ├── java │ │ └── com │ │ │ └── brendan │ │ │ └── pkexample │ │ │ ├── PKActivity.java │ │ │ └── PKFragment.java │ │ └── AndroidManifest.xml └── build.gradle ├── .gitignore ├── LICENSE ├── README.md └── import-summary.txt /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':paymentKitDroid' 2 | include ':pKExample' 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/.DS_Store -------------------------------------------------------------------------------- /paymentKitDroid/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /paymentKitDroid/libs/nineoldandroids-2.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/libs/nineoldandroids-2.4.0.jar -------------------------------------------------------------------------------- /pKExample/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/pKExample/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /pKExample/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/pKExample/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /pKExample/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/pKExample/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_cvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_cvc.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_cvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_cvc.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_cvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_cvc.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_amex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_amex.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_master.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_paypal.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_visa.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_default.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_pressed.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_selected.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_amex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_amex.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_master.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_paypal.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_visa.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_amex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_amex.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_master.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_paypal.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_visa.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_amex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_amex.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_cvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_cvc.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_visa.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_card_discover.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_default_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_default_card.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_payment_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_payment_icons.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_card_discover.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_default_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_default_card.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-ldpi/checkout_payment_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-ldpi/checkout_payment_icons.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_card_discover.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_default_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_default_card.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-mdpi/checkout_payment_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-mdpi/checkout_payment_icons.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_master.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_paypal.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_default_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_default_card.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/checkout_accepted_cards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/checkout_accepted_cards.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_pressed_holo.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_card_discover.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-xhdpi/checkout_payment_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-xhdpi/checkout_payment_icons.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_longpress_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_longpress_holo.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_pressed.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_selected.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_default_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_default_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_default_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_default_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_selected.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_focused_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_focused_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_activated_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_activated_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_activated_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_activated_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_default_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_default_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_default.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_pressed.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_activated_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_activated_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_disabled_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_disabled_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_empty_selected.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_search_default_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_default_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_default_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_disabled_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_bg_disabled_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_activated_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_dark.9.png -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/PaymentKit-Droid/master/paymentKitDroid/src/main/res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png -------------------------------------------------------------------------------- /pKExample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /pKExample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PK Example 5 | Settings 6 | Hello world! 7 | 8 | -------------------------------------------------------------------------------- /pKExample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 18sp 7 | 8 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable/checkout_header_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable/toast_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PaymentKit 5 | 6 | Please enter a valid card number 7 | 8 | Credit Card Expiration Field 9 | MM/YY 10 | 11 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ff444444 5 | #FFFFFF 6 | #BB000000 7 | #1f4579 8 | #80000000 9 | #00000000 10 | 11 | -------------------------------------------------------------------------------- /paymentKitDroid/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android-library' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 19 10 | } 11 | 12 | release { 13 | runProguard false 14 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 15 | } 16 | } 17 | 18 | dependencies { 19 | compile files('libs/nineoldandroids-2.4.0.jar') 20 | } 21 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable/checkout_next_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | 22 | # Android Studio 23 | /.idea/ 24 | build 25 | out 26 | *~ 27 | *.iml 28 | *.swp 29 | 30 | # Gradle files 31 | gradlew 32 | gradlew.bat 33 | gradle/ 34 | .gradle 35 | build/ 36 | -------------------------------------------------------------------------------- /pKExample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "19.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 19 10 | } 11 | 12 | buildTypes { 13 | release { 14 | runProguard false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | compile project(':paymentKitDroid') 22 | compile 'com.android.support:support-v4:+' 23 | } 24 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/java/com/paymentkit/PaymentCard.java: -------------------------------------------------------------------------------- 1 | package com.paymentkit; 2 | 3 | public class PaymentCard { 4 | 5 | private String mLastFourDigits; 6 | private CardType mCardType; 7 | private String mExpMonth; 8 | private String mExpYear; 9 | 10 | public String getExpirationMonth() { 11 | return mExpMonth; 12 | } 13 | 14 | public String getExpirationYear() { 15 | return mExpYear; 16 | } 17 | 18 | public CardType getCardType() { 19 | return mCardType; 20 | } 21 | 22 | public String getLastFourDigits() { 23 | return mLastFourDigits; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/layout/toast.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /pKExample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /pKExample/src/main/java/com/brendan/pkexample/PKActivity.java: -------------------------------------------------------------------------------- 1 | package com.brendan.pkexample; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | import android.support.v4.app.FragmentTransaction; 6 | import android.view.Window; 7 | 8 | /** 9 | * 10 | * @author Brendan Weinstein 11 | * http://www.brendanweinstein.me 12 | * 13 | */ 14 | public class PKActivity extends FragmentActivity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | getWindow().requestFeature(Window.FEATURE_NO_TITLE); 20 | setContentView(R.layout.activity_main); 21 | FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 22 | ft.add(R.id.fragment_holder, new PKFragment(), "CardFragment"); 23 | ft.commit(); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /paymentKitDroid/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /pKExample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/layout/card_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 26 | 27 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/java/com/paymentkit/views/InterceptEditText.java: -------------------------------------------------------------------------------- 1 | package com.paymentkit.views; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.widget.EditText; 8 | 9 | 10 | public class InterceptEditText extends EditText { 11 | 12 | private static final String TAG = InterceptEditText.class.getSimpleName(); 13 | 14 | public InterceptEditText(Context context) { 15 | super(context); 16 | setup(); 17 | } 18 | 19 | public InterceptEditText(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | setup(); 22 | } 23 | 24 | private void setup() { 25 | setOnClickListener(new OnClickListener() { 26 | @Override 27 | public void onClick(View v) { 28 | 29 | } 30 | }); 31 | } 32 | 33 | @Override 34 | public boolean onTouchEvent(MotionEvent e) { 35 | switch(e.getAction()) { 36 | case MotionEvent.ACTION_DOWN: 37 | return true; 38 | case MotionEvent.ACTION_UP: 39 | performClick(); 40 | } 41 | return true; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 23 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Brendan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PaymentKit-Droid 2 | ================ 3 | 4 | PaymentKit-Droid is an Open Source Android library that allows developers to create sleek payment forms like those made 5 | popular by StubHub, Stripe, Uber, and Postmates. The library provides support for as far back as 2.1. 6 | 7 | The PKExample provides an example implementation pattern you may follow. 8 | 9 | The 'PaymentKit Droid' folder is the library project you want to add to 10 | your Android project. See http://stackoverflow.com/questions/8248196/how-to-add-a-library-project-to-a-android-project. 11 | 12 | A sample app will soon be available on the google play store. 13 | 14 | Feel free to leave requests and feedback through github (brendanw) or twitter (elbrendan). 15 | 16 | You can also find my contact information at http://www.brendanweinstein.me 17 | 18 | Things to be added in the future:
19 | -Documentation
20 | -Better handling of spacing for landscape mode
21 | -Support for more cards
22 | -Removal of edittext assets and the addition of code for using default android edittext backgrounds
23 | -Ability to move cursor anywhere in expiration date field.
24 | -More error messaging ability options
25 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/java/com/paymentkit/CardType.java: -------------------------------------------------------------------------------- 1 | package com.paymentkit; 2 | 3 | public enum CardType { 4 | VISA(1, "Visa", false, 3), 5 | MASTERCARD(2, "Mastercard", false, 3), 6 | AMERICAN_EXPRESS(3, "American Express", false, 4), 7 | DISCOVER(4,"Discover", false, 3), 8 | UNKNOWN_CARD(5, "Unknown", true, 3), 9 | TOO_MANY_DIGITS(6, "Too Many Digits", true, 3), 10 | NOT_ENOUGH_DIGITS(7, "Not Enough Digits", true, 3); 11 | 12 | private int mVal; 13 | private String mName; 14 | private boolean mIsError; 15 | private int mMaxCVVLength; 16 | 17 | CardType(int val, String name, boolean isError, int maxCVVLength) { 18 | this.mVal = val; 19 | this.mName = name; 20 | this.mIsError = isError; 21 | } 22 | 23 | public int getValue() { 24 | return mVal; 25 | } 26 | 27 | public String getName() { 28 | return mName; 29 | } 30 | 31 | public boolean isError() { 32 | return mIsError; 33 | } 34 | 35 | public int getMaxCVVLength() { 36 | return mMaxCVVLength; 37 | } 38 | 39 | public static CardType fromString(String text) { 40 | if (text != null) { 41 | int num = Integer.parseInt(text); 42 | for (CardType c : CardType.values()) { 43 | if (c.mVal == num) { 44 | return c; 45 | } 46 | } 47 | } 48 | return CardType.UNKNOWN_CARD; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable/edit_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /paymentKitDroid/src/main/java/com/paymentkit/util/ToastUtils.java: -------------------------------------------------------------------------------- 1 | package com.paymentkit.util; 2 | 3 | import com.paymentkit.R; 4 | 5 | import android.app.Activity; 6 | import android.content.Context; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | import android.widget.Toast; 13 | 14 | public class ToastUtils { 15 | 16 | public static void showLongToast(Activity activity, int textResId) { 17 | String text = activity.getResources().getString(textResId); 18 | showLongToast(activity, text); 19 | } 20 | 21 | public static void showToast(Activity activity, int textResId) { 22 | String text = activity.getResources().getString(textResId); 23 | showToast(activity, text); 24 | } 25 | 26 | public static void showLongToast(Activity activity, String text) { 27 | showToast(activity, text, Toast.LENGTH_LONG); 28 | } 29 | 30 | public static void showToast(Activity activity, String text) { 31 | showToast(activity, text, Toast.LENGTH_SHORT); 32 | } 33 | 34 | public static void showToast(Context context, String text) { 35 | showToast((Activity) context, text, Toast.LENGTH_SHORT); 36 | } 37 | 38 | public static void showToast(Activity activity, String text, int duration) { 39 | Toast toast = makeToast(activity, text, duration); 40 | toast.show(); 41 | } 42 | 43 | public static Toast makeToast(Activity activity, int textResId, int duration) { 44 | String text = activity.getResources().getString(textResId); 45 | return makeToast(activity, text, duration); 46 | } 47 | 48 | private static Toast makeToast(Activity activity, String text, int duration) { 49 | LayoutInflater inflater = activity.getLayoutInflater(); 50 | View layout = inflater.inflate(R.layout.toast, (ViewGroup) activity.findViewById(R.id.toast_layout_root)); 51 | TextView textView = (TextView) layout.findViewById(R.id.text); 52 | textView.setText(text); 53 | Toast toast = new Toast(activity); 54 | toast.setGravity(Gravity.CENTER, 0, 0); 55 | toast.setDuration(duration); 56 | toast.setView(layout); 57 | return toast; 58 | } 59 | } -------------------------------------------------------------------------------- /pKExample/src/main/java/com/brendan/pkexample/PKFragment.java: -------------------------------------------------------------------------------- 1 | package com.brendan.pkexample; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.View.OnClickListener; 9 | import android.view.ViewGroup; 10 | import android.widget.Button; 11 | import android.widget.ImageView; 12 | 13 | import com.paymentkit.util.ToastUtils; 14 | import com.paymentkit.util.ViewUtils; 15 | import com.paymentkit.views.FieldHolder; 16 | import com.paymentkit.views.FieldHolder.InputStyle; 17 | 18 | /** 19 | * 20 | * @author Brendan Weinstein 21 | * http://www.brendanweinstein.me 22 | * 23 | */ 24 | public class PKFragment extends Fragment { 25 | 26 | private final static String TAG = PKFragment.class.getSimpleName(); 27 | 28 | public static final float INPUT_WIDTH = 0.94f; // defined in terms of screen 29 | // width 30 | private Button mSaveBtn; 31 | private ImageView mAcceptedCardsImg; 32 | private FieldHolder mFieldHolder; 33 | 34 | @Override 35 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 36 | View viewRoot = inflater.inflate(R.layout.add_credit_card, container, false); 37 | mSaveBtn = (Button) viewRoot.findViewById(R.id.save_btn); 38 | mAcceptedCardsImg = (ImageView) viewRoot.findViewById(R.id.accepted_cards); 39 | mFieldHolder = (FieldHolder) viewRoot.findViewById(R.id.field_holder); 40 | mSaveBtn.setOnClickListener(mSaveBtnListener); 41 | return viewRoot; 42 | } 43 | 44 | private OnClickListener mSaveBtnListener = new OnClickListener() { 45 | @Override 46 | public void onClick(View v) { 47 | ViewUtils.hideSoftKeyboard(getActivity()); 48 | if (mFieldHolder.isFieldsValid()) { 49 | ToastUtils.showToast(getActivity(), "Valid credit card entry!"); 50 | } 51 | } 52 | }; 53 | 54 | private void setupViews() { 55 | float marginLeft = 1.0f - INPUT_WIDTH; 56 | ViewUtils.setMarginLeft(mAcceptedCardsImg, (int) (marginLeft * ViewUtils.getScreenWidth(getActivity()))); 57 | ViewUtils.setWidth(mFieldHolder, (int) (INPUT_WIDTH * ViewUtils.getScreenWidth(getActivity()))); 58 | if(Build.VERSION.SDK_INT < 14) { 59 | mFieldHolder.setInputStyle(InputStyle.GINGERBREAD); 60 | } 61 | } 62 | 63 | /* After onCreateView is called */ 64 | @Override 65 | public void onActivityCreated(Bundle savedInstanceState) { 66 | super.onActivityCreated(savedInstanceState); 67 | setupViews(); 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /paymentKitDroid/src/main/res/drawable/edit_text_holo_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pKExample/src/main/res/layout/add_credit_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 23 | 24 | 29 | 30 | 34 | 35 |