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

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

Issue 2698703003: [Payments] Add UI elements to secure branding for payments (Closed)
Patch Set: Address comments, fix animation and improve efficiency Created 3 years, 10 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 731136017ac9f84aca7b1efc0f4fcc80a2cf2ba6..2fab5b61f4bbd6b26b9442d4324c6c1db225d941 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
@@ -45,16 +45,18 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Callback;
import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.payments.ShippingStrings;
import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.ExtraTextsSection;
import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.LineItemBreakdownSection;
import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSection;
import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.SectionSeparator;
import org.chromium.chrome.browser.widget.AlwaysDismissedDialog;
-import org.chromium.chrome.browser.widget.DualControlLayout;
+import org.chromium.chrome.browser.widget.TintedDrawable;
import org.chromium.chrome.browser.widget.animation.AnimatorProperties;
import org.chromium.chrome.browser.widget.animation.FocusAnimator;
import org.chromium.components.signin.ChromeSigninController;
+import org.chromium.components.url_formatter.UrlFormatter;
import org.chromium.ui.text.NoUnderlineClickableSpan;
import org.chromium.ui.text.SpanApplier;
import org.chromium.ui.text.SpanApplier.SpanInfo;
@@ -317,7 +319,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
private ScrollView mPaymentContainer;
private LinearLayout mPaymentContainerLayout;
- private DualControlLayout mButtonBar;
+ private LinearLayout mBottomBar;
private Button mEditButton;
private Button mPayButton;
private View mCloseButton;
@@ -543,21 +545,30 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
messageView.setText(R.string.payments_loading_message);
((TextView) mRequestView.findViewById(R.id.page_title)).setText(title);
- ((TextView) mRequestView.findViewById(R.id.hostname)).setText(origin);
+
+ TextView hostName = (TextView) mRequestView.findViewById(R.id.hostname);
+ if (origin.startsWith(UrlConstants.HTTPS_SCHEME)) {
please use gerrit instead 2017/02/16 19:41:51 Let's use HTTPS_URL_PREFIX instead of HTTPS_SCHEME
gogerald1 2017/02/17 00:44:45 Done.
+ // Tint https scheme and add compound drawable for security display.
+ hostName.setText(UrlFormatter.tintUrlSchemeForSecurityDisplay(
+ origin, ApiCompatibilityUtils.getColor(
+ context.getResources(), R.color.google_green_700)));
+ ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(hostName,
+ TintedDrawable.constructTintedDrawable(context.getResources(),
+ R.drawable.omnibox_https_valid, R.color.google_green_700),
+ null, null, null);
gone 2017/02/16 19:18:56 newline here to avoid comment sandwich
gogerald1 2017/02/17 00:44:46 Done.
+ // Remove left padding to align left compound drawable with the title. Note that the
+ // left compound drawable has transparent boundary.
+ hostName.setPaddingRelative(0, 0, 0, 0);
+ } else {
+ hostName.setText(origin);
+ }
// Set up the buttons.
mCloseButton = mRequestView.findViewById(R.id.close_button);
mCloseButton.setOnClickListener(this);
- mPayButton = DualControlLayout.createButtonForLayout(
- context, true, context.getString(R.string.payments_pay_button), this);
- mEditButton = DualControlLayout.createButtonForLayout(
- context, false, context.getString(R.string.payments_edit_button), this);
- mButtonBar = (DualControlLayout) mRequestView.findViewById(R.id.button_bar);
- mButtonBar.setAlignment(DualControlLayout.ALIGN_END);
- mButtonBar.setStackedMargin(context.getResources().getDimensionPixelSize(
- R.dimen.infobar_margin_between_stacked_buttons));
- mButtonBar.addView(mPayButton);
- mButtonBar.addView(mEditButton);
+ mPayButton = (Button) mRequestView.findViewById(R.id.pay_button);
+ mEditButton = (Button) mRequestView.findViewById(R.id.edit_button);
+ mBottomBar = (LinearLayout) mRequestView.findViewById(R.id.bottom_bar);
// Create all the possible sections.
mSectionSeparators = new ArrayList<>();
@@ -925,7 +936,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
if (showSpinner) {
mPaymentContainer.setVisibility(View.GONE);
- mButtonBar.setVisibility(View.GONE);
+ mBottomBar.setVisibility(View.GONE);
mCloseButton.setVisibility(View.GONE);
mSpinnyLayout.setVisibility(View.VISIBLE);
@@ -936,7 +947,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mRequestView.requestLayout();
} else {
mPaymentContainer.setVisibility(View.VISIBLE);
- mButtonBar.setVisibility(View.VISIBLE);
+ mBottomBar.setVisibility(View.VISIBLE);
mCloseButton.setVisibility(View.VISIBLE);
mSpinnyLayout.setVisibility(View.GONE);
@@ -1274,11 +1285,11 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
/** Animates the bottom sheet expanding to a larger sheet. */
private class SheetEnlargingAnimator
extends AnimatorListenerAdapter implements OnLayoutChangeListener {
- private final boolean mIsButtonBarLockedInPlace;
+ private final boolean mIsBottomBarLockedInPlace;
private int mContainerHeightDifference;
- public SheetEnlargingAnimator(boolean isButtonBarLockedInPlace) {
- mIsButtonBarLockedInPlace = isButtonBarLockedInPlace;
+ public SheetEnlargingAnimator(boolean isBottomBarLockedInPlace) {
+ mIsBottomBarLockedInPlace = isBottomBarLockedInPlace;
}
/**
@@ -1292,17 +1303,17 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
float containerTranslation = mContainerHeightDifference * progress;
mRequestView.setTranslationY(containerTranslation);
- if (mIsButtonBarLockedInPlace) {
- // The button bar is translated along the dialog so that is looks like it stays in
+ if (mIsBottomBarLockedInPlace) {
+ // The bottom bar is translated along the dialog so that is looks like it stays in
// place at the bottom while the entire bottom sheet is translating upwards.
- mButtonBar.setTranslationY(-containerTranslation);
+ mBottomBar.setTranslationY(-containerTranslation);
- // The payment container is sandwiched between the header and the button bar.
+ // The payment container is sandwiched between the header and the bottom bar.
// Expansion animates by changing where its "bottom" is, letting its shadows appear
// and disappear as it changes size.
- int paymentContainerBottom = Math.min(
- mPaymentContainer.getTop() + mPaymentContainer.getMeasuredHeight(),
- mButtonBar.getTop());
+ int paymentContainerBottom =
+ Math.min(mPaymentContainer.getTop() + mPaymentContainer.getMeasuredHeight(),
+ mBottomBar.getTop());
mPaymentContainer.setBottom(paymentContainerBottom);
}
}
@@ -1335,7 +1346,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
public void onAnimationEnd(Animator animation) {
// Reset the layout so that everything is in the expected place.
mRequestView.setTranslationY(0);
- mButtonBar.setTranslationY(0);
+ mBottomBar.setTranslationY(0);
mRequestView.requestLayout();
// Indicate that the dialog is ready to use.

Powered by Google App Engine
This is Rietveld 408576698