From 528dc36a96af3014f74f3321b70ca21987ad08fd Mon Sep 17 00:00:00 2001 From: ioan-ghisoi-cko Date: Thu, 15 Nov 2018 18:45:03 +0000 Subject: [PATCH] Update back button handler --- README.md | 4 ++-- .../android_sdk/View/BillingDetailsView.java | 16 +++++++++++++++- demos/examples/app/build.gradle | 2 +- demos/googlepay_example/app/build.gradle | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e3817bd4..266cdce86 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ dependencies { implementation 'com.android.support:design:27.1.1' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.android.volley:volley:1.0.0' - implementation 'com.github.checkout:frames-android:v2.0.4' + implementation 'com.github.checkout:frames-android:v2.0.5' } ``` -> You can find more about the installation [here](https://jitpack.io/#checkout/frames-android/v2.0.4) +> You can find more about the installation [here](https://jitpack.io/#checkout/frames-android/v2.0.5) > Please keep in mind that the Jitpack repository should to be added to the project gradle file while the dependency should be added in the module gradle file. [(see more about gradle files)](https://developer.android.com/studio/build) diff --git a/android-sdk/src/main/java/com/checkout/android_sdk/View/BillingDetailsView.java b/android-sdk/src/main/java/com/checkout/android_sdk/View/BillingDetailsView.java index b75cda89c..c2af90998 100755 --- a/android-sdk/src/main/java/com/checkout/android_sdk/View/BillingDetailsView.java +++ b/android-sdk/src/main/java/com/checkout/android_sdk/View/BillingDetailsView.java @@ -609,7 +609,21 @@ public boolean dispatchKeyEventPreIme(KeyEvent event) { !mState.hasFocus() && !mZip.hasFocus() && !mPhone.hasFocus()) { - mListener.onBillingCanceled(); + if (mDatastore != null && mDatastore.getLastBillingValidState() != null) { + mDatastore.setCustomerName(mDatastore.getLastCustomerNameState()); + mDatastore.setCustomerAddress1(mDatastore.getLastBillingValidState().getAddressLine1()); + mDatastore.setCustomerAddress2(mDatastore.getLastBillingValidState().getAddressLine2()); + mDatastore.setCustomerZipcode(mDatastore.getLastBillingValidState().getPostcode()); + mDatastore.setCustomerCountry(mDatastore.getLastBillingValidState().getCountry()); + mDatastore.setCustomerCity(mDatastore.getLastBillingValidState().getCity()); + mDatastore.setCustomerState(mDatastore.getLastBillingValidState().getState()); + mDatastore.setCustomerPhonePrefix(mDatastore.getLastBillingValidState().getPhone().getCountryCode()); + mDatastore.setCustomerPhone(mDatastore.getLastBillingValidState().getPhone().getNumber()); + repopulateFields(); + mListener.onBillingCompleted(); + } else { + mListener.onBillingCanceled(); + } return true; } else { requestFocus(); diff --git a/demos/examples/app/build.gradle b/demos/examples/app/build.gradle index a9bde33ed..f9de08484 100644 --- a/demos/examples/app/build.gradle +++ b/demos/examples/app/build.gradle @@ -25,7 +25,7 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'com.github.checkout:frames-android:v2.0.4' + implementation 'com.github.checkout:frames-android:v2.0.5' implementation 'com.android.support:design:27.1.1' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.android.volley:volley:1.0.0' diff --git a/demos/googlepay_example/app/build.gradle b/demos/googlepay_example/app/build.gradle index 297c4f14c..b0ace373c 100755 --- a/demos/googlepay_example/app/build.gradle +++ b/demos/googlepay_example/app/build.gradle @@ -32,7 +32,7 @@ dependencies { implementation 'com.android.support:design:27.1.1' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.android.volley:volley:1.0.0' - implementation 'com.github.checkout:frames-android:v2.0.4' + implementation 'com.github.checkout:frames-android:v2.0.5' // "wallet" is the only module needed for the Google Payment API and this sample app. // Apps that selectively compile Google Play service APIs need only this dependency.