Handle non-exact measure passes in ZenModeView.

Bug:13245581
Change-Id: I2c5f6632fde6559849e6f429d66c4d28d4d3a890
This commit is contained in:
John Spurlock
2014-03-03 13:38:01 -05:00
parent 36c96866f3
commit 756fa2ab9f

View File

@@ -261,10 +261,9 @@ public class ZenModeView extends RelativeLayout {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (DEBUG) log("onMeasure %s %s",
MeasureSpec.toString(widthMeasureSpec), MeasureSpec.toString(heightMeasureSpec));
if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY) {
throw new UnsupportedOperationException("Width must be exact");
}
if (widthMeasureSpec != mWidthSpec) {
final boolean widthExact = MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY;
if (!widthExact || (widthMeasureSpec != mWidthSpec)) {
if (DEBUG) log(" super.onMeasure");
final int hms = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
super.onMeasure(widthMeasureSpec, hms);