| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 @Override | 48 @Override |
| 49 public boolean shouldDelayChildPressedState() { | 49 public boolean shouldDelayChildPressedState() { |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 @Override | 53 @Override |
| 54 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | 54 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 55 final int width = getDefaultSize(Integer.MAX_VALUE, widthMeasureSpec); | 55 final int width = getDefaultSize(Integer.MAX_VALUE, widthMeasureSpec); |
| 56 final int height = getDefaultSize(Integer.MAX_VALUE, heightMeasureSpec); | 56 final int height = getDefaultSize(Integer.MAX_VALUE, heightMeasureSpec); |
| 57 setMeasuredDimension( | 57 setMeasuredDimension(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)
, |
| 58 MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), | |
| 59 MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); | 58 MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); |
| 60 | 59 |
| 61 final int childWidthMeasureSpec = | 60 final int childWidthMeasureSpec = |
| 62 MeasureSpec.makeMeasureSpec(width * widthPercent / 100, MeasureSpec.AT_M
OST); | 61 MeasureSpec.makeMeasureSpec(width * widthPercent / 100, MeasureSpec.AT_M
OST); |
| 63 final int childHeightMeasureSpec = | 62 final int childHeightMeasureSpec = |
| 64 MeasureSpec.makeMeasureSpec(height * heightPercent / 100, MeasureSpec.AT
_MOST); | 63 MeasureSpec.makeMeasureSpec(height * heightPercent / 100, MeasureSpec.AT
_MOST); |
| 65 for (int i = 0; i < getChildCount(); ++i) { | 64 for (int i = 0; i < getChildCount(); ++i) { |
| 66 final View child = getChildAt(i); | 65 final View child = getChildAt(i); |
| 67 if (child.getVisibility() != GONE) { | 66 if (child.getVisibility() != GONE) { |
| 68 child.measure(childWidthMeasureSpec, childHeightMeasureSpec); | 67 child.measure(childWidthMeasureSpec, childHeightMeasureSpec); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 final int childWidth = child.getMeasuredWidth(); | 85 final int childWidth = child.getMeasuredWidth(); |
| 87 final int childHeight = child.getMeasuredHeight(); | 86 final int childHeight = child.getMeasuredHeight(); |
| 88 // Center child both vertically and horizontally. | 87 // Center child both vertically and horizontally. |
| 89 final int childLeft = subLeft + (subWidth - childWidth) / 2; | 88 final int childLeft = subLeft + (subWidth - childWidth) / 2; |
| 90 final int childTop = subTop + (subHeight - childHeight) / 2; | 89 final int childTop = subTop + (subHeight - childHeight) / 2; |
| 91 child.layout(childLeft, childTop, childLeft + childWidth, childTop + chi
ldHeight); | 90 child.layout(childLeft, childTop, childLeft + childWidth, childTop + chi
ldHeight); |
| 92 } | 91 } |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 } | 94 } |
| OLD | NEW |