Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java

Issue 1904553003: Java implementation of PaymentRequest mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable Pay button before user provided required information. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
index 6d939b74e610e67d4a019611cac1148fc463ec7f..e63247b6288de80568e133fd037f234d91a6a5e8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
@@ -227,6 +227,8 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mDialog.show();
+ updatePayButtonEnabled();
+
mClient.getDefaultPaymentInformation(new Callback<PaymentInformation>() {
public void onResult(PaymentInformation result) {
updateLineItems(result.getLineItems());
@@ -250,6 +252,8 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mPaymentMethodsSection = result.getPaymentMethods();
updateSection(mPaymentMethods, mPaymentMethodsSection, null);
+
+ updatePayButtonEnabled();
}
});
}
@@ -482,8 +486,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
? null : mShippingAddressesSection.getSelectedItem(),
mShippingOptionsSection == null
? null : mShippingOptionsSection.getSelectedItem(),
- mPaymentMethodsSection == null
- ? null : mPaymentMethodsSection.getSelectedItem());
+ mPaymentMethodsSection.getSelectedItem());
} else if (v == mEditButton) {
if (mSelectedSection == null) {
expand(mOrderSummaryLabel, mOrderSummary);
@@ -502,6 +505,22 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mClient.onPaymentMethodChanged(tag.getSection().getSelectedItem());
}
}
+
+ updatePayButtonEnabled();
+ }
+
+ private void updatePayButtonEnabled() {
+ if (mRequestShipping) {
+ mPayButton.setEnabled(mShippingAddressesSection != null
+ && mShippingAddressesSection.getSelectedItem() != null
+ && mShippingOptionsSection != null
+ && mShippingOptionsSection.getSelectedItem() != null
+ && mPaymentMethodsSection != null
+ && mPaymentMethodsSection.getSelectedItem() != null);
+ } else {
+ mPayButton.setEnabled(mPaymentMethodsSection != null
+ && mPaymentMethodsSection.getSelectedItem() != null);
+ }
}
private void expand(View sectionLabel, ViewGroup section) {

Powered by Google App Engine
This is Rietveld 408576698