Commit 10ca0d32 authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Changed autofill assistant payment request section order...

[Autofill Assistant] Changed autofill assistant payment request section order to: contact details -> shipping -> payment.

Also removed the first section separator according to our mocks. The chrome feature WEB_PAYMENTS_METHOD_SECTION_ORDER_V2 is now disabled for autofill assistant payment PR.

Bug: 806868
Change-Id: I52ed027192b145e50fb22c65fd50cfb5272d0fd2
Reviewed-on: https://chromium-review.googlesource.com/c/1333776
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607946}
parent 9064ba9e
...@@ -35,7 +35,6 @@ import android.widget.TextView; ...@@ -35,7 +35,6 @@ import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.ChromeVersionInfo;
import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPaymentRequest; import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPaymentRequest;
import org.chromium.chrome.browser.payments.ShippingStrings; import org.chromium.chrome.browser.payments.ShippingStrings;
...@@ -349,41 +348,31 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -349,41 +348,31 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mShippingOptionSection.setCanAddItems(false); mShippingOptionSection.setCanAddItems(false);
mPaymentMethodSection.setCanAddItems(canAddCards); mPaymentMethodSection.setCanAddItems(canAddCards);
// Put payment method section on top of address section for
// WEB_PAYMENTS_METHOD_SECTION_ORDER_V2.
boolean methodSectionOrderV2 =
ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS_METHOD_SECTION_ORDER_V2);
// Add the necessary sections to the layout. // Add the necessary sections to the layout.
mPaymentContainerLayout.addView(mOrderSummarySection, mPaymentContainerLayout.addView(mOrderSummarySection,
new LinearLayout.LayoutParams( new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
if (methodSectionOrderV2) {
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout)); if (mRequestContactDetails) {
mPaymentContainerLayout.addView(mPaymentMethodSection, mPaymentContainerLayout.addView(mContactDetailsSection,
new LinearLayout.LayoutParams( new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
} }
if (mRequestShipping) { if (mRequestShipping) {
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout)); if (mRequestContactDetails)
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout));
// The shipping breakout sections are only added if they are needed. // The shipping breakout sections are only added if they are needed.
mPaymentContainerLayout.addView(mShippingAddressSection, mPaymentContainerLayout.addView(mShippingAddressSection,
new LinearLayout.LayoutParams( new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
} }
if (!methodSectionOrderV2) {
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout)); if (mRequestContactDetails || mRequestShipping)
mPaymentContainerLayout.addView(mPaymentMethodSection,
new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
if (mRequestContactDetails) {
// Contact details are optional, depending on the merchant website.
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout)); mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout));
mPaymentContainerLayout.addView(mContactDetailsSection, mPaymentContainerLayout.addView(mPaymentMethodSection,
new LinearLayout.LayoutParams( new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
mRequestView.addOnLayoutChangeListener(new PeekingAnimator()); mRequestView.addOnLayoutChangeListener(new PeekingAnimator());
......
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