checkout / frames-android

Frames Android: making native card payments simple
https://www.checkout.com/docs/integrate/sdks/android-sdk
MIT License
51 stars 35 forks source link

More card details refactor #17

Closed john-ohalloran-cko closed 5 years ago

john-ohalloran-cko commented 5 years ago

Proposed changes

Quite a lot of structural change in this PR:

From the end-user perspective the API is now pretty close to the final state: the API consumer creates a CheckoutClient (mandatory), a FormCustomizer (optional) and calls initialize() on the PaymentForm with these objects. This achieves a clear separation of the ApiClient (CheckoutClient), the UI (PaymentForm) and the object to set defaults for the form (FormCustomizer).

I simplified the levels of view hierarchy: TouchlessViewPager and CustomAdapter are gone; instead PaymentForm hosts two views (CardDetails and BillingDetails) and I implemented the animations to transition between these two views so that it looks like it did before (SlidingViewAnimator). I chose this solution because it allows easy customization of transitions (simply drop in new transition xmls like slide_out_right.xml), it keeps the view hierarchies quite simple, and it avoids making any assumptions about where the library consumer hosts the Form (they can be using Activity / AppCompatActivity / Fragment / SupportFragment).

Types of changes

Checklist