Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestBottomBar.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestBottomBar.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestBottomBar.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84601f8d830ff43470117ef06599938118fc628b |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestBottomBar.java |
@@ -0,0 +1,34 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.payments.ui; |
+ |
+import android.content.Context; |
+import android.util.AttributeSet; |
+import android.view.View; |
+import android.view.View.MeasureSpec; |
+import android.widget.LinearLayout; |
+ |
+import org.chromium.chrome.R; |
+ |
+/** This class represents a bar to display at the bottom of the payment request UI. */ |
+public class PaymentRequestBottomBar extends LinearLayout { |
+ public PaymentRequestBottomBar(Context context, AttributeSet attrs) { |
+ super(context, attrs); |
+ } |
+ |
+ @Override |
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
+ // Views layout_width must be set to match_parent. |
+ assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY; |
+ |
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
+ |
+ // Display the logo without product name if there is not enough space. |
+ if (findViewById(R.id.space).getMeasuredWidth() == 0) { |
+ findViewById(R.id.logo_name).setVisibility(View.GONE); |
+ findViewById(R.id.logo).setVisibility(View.VISIBLE); |
gone
2017/02/17 01:53:54
This will end up causing another measure pass. Ca
gogerald1
2017/02/17 17:28:28
Do not completely get your idea of setMeasuredDime
gone
2017/02/17 19:02:55
Simple doesn't always mean correct or efficient.
gogerald1
2017/02/17 22:05:38
Might strange, but that's what I observed, it migh
gogerald1
2017/02/17 22:05:38
Done.
|
+ } |
+ } |
+} |