@Override public int getBaseline() { View child = null; if (getChildCount() > 0) { child = getChildAt(0); } else if (mAdapter != null && mAdapter.getCount() > 0) { child = makeAndAddView(0); // TODO: We should probably put the child in the recycler } if (child != null) { return child.getTop() + child.getBaseline(); } else { return -1; } }
public int getBaseline() { int i = -1; if (mBaselineAlignedChildIndex < 0) { i = super.getBaseline(); } View localView; int j; do { return i; if (getChildCount() <= mBaselineAlignedChildIndex) { throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds."); } localView = getChildAt(mBaselineAlignedChildIndex); j = localView.getBaseline(); if (j != -1) { break; } } while (mBaselineAlignedChildIndex == 0); throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout points to a View that doesn't know how to get its baseline."); i = mBaselineChildTop; if (mOrientation == 1) { int k = mGravity & 0x70; if (k != 48) { switch (k) { } } } for (;;) { return getLayoutParamstopMargin + i + j; i = getBottom() - getTop() - getPaddingBottom() - mTotalLength; continue; i += (getBottom() - getTop() - getPaddingTop() - getPaddingBottom() - mTotalLength) / 2; } }
public int getBaseline() { if (this.mBaselineAlignedChildIndex < 0) { return super.getBaseline(); } if (getChildCount() <= this.mBaselineAlignedChildIndex) { throw new RuntimeException( "mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds."); } View child = getChildAt(this.mBaselineAlignedChildIndex); int childBaseline = child.getBaseline(); if (childBaseline != -1) { int childTop = this.mBaselineChildTop; if (this.mOrientation == VERTICAL) { int majorGravity = this.mGravity & KeyEvent.KEYCODE_FORWARD_DEL; if (majorGravity != 48) { switch (majorGravity) { case RelativeLayout.START_OF /*16*/: childTop += ((((this.mBottom - this.mTop) - this.mPaddingTop) - this.mPaddingBottom) - this.mTotalLength) / SHOW_DIVIDER_MIDDLE; break; case KeyEvent.KEYCODE_FOCUS /*80*/: childTop = ((this.mBottom - this.mTop) - this.mPaddingBottom) - this.mTotalLength; break; } } } return (((LayoutParams) child.getLayoutParams()).topMargin + childTop) + childBaseline; } else if (this.mBaselineAlignedChildIndex == 0) { return -1; } else { throw new RuntimeException( "mBaselineAlignedChildIndex of LinearLayout points to a View that doesn't know how to get its baseline."); } }
void measureHorizontal(int paramInt1, int paramInt2) { mTotalLength = 0; int k = 0; int j = 0; int i1 = 0; int i3 = 0; int i = 1; float f1 = 0.0F; int i11 = getVirtualChildCount(); int i13 = View.MeasureSpec.getMode(paramInt1); int i12 = View.MeasureSpec.getMode(paramInt2); int i2 = 0; int n = 0; if ((mMaxAscent == null) || (mMaxDescent == null)) { mMaxAscent = new int[4]; mMaxDescent = new int[4]; } Object localObject = mMaxAscent; int[] arrayOfInt = mMaxDescent; localObject[3] = -1; localObject[2] = -1; localObject[1] = -1; localObject[0] = -1; arrayOfInt[3] = -1; arrayOfInt[2] = -1; arrayOfInt[1] = -1; arrayOfInt[0] = -1; boolean bool1 = mBaselineAligned; boolean bool2 = mUseLargestChild; int i7; int m; int i4; label156: View localView; int i5; int i6; if (i13 == 1073741824) { i7 = 1; m = Integer.MIN_VALUE; i4 = 0; if (i4 >= i11) { break label989; } localView = getVirtualChildAt(i4); if (localView != null) { break label262; } mTotalLength += measureNullChild(i4); i5 = m; i6 = n; n = k; m = j; k = i; j = i6; i = i5; } label262: int i8; for (;;) { i4 += 1; i5 = m; i6 = n; m = i; n = j; i = k; j = i5; k = i6; break label156; i7 = 0; break; if (localView.getVisibility() != 8) { break label332; } i8 = i4 + getChildrenSkipCount(localView, i4); i4 = m; i6 = n; m = i; n = j; i5 = k; i = i4; j = i6; i4 = i8; k = m; m = n; n = i5; } label332: if (hasDividerBeforeChildAt(i4)) { mTotalLength += mDividerWidth; } LinearLayoutCompat.LayoutParams localLayoutParams = (LinearLayoutCompat.LayoutParams)localView.getLayoutParams(); f1 += weight; if ((i13 == 1073741824) && (width == 0) && (weight > 0.0F)) { if (i7 != 0) { mTotalLength += leftMargin + rightMargin; label422: if (!bool1) { break label728; } i5 = View.MeasureSpec.makeMeasureSpec(0, 0); localView.measure(i5, i5); i6 = n; i5 = m; label451: n = 0; if ((i12 == 1073741824) || (height != -1)) { break label2370; } m = 1; n = 1; } } for (;;) { i2 = topMargin; i2 = bottomMargin + i2; i8 = localView.getMeasuredHeight() + i2; int i9 = ViewUtils.combineMeasuredStates(j, cn.l(localView)); if (bool1) { i10 = localView.getBaseline(); if (i10 != -1) { if (gravity >= 0) { break label938; } j = mGravity; label547: j = ((j & 0x70) >> 4 & 0xFFFFFFFE) >> 1; localObject[j] = Math.max(localObject[j], i10); arrayOfInt[j] = Math.max(arrayOfInt[j], i8 - i10); } } int i10 = Math.max(k, i8); if ((i != 0) && (height == -1)) { k = 1; label620: if (weight <= 0.0F) { break label961; } if (n == 0) { break label954; } } for (;;) { j = Math.max(i3, i2); i = i1; i4 += getChildrenSkipCount(localView, i4); i3 = j; i1 = i; n = i10; i = i5; i5 = i9; i2 = m; j = i6; m = i5; break; i5 = mTotalLength; mTotalLength = Math.max(i5, leftMargin + i5 + rightMargin); break label422; label728: i6 = 1; i5 = m; break label451; i6 = Integer.MIN_VALUE; i5 = i6; if (width == 0) { i5 = i6; if (weight > 0.0F) { i5 = 0; width = -2; } } if (f1 == 0.0F) { i6 = mTotalLength; label791: measureChildBeforeLayout(localView, i4, paramInt1, i6, paramInt2, 0); if (i5 != Integer.MIN_VALUE) { width = i5; } i8 = localView.getMeasuredWidth(); if (i7 == 0) { break label896; } } for (mTotalLength += leftMargin + i8 + rightMargin + getNextLocationOffset(localView);; mTotalLength = Math.max(i5, i5 + i8 + leftMargin + rightMargin + getNextLocationOffset(localView))) { i5 = m; i6 = n; if (!bool2) { break; } i5 = Math.max(i8, m); i6 = n; break; i6 = 0; break label791; label896: i5 = mTotalLength; } label938: j = gravity; break label547; k = 0; break label620; label954: i2 = i8; } label961: if (n != 0) {} for (;;) { i = Math.max(i1, i2); j = i3; break; i2 = i8; } label989: if ((mTotalLength > 0) && (hasDividerBeforeChildAt(i11))) { mTotalLength += mDividerWidth; } if ((localObject[1] != -1) || (localObject[0] != -1) || (localObject[2] != -1) || (localObject[3] != -1)) {} for (i4 = Math.max(k, Math.max(localObject[3], Math.max(localObject[0], Math.max(localObject[1], localObject[2]))) + Math.max(arrayOfInt[3], Math.max(arrayOfInt[0], Math.max(arrayOfInt[1], arrayOfInt[2]))));; i4 = k) { if ((bool2) && ((i13 == Integer.MIN_VALUE) || (i13 == 0))) { mTotalLength = 0; k = 0; if (k < i11) { localView = getVirtualChildAt(k); if (localView == null) { mTotalLength += measureNullChild(k); } for (;;) { k += 1; break; if (localView.getVisibility() == 8) { k = getChildrenSkipCount(localView, k) + k; } else { localLayoutParams = (LinearLayoutCompat.LayoutParams)localView.getLayoutParams(); if (i7 != 0) { i5 = mTotalLength; i6 = leftMargin; mTotalLength = (rightMargin + (i6 + m) + getNextLocationOffset(localView) + i5); } else { i5 = mTotalLength; i6 = leftMargin; mTotalLength = Math.max(i5, rightMargin + (i5 + m + i6) + getNextLocationOffset(localView)); } } } } } mTotalLength += getPaddingLeft() + getPaddingRight(); i8 = cn.a(Math.max(mTotalLength, getSuggestedMinimumWidth()), paramInt1, 0); k = (0xFFFFFF & i8) - mTotalLength; if ((n != 0) || ((k != 0) && (f1 > 0.0F))) { if (mWeightSum > 0.0F) { f1 = mWeightSum; } localObject[3] = -1; localObject[2] = -1; localObject[1] = -1; localObject[0] = -1; arrayOfInt[3] = -1; arrayOfInt[2] = -1; arrayOfInt[1] = -1; arrayOfInt[0] = -1; mTotalLength = 0; i4 = 0; i3 = i1; n = j; m = k; k = -1; i1 = i4; j = i3; if (i1 < i11) { localView = getVirtualChildAt(i1); if (localView == null) { break label2340; } if (localView.getVisibility() == 8) { i3 = m; m = k; k = j; j = i; i = i3; } } } for (;;) { i3 = i1 + 1; i1 = m; m = i; i = j; j = k; k = i1; i1 = i3; break; localLayoutParams = (LinearLayoutCompat.LayoutParams)localView.getLayoutParams(); float f2 = weight; if (f2 > 0.0F) { i4 = (int)(m * f2 / f1); i3 = m - i4; i5 = getChildMeasureSpec(paramInt2, getPaddingTop() + getPaddingBottom() + topMargin + bottomMargin, height); if ((width != 0) || (i13 != 1073741824)) { i4 += localView.getMeasuredWidth(); m = i4; if (i4 < 0) { m = 0; } localView.measure(View.MeasureSpec.makeMeasureSpec(m, 1073741824), i5); n = ViewUtils.combineMeasuredStates(n, cn.l(localView) & 0xFF000000); f1 -= f2; m = i3; } } for (;;) { if (i7 != 0) { mTotalLength += localView.getMeasuredWidth() + leftMargin + rightMargin + getNextLocationOffset(localView); label1727: if ((i12 == 1073741824) || (height != -1)) { break label1984; } i3 = 1; label1746: i6 = topMargin + bottomMargin; i5 = localView.getMeasuredHeight() + i6; i4 = Math.max(k, i5); if (i3 == 0) { break label1990; } k = i6; label1787: k = Math.max(j, k); if ((i == 0) || (height != -1)) { break label1997; } i = 1; label1813: if (bool1) { i3 = localView.getBaseline(); if (i3 != -1) { if (gravity >= 0) { break label2003; } } } } label1984: label1990: label1997: label2003: for (j = mGravity;; j = gravity) { j = ((j & 0x70) >> 4 & 0xFFFFFFFE) >> 1; localObject[j] = Math.max(localObject[j], i3); arrayOfInt[j] = Math.max(arrayOfInt[j], i5 - i3); j = i; i = m; m = i4; break; if (i4 > 0) {} for (m = i4;; m = 0) { localView.measure(View.MeasureSpec.makeMeasureSpec(m, 1073741824), i5); break; } i3 = mTotalLength; mTotalLength = Math.max(i3, localView.getMeasuredWidth() + i3 + leftMargin + rightMargin + getNextLocationOffset(localView)); break label1727; i3 = 0; break label1746; k = i5; break label1787; i = 0; break label1813; } mTotalLength += getPaddingLeft() + getPaddingRight(); if ((localObject[1] == -1) && (localObject[0] == -1) && (localObject[2] == -1)) { m = k; if (localObject[3] == -1) {} } else { m = Math.max(k, Math.max(localObject[3], Math.max(localObject[0], Math.max(localObject[1], localObject[2]))) + Math.max(arrayOfInt[3], Math.max(arrayOfInt[0], Math.max(arrayOfInt[1], arrayOfInt[2])))); } k = i; i = n; n = k; k = j; for (;;) { if ((n == 0) && (i12 != 1073741824)) {} for (;;) { setMeasuredDimension(0xFF000000 & i | i8, cn.a(Math.max(k + (getPaddingTop() + getPaddingBottom()), getSuggestedMinimumHeight()), paramInt2, i << 16)); if (i2 != 0) { forceUniformHeight(i11, paramInt1); } return; n = Math.max(i1, i3); if ((!bool2) || (i13 == 1073741824)) { break; } k = 0; if (k >= i11) { break; } localObject = getVirtualChildAt(k); if ((localObject == null) || (((View)localObject).getVisibility() == 8)) {} for (;;) { k += 1; break; if (getLayoutParamsweight > 0.0F) { ((View)localObject).measure(View.MeasureSpec.makeMeasureSpec(m, 1073741824), View.MeasureSpec.makeMeasureSpec(((View)localObject).getMeasuredHeight(), 1073741824)); } } k = m; } k = n; m = i4; n = i; i = j; } } label2340: i3 = m; m = k; k = j; j = i; i = i3; } } label2370: m = i2; } }
void layoutHorizontal(int paramInt1, int paramInt2, int paramInt3, int paramInt4) { boolean bool1 = ViewUtils.isLayoutRtl(this); int k = getPaddingTop(); int n = paramInt4 - paramInt2; int i1 = getPaddingBottom(); int i2 = getPaddingBottom(); int i3 = getVirtualChildCount(); paramInt2 = mGravity; int i4 = mGravity; boolean bool2 = mBaselineAligned; int[] arrayOfInt1 = mMaxAscent; int[] arrayOfInt2 = mMaxDescent; switch (v.a(paramInt2 & 0x800007, cn.h(this))) { default: paramInt1 = getPaddingLeft(); if (bool1) { paramInt4 = -1; } break; } for (int i = i3 - 1;; i = 0) { paramInt2 = 0; paramInt3 = paramInt1; label127: int i5; View localView; if (paramInt2 < i3) { i5 = i + paramInt4 * paramInt2; localView = getVirtualChildAt(i5); if (localView == null) { paramInt3 += measureNullChild(i5); paramInt1 = paramInt2; } } for (;;) { paramInt2 = paramInt1 + 1; break label127; paramInt1 = getPaddingLeft() + paramInt3 - paramInt1 - mTotalLength; break; paramInt1 = getPaddingLeft() + (paramInt3 - paramInt1 - mTotalLength) / 2; break; if (localView.getVisibility() != 8) { int i6 = localView.getMeasuredWidth(); int i7 = localView.getMeasuredHeight(); LinearLayoutCompat.LayoutParams localLayoutParams = (LinearLayoutCompat.LayoutParams)localView.getLayoutParams(); if ((bool2) && (height != -1)) {} for (int j = localView.getBaseline();; j = -1) { int m = gravity; paramInt1 = m; if (m < 0) { paramInt1 = i4 & 0x70; } switch (paramInt1 & 0x70) { default: paramInt1 = k; label327: if (hasDividerBeforeChildAt(i5)) { paramInt3 = mDividerWidth + paramInt3; } break; } for (;;) { paramInt3 += leftMargin; setChildFrame(localView, paramInt3 + getLocationOffset(localView), paramInt1, i6, i7); paramInt3 += rightMargin + i6 + getNextLocationOffset(localView); paramInt1 = getChildrenSkipCount(localView, i5) + paramInt2; break; m = k + topMargin; paramInt1 = m; if (j == -1) { break label327; } paramInt1 = m + (arrayOfInt1[1] - j); break label327; paramInt1 = (n - k - i2 - i7) / 2 + k + topMargin - bottomMargin; break label327; m = n - i1 - i7 - bottomMargin; paramInt1 = m; if (j == -1) { break label327; } paramInt1 = localView.getMeasuredHeight(); paramInt1 = m - (arrayOfInt2[2] - (paramInt1 - j)); break label327; return; } } } paramInt1 = paramInt2; } paramInt4 = 1; } }
void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) { LayoutParams lp; int totalLength; int childWidth; int childHeight; int childBaseline; int i; this.mTotalLength = SHOW_DIVIDER_NONE; int maxHeight = SHOW_DIVIDER_NONE; int childState = SHOW_DIVIDER_NONE; int alternativeMaxHeight = SHOW_DIVIDER_NONE; int weightedMaxHeight = SHOW_DIVIDER_NONE; boolean allFillParent = true; float totalWeight = 0.0f; int count = getVirtualChildCount(); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); boolean matchHeight = false; boolean skippedMeasure = false; if (this.mMaxAscent == null || this.mMaxDescent == null) { this.mMaxAscent = new int[VERTICAL_GRAVITY_COUNT]; this.mMaxDescent = new int[VERTICAL_GRAVITY_COUNT]; } int[] maxAscent = this.mMaxAscent; int[] maxDescent = this.mMaxDescent; maxAscent[INDEX_FILL] = -1; maxAscent[SHOW_DIVIDER_MIDDLE] = -1; maxAscent[VERTICAL] = -1; maxAscent[SHOW_DIVIDER_NONE] = -1; maxDescent[INDEX_FILL] = -1; maxDescent[SHOW_DIVIDER_MIDDLE] = -1; maxDescent[VERTICAL] = -1; maxDescent[SHOW_DIVIDER_NONE] = -1; boolean baselineAligned = this.mBaselineAligned; boolean useLargestChild = this.mUseLargestChild; boolean isExactly = widthMode == 1073741824; int largestChildWidth = RtlSpacingHelper.UNDEFINED; int i2 = SHOW_DIVIDER_NONE; while (i2 < count) { boolean matchHeightLocally; int margin; View child = getVirtualChildAt(i2); if (child == null) { this.mTotalLength += measureNullChild(i2); } else if (child.getVisibility() == 8) { i2 += getChildrenSkipCount(child, i2); } else { if (hasDividerBeforeChildAt(i2)) { this.mTotalLength += this.mDividerWidth; } lp = (LayoutParams) child.getLayoutParams(); totalWeight += lp.weight; if (widthMode == 1073741824 && lp.width == 0 && lp.weight > 0.0f) { if (isExactly) { this.mTotalLength += lp.leftMargin + lp.rightMargin; } else { totalLength = this.mTotalLength; this.mTotalLength = Math.max(totalLength, (lp.leftMargin + totalLength) + lp.rightMargin); } if (baselineAligned) { int freeSpec = MeasureSpec.makeMeasureSpec(SHOW_DIVIDER_NONE, SHOW_DIVIDER_NONE); child.measure(freeSpec, freeSpec); } else { skippedMeasure = true; } } else { int oldWidth = RtlSpacingHelper.UNDEFINED; if (lp.width == 0 && lp.weight > 0.0f) { oldWidth = SHOW_DIVIDER_NONE; lp.width = -2; } measureChildBeforeLayout( child, i2, widthMeasureSpec, totalWeight == 0.0f ? this.mTotalLength : SHOW_DIVIDER_NONE, heightMeasureSpec, SHOW_DIVIDER_NONE); if (oldWidth != Integer.MIN_VALUE) { lp.width = oldWidth; } childWidth = child.getMeasuredWidth(); if (isExactly) { this.mTotalLength += ((lp.leftMargin + childWidth) + lp.rightMargin) + getNextLocationOffset(child); } else { totalLength = this.mTotalLength; this.mTotalLength = Math.max( totalLength, (((totalLength + childWidth) + lp.leftMargin) + lp.rightMargin) + getNextLocationOffset(child)); } if (useLargestChild) { largestChildWidth = Math.max(childWidth, largestChildWidth); } } matchHeightLocally = false; if (heightMode != 1073741824 && lp.height == -1) { matchHeight = true; matchHeightLocally = true; } margin = lp.topMargin + lp.bottomMargin; childHeight = child.getMeasuredHeight() + margin; childState = View.combineMeasuredStates(childState, child.getMeasuredState()); if (baselineAligned) { childBaseline = child.getBaseline(); if (childBaseline != -1) { if (lp.gravity < 0) { i = this.mGravity; } else { i = lp.gravity; } int index = (((i & KeyEvent.KEYCODE_FORWARD_DEL) >> VERTICAL_GRAVITY_COUNT) & -2) >> VERTICAL; maxAscent[index] = Math.max(maxAscent[index], childBaseline); maxDescent[index] = Math.max(maxDescent[index], childHeight - childBaseline); } } maxHeight = Math.max(maxHeight, childHeight); allFillParent = allFillParent && lp.height == -1; if (lp.weight > 0.0f) { if (!matchHeightLocally) { margin = childHeight; } weightedMaxHeight = Math.max(weightedMaxHeight, margin); } else { if (!matchHeightLocally) { margin = childHeight; } alternativeMaxHeight = Math.max(alternativeMaxHeight, margin); } i2 += getChildrenSkipCount(child, i2); } i2 += VERTICAL; } if (this.mTotalLength > 0 && hasDividerBeforeChildAt(count)) { this.mTotalLength += this.mDividerWidth; } if (!(maxAscent[VERTICAL] == -1 && maxAscent[SHOW_DIVIDER_NONE] == -1 && maxAscent[SHOW_DIVIDER_MIDDLE] == -1 && maxAscent[INDEX_FILL] == -1)) { maxHeight = Math.max( maxHeight, Math.max( maxAscent[INDEX_FILL], Math.max( maxAscent[SHOW_DIVIDER_NONE], Math.max(maxAscent[VERTICAL], maxAscent[SHOW_DIVIDER_MIDDLE]))) + Math.max( maxDescent[INDEX_FILL], Math.max( maxDescent[SHOW_DIVIDER_NONE], Math.max(maxDescent[VERTICAL], maxDescent[SHOW_DIVIDER_MIDDLE])))); } if (useLargestChild && (widthMode == Integer.MIN_VALUE || widthMode == 0)) { this.mTotalLength = SHOW_DIVIDER_NONE; i2 = SHOW_DIVIDER_NONE; while (i2 < count) { child = getVirtualChildAt(i2); if (child == null) { this.mTotalLength += measureNullChild(i2); } else if (child.getVisibility() == 8) { i2 += getChildrenSkipCount(child, i2); } else { lp = (LayoutParams) child.getLayoutParams(); if (isExactly) { this.mTotalLength += ((lp.leftMargin + largestChildWidth) + lp.rightMargin) + getNextLocationOffset(child); } else { totalLength = this.mTotalLength; this.mTotalLength = Math.max( totalLength, (((totalLength + largestChildWidth) + lp.leftMargin) + lp.rightMargin) + getNextLocationOffset(child)); } } i2 += VERTICAL; } } this.mTotalLength += this.mPaddingLeft + this.mPaddingRight; int widthSizeAndState = View.resolveSizeAndState( Math.max(this.mTotalLength, getSuggestedMinimumWidth()), widthMeasureSpec, SHOW_DIVIDER_NONE); int delta = (widthSizeAndState & View.MEASURED_SIZE_MASK) - this.mTotalLength; if (skippedMeasure || (delta != 0 && totalWeight > 0.0f)) { float weightSum; if (this.mWeightSum > 0.0f) { weightSum = this.mWeightSum; } else { weightSum = totalWeight; } maxAscent[INDEX_FILL] = -1; maxAscent[SHOW_DIVIDER_MIDDLE] = -1; maxAscent[VERTICAL] = -1; maxAscent[SHOW_DIVIDER_NONE] = -1; maxDescent[INDEX_FILL] = -1; maxDescent[SHOW_DIVIDER_MIDDLE] = -1; maxDescent[VERTICAL] = -1; maxDescent[SHOW_DIVIDER_NONE] = -1; maxHeight = -1; this.mTotalLength = SHOW_DIVIDER_NONE; for (i2 = SHOW_DIVIDER_NONE; i2 < count; i2 += VERTICAL) { child = getVirtualChildAt(i2); if (!(child == null || child.getVisibility() == 8)) { lp = (LayoutParams) child.getLayoutParams(); float childExtra = lp.weight; if (childExtra > 0.0f) { int share = (int) ((((float) delta) * childExtra) / weightSum); weightSum -= childExtra; delta -= share; int childHeightMeasureSpec = ViewGroup.getChildMeasureSpec( heightMeasureSpec, ((this.mPaddingTop + this.mPaddingBottom) + lp.topMargin) + lp.bottomMargin, lp.height); if (lp.width == 0 && widthMode == 1073741824) { if (share <= 0) { share = SHOW_DIVIDER_NONE; } child.measure( MeasureSpec.makeMeasureSpec(share, EditorInfo.IME_FLAG_NO_ENTER_ACTION), childHeightMeasureSpec); } else { childWidth = child.getMeasuredWidth() + share; if (childWidth < 0) { childWidth = SHOW_DIVIDER_NONE; } child.measure( MeasureSpec.makeMeasureSpec(childWidth, EditorInfo.IME_FLAG_NO_ENTER_ACTION), childHeightMeasureSpec); } childState = View.combineMeasuredStates(childState, child.getMeasuredState() & Color.BLACK); } if (isExactly) { this.mTotalLength += ((child.getMeasuredWidth() + lp.leftMargin) + lp.rightMargin) + getNextLocationOffset(child); } else { totalLength = this.mTotalLength; this.mTotalLength = Math.max( totalLength, (((child.getMeasuredWidth() + totalLength) + lp.leftMargin) + lp.rightMargin) + getNextLocationOffset(child)); } matchHeightLocally = heightMode != 1073741824 && lp.height == -1; margin = lp.topMargin + lp.bottomMargin; childHeight = child.getMeasuredHeight() + margin; maxHeight = Math.max(maxHeight, childHeight); if (!matchHeightLocally) { margin = childHeight; } alternativeMaxHeight = Math.max(alternativeMaxHeight, margin); allFillParent = allFillParent && lp.height == -1; if (baselineAligned) { childBaseline = child.getBaseline(); if (childBaseline != -1) { if (lp.gravity < 0) { i = this.mGravity; } else { i = lp.gravity; } index = (((i & KeyEvent.KEYCODE_FORWARD_DEL) >> VERTICAL_GRAVITY_COUNT) & -2) >> VERTICAL; maxAscent[index] = Math.max(maxAscent[index], childBaseline); maxDescent[index] = Math.max(maxDescent[index], childHeight - childBaseline); } } } } this.mTotalLength += this.mPaddingLeft + this.mPaddingRight; if (!(maxAscent[VERTICAL] == -1 && maxAscent[SHOW_DIVIDER_NONE] == -1 && maxAscent[SHOW_DIVIDER_MIDDLE] == -1 && maxAscent[INDEX_FILL] == -1)) { maxHeight = Math.max( maxHeight, Math.max( maxAscent[INDEX_FILL], Math.max( maxAscent[SHOW_DIVIDER_NONE], Math.max(maxAscent[VERTICAL], maxAscent[SHOW_DIVIDER_MIDDLE]))) + Math.max( maxDescent[INDEX_FILL], Math.max( maxDescent[SHOW_DIVIDER_NONE], Math.max(maxDescent[VERTICAL], maxDescent[SHOW_DIVIDER_MIDDLE])))); } } else { alternativeMaxHeight = Math.max(alternativeMaxHeight, weightedMaxHeight); if (useLargestChild && widthMode != 1073741824) { for (i2 = SHOW_DIVIDER_NONE; i2 < count; i2 += VERTICAL) { child = getVirtualChildAt(i2); if (!(child == null || child.getVisibility() == 8)) { if (((LayoutParams) child.getLayoutParams()).weight > 0.0f) { child.measure( MeasureSpec.makeMeasureSpec( largestChildWidth, EditorInfo.IME_FLAG_NO_ENTER_ACTION), MeasureSpec.makeMeasureSpec( child.getMeasuredHeight(), EditorInfo.IME_FLAG_NO_ENTER_ACTION)); } } } } } if (!(allFillParent || heightMode == 1073741824)) { maxHeight = alternativeMaxHeight; } setMeasuredDimension( (Color.BLACK & childState) | widthSizeAndState, View.resolveSizeAndState( Math.max( maxHeight + (this.mPaddingTop + this.mPaddingBottom), getSuggestedMinimumHeight()), heightMeasureSpec, childState << 16)); if (matchHeight) { forceUniformHeight(count, widthMeasureSpec); } }
void layoutHorizontal(int left, int top, int right, int bottom) { int childLeft; boolean isLayoutRtl = isLayoutRtl(); int paddingTop = this.mPaddingTop; int height = bottom - top; int childBottom = height - this.mPaddingBottom; int childSpace = (height - paddingTop) - this.mPaddingBottom; int count = getVirtualChildCount(); int majorGravity = this.mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK; int minorGravity = this.mGravity & KeyEvent.KEYCODE_FORWARD_DEL; boolean baselineAligned = this.mBaselineAligned; int[] maxAscent = this.mMaxAscent; int[] maxDescent = this.mMaxDescent; switch (Gravity.getAbsoluteGravity(majorGravity, getLayoutDirection())) { case VERTICAL /*1*/: childLeft = this.mPaddingLeft + (((right - left) - this.mTotalLength) / SHOW_DIVIDER_MIDDLE); break; case ReflectionActionWithoutParams.TAG /*5*/: childLeft = ((this.mPaddingLeft + right) - left) - this.mTotalLength; break; default: childLeft = this.mPaddingLeft; break; } int start = SHOW_DIVIDER_NONE; int dir = VERTICAL; if (isLayoutRtl) { start = count - 1; dir = -1; } int i = SHOW_DIVIDER_NONE; while (i < count) { int childIndex = start + (dir * i); View child = getVirtualChildAt(childIndex); if (child == null) { childLeft += measureNullChild(childIndex); } else if (child.getVisibility() != 8) { int childTop; int childWidth = child.getMeasuredWidth(); int childHeight = child.getMeasuredHeight(); int childBaseline = -1; LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (baselineAligned && lp.height != -1) { childBaseline = child.getBaseline(); } int gravity = lp.gravity; if (gravity < 0) { gravity = minorGravity; } switch (gravity & KeyEvent.KEYCODE_FORWARD_DEL) { case RelativeLayout.START_OF /*16*/: childTop = ((((childSpace - childHeight) / SHOW_DIVIDER_MIDDLE) + paddingTop) + lp.topMargin) - lp.bottomMargin; break; case android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING /*48*/: childTop = paddingTop + lp.topMargin; if (childBaseline != -1) { childTop += maxAscent[VERTICAL] - childBaseline; break; } break; case KeyEvent.KEYCODE_FOCUS /*80*/: childTop = (childBottom - childHeight) - lp.bottomMargin; if (childBaseline != -1) { childTop -= maxDescent[SHOW_DIVIDER_MIDDLE] - (child.getMeasuredHeight() - childBaseline); break; } break; default: childTop = paddingTop; break; } if (hasDividerBeforeChildAt(childIndex)) { childLeft += this.mDividerWidth; } childLeft += lp.leftMargin; setChildFrame( child, childLeft + getLocationOffset(child), childTop, childWidth, childHeight); childLeft += (lp.rightMargin + childWidth) + getNextLocationOffset(child); i += getChildrenSkipCount(child, childIndex); } i += VERTICAL; } }