Commit 4c5190ac authored by rouslan's avatar rouslan Committed by Commit bot

Hide PaymentRequest UI spinner during CVC unmask

BUG=627668

Review-Url: https://codereview.chromium.org/2140413002
Cr-Commit-Position: refs/heads/master@{#405209}
parent 33755c42
...@@ -692,13 +692,14 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie ...@@ -692,13 +692,14 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
} }
@Override @Override
public void onPayClicked(PaymentOption selectedShippingAddress, public boolean onPayClicked(PaymentOption selectedShippingAddress,
PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod) { PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod) {
assert selectedPaymentMethod instanceof PaymentInstrument; assert selectedPaymentMethod instanceof PaymentInstrument;
PaymentInstrument instrument = (PaymentInstrument) selectedPaymentMethod; PaymentInstrument instrument = (PaymentInstrument) selectedPaymentMethod;
mPaymentAppRunning = true; mPaymentAppRunning = true;
instrument.getDetails(mMerchantName, mOrigin, mRawTotal, mRawLineItems, instrument.getDetails(mMerchantName, mOrigin, mRawTotal, mRawLineItems,
mMethodData.get(instrument.getMethodName()), this); mMethodData.get(instrument.getMethodName()), this);
return !(instrument instanceof AutofillPaymentInstrument);
} }
@Override @Override
...@@ -816,6 +817,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie ...@@ -816,6 +817,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
} }
} }
mUI.showProcessingMessage();
mClient.onPaymentResponse(response); mClient.onPaymentResponse(response);
} }
......
...@@ -137,10 +137,10 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -137,10 +137,10 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
@DataType int optionType, Callback<PaymentInformation> checkedCallback); @DataType int optionType, Callback<PaymentInformation> checkedCallback);
/** /**
* Called when the user clicks on the “Pay” button. At this point, the UI is disabled and is * Called when the user clicks on the “Pay” button. If this method returns true, the UI is
* showing a spinner. * disabled and is showing a spinner. Otherwise, the UI is hidden.
*/ */
void onPayClicked(PaymentOption selectedShippingAddress, boolean onPayClicked(PaymentOption selectedShippingAddress,
PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod); PaymentOption selectedShippingOption, PaymentOption selectedPaymentMethod);
/** /**
...@@ -688,12 +688,24 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -688,12 +688,24 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
mRequestView.requestLayout(); mRequestView.requestLayout();
mClient.onPayClicked( boolean showSpinner = mClient.onPayClicked(
mShippingAddressSectionInformation == null mShippingAddressSectionInformation == null
? null : mShippingAddressSectionInformation.getSelectedItem(), ? null : mShippingAddressSectionInformation.getSelectedItem(),
mShippingOptionsSectionInformation == null mShippingOptionsSectionInformation == null
? null : mShippingOptionsSectionInformation.getSelectedItem(), ? null : mShippingOptionsSectionInformation.getSelectedItem(),
mPaymentMethodSectionInformation.getSelectedItem()); mPaymentMethodSectionInformation.getSelectedItem());
if (!showSpinner) mDialog.hide();
}
/**
* Called when the user has sent the payment information to the website, which is now processing
* the payment.
*/
public void showProcessingMessage() {
assert mIsProcessingPayClicked;
mIsProcessingPayClicked = false;
mDialog.show();
} }
private void updatePayButtonEnabled() { private void updatePayButtonEnabled() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment