Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/widget/ExpandableGridView.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/ExpandableGridView.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/ExpandableGridView.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..08849aae7fef69b723019675ef2721646e887368 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/ExpandableGridView.java |
| @@ -0,0 +1,32 @@ |
| +// 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.widget; |
|
gone
2017/06/01 00:08:28
Confine this to payments/ui. The stackoverflow po
Hwanseung Lee
2017/06/01 14:36:38
i moved it to payments/ui
|
| + |
| +import android.content.Context; |
| +import android.util.AttributeSet; |
| +import android.view.View; |
| +import android.widget.GridView; |
| + |
| +/** |
| + * This class is a customized GridView which draws items in multiple lines automatically |
|
gone
2017/06/01 00:08:27
End this comment with a period.
Hwanseung Lee
2017/06/01 14:36:38
Done.
|
| + */ |
| +public class ExpandableGridView extends GridView { |
| + /** Constructor for when the gridview is inflated from XML. */ |
| + public ExpandableGridView(Context context, AttributeSet attrs) { |
| + super(context, attrs); |
| + } |
| + |
| + @Override |
| + public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| + int heightSpec; |
| + if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { |
| + heightSpec = MeasureSpec.makeMeasureSpec(View.MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); |
|
gone
2017/05/31 17:29:42
This is a mask; you're supposed to use it to mask
Hwanseung Lee
2017/06/01 14:36:38
i think it is not necessary.
i checked how to make
gone
2017/06/01 17:32:19
Parent's height makes more sense, but I don't unde
|
| + } else { |
| + heightSpec = heightMeasureSpec; |
| + } |
| + |
| + super.onMeasure(widthMeasureSpec, heightSpec); |
| + } |
| +} |