OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.chrome.browser.payments.ui; | |
6 | |
7 import android.content.Context; | |
8 import android.util.AttributeSet; | |
9 import android.view.View; | |
10 import android.view.View.MeasureSpec; | |
11 import android.widget.LinearLayout; | |
12 | |
13 import org.chromium.chrome.R; | |
14 | |
15 /** This class represents a bar to display at the bottom of the payment request UI. */ | |
16 public class PaymentRequestBottomBar extends LinearLayout { | |
17 public PaymentRequestBottomBar(Context context, AttributeSet attrs) { | |
18 super(context, attrs); | |
19 } | |
20 | |
21 @Override | |
22 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
23 // Views layout_width must be set to match_parent. | |
24 assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY; | |
25 | |
26 super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
27 | |
28 // Display the logo without product name if there is not enough space. | |
29 if (findViewById(R.id.space).getMeasuredWidth() == 0) { | |
30 findViewById(R.id.logo_name).setVisibility(View.GONE); | |
31 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.
| |
32 } | |
33 } | |
34 } | |
OLD | NEW |