| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.payments.ui; | 5 package org.chromium.chrome.browser.payments.ui; |
| 6 | 6 |
| 7 import static org.chromium.chrome.browser.payments.ui.PaymentRequestSection.EDIT
_BUTTON_GONE; | 7 import static org.chromium.chrome.browser.payments.ui.PaymentRequestSection.EDIT
_BUTTON_GONE; |
| 8 | 8 |
| 9 import android.animation.Animator; | 9 import android.animation.Animator; |
| 10 import android.animation.AnimatorListenerAdapter; | 10 import android.animation.AnimatorListenerAdapter; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import android.view.Gravity; | 30 import android.view.Gravity; |
| 31 import android.view.LayoutInflater; | 31 import android.view.LayoutInflater; |
| 32 import android.view.View; | 32 import android.view.View; |
| 33 import android.view.View.OnLayoutChangeListener; | 33 import android.view.View.OnLayoutChangeListener; |
| 34 import android.view.ViewGroup; | 34 import android.view.ViewGroup; |
| 35 import android.view.ViewGroup.LayoutParams; | 35 import android.view.ViewGroup.LayoutParams; |
| 36 import android.view.Window; | 36 import android.view.Window; |
| 37 import android.widget.Button; | 37 import android.widget.Button; |
| 38 import android.widget.FrameLayout; | 38 import android.widget.FrameLayout; |
| 39 import android.widget.LinearLayout; | 39 import android.widget.LinearLayout; |
| 40 import android.widget.ScrollView; | |
| 41 import android.widget.TextView; | 40 import android.widget.TextView; |
| 42 | 41 |
| 43 import org.chromium.base.ApiCompatibilityUtils; | 42 import org.chromium.base.ApiCompatibilityUtils; |
| 44 import org.chromium.base.Callback; | 43 import org.chromium.base.Callback; |
| 45 import org.chromium.base.VisibleForTesting; | 44 import org.chromium.base.VisibleForTesting; |
| 46 import org.chromium.chrome.R; | 45 import org.chromium.chrome.R; |
| 47 import org.chromium.chrome.browser.payments.ShippingStrings; | 46 import org.chromium.chrome.browser.payments.ShippingStrings; |
| 48 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.ExtraTextsS
ection; | 47 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.ExtraTextsS
ection; |
| 49 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.LineItemBre
akdownSection; | 48 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.LineItemBre
akdownSection; |
| 50 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSecti
on; | 49 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSecti
on; |
| 51 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.SectionSepa
rator; | 50 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.SectionSepa
rator; |
| 52 import org.chromium.chrome.browser.widget.AlwaysDismissedDialog; | 51 import org.chromium.chrome.browser.widget.AlwaysDismissedDialog; |
| 52 import org.chromium.chrome.browser.widget.FadingEdgeScrollView; |
| 53 import org.chromium.chrome.browser.widget.animation.AnimatorProperties; | 53 import org.chromium.chrome.browser.widget.animation.AnimatorProperties; |
| 54 import org.chromium.chrome.browser.widget.animation.FocusAnimator; | 54 import org.chromium.chrome.browser.widget.animation.FocusAnimator; |
| 55 import org.chromium.components.signin.ChromeSigninController; | 55 import org.chromium.components.signin.ChromeSigninController; |
| 56 import org.chromium.ui.text.NoUnderlineClickableSpan; | 56 import org.chromium.ui.text.NoUnderlineClickableSpan; |
| 57 import org.chromium.ui.text.SpanApplier; | 57 import org.chromium.ui.text.SpanApplier; |
| 58 import org.chromium.ui.text.SpanApplier.SpanInfo; | 58 import org.chromium.ui.text.SpanApplier.SpanInfo; |
| 59 import org.chromium.ui.widget.TextViewWithClickableSpans; | 59 import org.chromium.ui.widget.TextViewWithClickableSpans; |
| 60 | 60 |
| 61 import java.lang.annotation.Retention; | 61 import java.lang.annotation.Retention; |
| 62 import java.lang.annotation.RetentionPolicy; | 62 import java.lang.annotation.RetentionPolicy; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 private final Dialog mDialog; | 307 private final Dialog mDialog; |
| 308 private final EditorView mEditorView; | 308 private final EditorView mEditorView; |
| 309 private final EditorView mCardEditorView; | 309 private final EditorView mCardEditorView; |
| 310 private final ViewGroup mFullContainer; | 310 private final ViewGroup mFullContainer; |
| 311 private final ViewGroup mRequestView; | 311 private final ViewGroup mRequestView; |
| 312 private final PaymentRequestUiErrorView mErrorView; | 312 private final PaymentRequestUiErrorView mErrorView; |
| 313 private final Callback<PaymentInformation> mUpdateSectionsCallback; | 313 private final Callback<PaymentInformation> mUpdateSectionsCallback; |
| 314 private final ShippingStrings mShippingStrings; | 314 private final ShippingStrings mShippingStrings; |
| 315 | 315 |
| 316 private ScrollView mPaymentContainer; | 316 private FadingEdgeScrollView mPaymentContainer; |
| 317 private LinearLayout mPaymentContainerLayout; | 317 private LinearLayout mPaymentContainerLayout; |
| 318 private ViewGroup mBottomBar; | 318 private ViewGroup mBottomBar; |
| 319 private Button mEditButton; | 319 private Button mEditButton; |
| 320 private Button mPayButton; | 320 private Button mPayButton; |
| 321 private View mCloseButton; | 321 private View mCloseButton; |
| 322 private View mSpinnyLayout; | 322 private View mSpinnyLayout; |
| 323 | 323 |
| 324 private LineItemBreakdownSection mOrderSummarySection; | 324 private LineItemBreakdownSection mOrderSummarySection; |
| 325 private ExtraTextsSection mShippingSummarySection; | 325 private ExtraTextsSection mShippingSummarySection; |
| 326 private OptionSection mShippingAddressSection; | 326 private OptionSection mShippingAddressSection; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 mCloseButton = mRequestView.findViewById(R.id.close_button); | 547 mCloseButton = mRequestView.findViewById(R.id.close_button); |
| 548 mCloseButton.setOnClickListener(this); | 548 mCloseButton.setOnClickListener(this); |
| 549 mBottomBar = (ViewGroup) mRequestView.findViewById(R.id.bottom_bar); | 549 mBottomBar = (ViewGroup) mRequestView.findViewById(R.id.bottom_bar); |
| 550 mPayButton = (Button) mBottomBar.findViewById(R.id.button_primary); | 550 mPayButton = (Button) mBottomBar.findViewById(R.id.button_primary); |
| 551 mPayButton.setOnClickListener(this); | 551 mPayButton.setOnClickListener(this); |
| 552 mEditButton = (Button) mBottomBar.findViewById(R.id.button_secondary); | 552 mEditButton = (Button) mBottomBar.findViewById(R.id.button_secondary); |
| 553 mEditButton.setOnClickListener(this); | 553 mEditButton.setOnClickListener(this); |
| 554 | 554 |
| 555 // Create all the possible sections. | 555 // Create all the possible sections. |
| 556 mSectionSeparators = new ArrayList<>(); | 556 mSectionSeparators = new ArrayList<>(); |
| 557 mPaymentContainer = (ScrollView) mRequestView.findViewById(R.id.option_c
ontainer); | 557 mPaymentContainer = (FadingEdgeScrollView) mRequestView.findViewById(R.i
d.option_container); |
| 558 mPaymentContainerLayout = | 558 mPaymentContainerLayout = |
| 559 (LinearLayout) mRequestView.findViewById(R.id.payment_container_
layout); | 559 (LinearLayout) mRequestView.findViewById(R.id.payment_container_
layout); |
| 560 mOrderSummarySection = new LineItemBreakdownSection(context, | 560 mOrderSummarySection = new LineItemBreakdownSection(context, |
| 561 context.getString(R.string.payments_order_summary_label), this, | 561 context.getString(R.string.payments_order_summary_label), this, |
| 562 context.getString(R.string.payments_updated_label)); | 562 context.getString(R.string.payments_updated_label)); |
| 563 mShippingSummarySection = new ExtraTextsSection( | 563 mShippingSummarySection = new ExtraTextsSection( |
| 564 context, context.getString(mShippingStrings.getSummaryLabel()),
this); | 564 context, context.getString(mShippingStrings.getSummaryLabel()),
this); |
| 565 mShippingAddressSection = new OptionSection( | 565 mShippingAddressSection = new OptionSection( |
| 566 context, context.getString(mShippingStrings.getAddressLabel()),
this); | 566 context, context.getString(mShippingStrings.getAddressLabel()),
this); |
| 567 mShippingOptionSection = new OptionSection( | 567 mShippingOptionSection = new OptionSection( |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 new LinearLayout.LayoutParams( | 997 new LinearLayout.LayoutParams( |
| 998 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CON
TENT)); | 998 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CON
TENT)); |
| 999 mSectionSeparators.add( | 999 mSectionSeparators.add( |
| 1000 new SectionSeparator(mPaymentContainerLayout, summaryInd
ex + 1)); | 1000 new SectionSeparator(mPaymentContainerLayout, summaryInd
ex + 1)); |
| 1001 mPaymentContainerLayout.addView(mShippingOptionSection, summaryI
ndex + 2, | 1001 mPaymentContainerLayout.addView(mShippingOptionSection, summaryI
ndex + 2, |
| 1002 new LinearLayout.LayoutParams( | 1002 new LinearLayout.LayoutParams( |
| 1003 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CON
TENT)); | 1003 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CON
TENT)); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 // New separators appear at the top and bottom of the list. | 1006 // New separators appear at the top and bottom of the list. |
| 1007 mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout,
0)); | 1007 mPaymentContainer.setEdgeVisibility( |
| 1008 FadingEdgeScrollView.DRAW_HARD_EDGE, FadingEdgeScrollView.DR
AW_FADING_EDGE); |
| 1008 mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout,
-1)); | 1009 mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout,
-1)); |
| 1009 | 1010 |
| 1010 // Add a link to Autofill settings. | 1011 // Add a link to Autofill settings. |
| 1011 addCardAndAddressOptionsSettingsView(mPaymentContainerLayout); | 1012 addCardAndAddressOptionsSettingsView(mPaymentContainerLayout); |
| 1012 | 1013 |
| 1013 // Expand all the dividers. | 1014 // Expand all the dividers. |
| 1014 for (int i = 0; i < mSectionSeparators.size(); i++) mSectionSeparato
rs.get(i).expand(); | 1015 for (int i = 0; i < mSectionSeparators.size(); i++) mSectionSeparato
rs.get(i).expand(); |
| 1015 mPaymentContainerLayout.requestLayout(); | 1016 mPaymentContainerLayout.requestLayout(); |
| 1016 | 1017 |
| 1017 // Switch the 'edit' button to a 'cancel' button. | 1018 // Switch the 'edit' button to a 'cancel' button. |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 sObserverForTest.onPaymentRequestReadyForInput(this); | 1410 sObserverForTest.onPaymentRequestReadyForInput(this); |
| 1410 } | 1411 } |
| 1411 } | 1412 } |
| 1412 | 1413 |
| 1413 private void notifySelectionChecked() { | 1414 private void notifySelectionChecked() { |
| 1414 if (sObserverForTest != null) { | 1415 if (sObserverForTest != null) { |
| 1415 sObserverForTest.onPaymentRequestSelectionChecked(this); | 1416 sObserverForTest.onPaymentRequestSelectionChecked(this); |
| 1416 } | 1417 } |
| 1417 } | 1418 } |
| 1418 } | 1419 } |
| OLD | NEW |