List of usage examples for android.view View getVisibility
@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"), @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"), @ViewDebug.IntToString(from = GONE, to = "GONE") }) @Visibility public int getVisibility()
From source file:cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout.java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final boolean isLayoutRtl = isLayoutRtlSupport(); if (isLayoutRtl) { mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT); } else {/*from w w w . j av a 2 s . co m*/ mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT); } final int width = r - l; final int paddingStart = isLayoutRtl ? getPaddingRight() : getPaddingLeft(); final int paddingEnd = isLayoutRtl ? getPaddingLeft() : getPaddingRight(); final int paddingTop = getPaddingTop(); final int childCount = getChildCount(); int xStart = paddingStart; int nextXStart = xStart; if (mFirstLayout) { mSlideOffset = mCanSlide && mPreservedOpenState ? 1.f : 0.f; } for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final int childWidth = child.getMeasuredWidth(); int offset = 0; if (lp.slideable) { final int margin = lp.leftMargin + lp.rightMargin; final int range = Math.min(nextXStart, width - paddingEnd - mOverhangSize) - xStart - margin; mSlideRange = range; final int lpMargin = isLayoutRtl ? lp.rightMargin : lp.leftMargin; lp.dimWhenOffset = xStart + lpMargin + range + childWidth / 2 > width - paddingEnd; final int pos = (int) (range * mSlideOffset); xStart += pos + lpMargin; mSlideOffset = (float) pos / mSlideRange; } else if (mCanSlide && mParallaxBy != 0) { offset = (int) ((1 - mSlideOffset) * mParallaxBy); xStart = nextXStart; } else { xStart = nextXStart; } final int childRight; final int childLeft; if (isLayoutRtl) { childRight = width - xStart + offset; childLeft = childRight - childWidth; } else { childLeft = xStart - offset; childRight = childLeft + childWidth; } final int childTop = paddingTop; final int childBottom = childTop + child.getMeasuredHeight(); child.layout(childLeft, paddingTop, childRight, childBottom); nextXStart += child.getWidth(); } if (mFirstLayout) { if (mCanSlide) { if (mParallaxBy != 0) { parallaxOtherViews(mSlideOffset); } if (((LayoutParams) mSlideableView.getLayoutParams()).dimWhenOffset) { dimChildView(mSlideableView, mSlideOffset, mSliderFadeColor); } } else { // Reset the dim level of all children; it's irrelevant when nothing moves. for (int i = 0; i < childCount; i++) { dimChildView(getChildAt(i), 0, mSliderFadeColor); } } updateObscuredViewsVisibility(mSlideableView); } mFirstLayout = false; }
From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { mInLayout = true;/*from w w w . java 2 s.c o m*/ final int width = r - l; final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (isContentView(child)) { child.layout(lp.leftMargin, lp.topMargin, lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight()); } else { // Drawer, if it wasn't onMeasure would have thrown an exception. final int childWidth = child.getMeasuredWidth(); final int childHeight = child.getMeasuredHeight(); int childLeft; final float newOffset; if (checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) { childLeft = -childWidth + (int) (childWidth * lp.onScreen); newOffset = (float) (childWidth + childLeft) / childWidth; } else { // Right; onMeasure checked for us. childLeft = width - (int) (childWidth * lp.onScreen); newOffset = (float) (width - childLeft) / childWidth; } final boolean changeOffset = newOffset != lp.onScreen; final int vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK; switch (vgrav) { default: case Gravity.TOP: { child.layout(childLeft, lp.topMargin, childLeft + childWidth, lp.topMargin + childHeight); break; } case Gravity.BOTTOM: { final int height = b - t; child.layout(childLeft, height - lp.bottomMargin - child.getMeasuredHeight(), childLeft + childWidth, height - lp.bottomMargin); break; } case Gravity.CENTER_VERTICAL: { final int height = b - t; int childTop = (height - childHeight) / 2; // Offset for margins. If things don't fit right because of // bad measurement before, oh well. if (childTop < lp.topMargin) { childTop = lp.topMargin; } else if (childTop + childHeight > height - lp.bottomMargin) { childTop = height - lp.bottomMargin - childHeight; } child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); break; } } if (changeOffset) { setDrawerViewOffset(child, newOffset); } final int newVisibility = lp.onScreen > 0 ? VISIBLE : INVISIBLE; if (child.getVisibility() != newVisibility) { child.setVisibility(newVisibility); } } } mInLayout = false; mFirstLayout = false; }
From source file:cn.zmdx.kaka.locker.widget.SlidingPaneLayout.java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); if (widthMode != MeasureSpec.EXACTLY) { if (isInEditMode()) { // Don't crash the layout editor. Consume all of the space if // specified // or pick a magic number from thin air otherwise. // TODO Better communication with tools of this bogus state. // It will crash on a real device. if (widthMode == MeasureSpec.AT_MOST) { widthMode = MeasureSpec.EXACTLY; } else if (widthMode == MeasureSpec.UNSPECIFIED) { widthMode = MeasureSpec.EXACTLY; widthSize = 300;/*from w w w . ja v a 2s . c o m*/ } } else { throw new IllegalStateException("Width must have an exact value or MATCH_PARENT"); } } else if (heightMode == MeasureSpec.UNSPECIFIED) { if (isInEditMode()) { // Don't crash the layout editor. Pick a magic number from thin // air instead. // TODO Better communication with tools of this bogus state. // It will crash on a real device. if (heightMode == MeasureSpec.UNSPECIFIED) { heightMode = MeasureSpec.AT_MOST; heightSize = 300; } } else { throw new IllegalStateException("Height must not be UNSPECIFIED"); } } int layoutHeight = 0; int maxLayoutHeight = -1; switch (heightMode) { case MeasureSpec.EXACTLY: layoutHeight = maxLayoutHeight = heightSize - getPaddingTop() - getPaddingBottom(); break; case MeasureSpec.AT_MOST: maxLayoutHeight = heightSize - getPaddingTop() - getPaddingBottom(); break; } float weightSum = 0; boolean canSlide = false; final int widthAvailable = widthSize - getPaddingLeft() - getPaddingRight(); int widthRemaining = widthAvailable; final int childCount = getChildCount(); if (childCount > 2) { Log.e(TAG, "onMeasure: More than two child views are not supported."); } // We'll find the current one below. mSlideableView = null; // First pass. Measure based on child LayoutParams width/height. // Weight will incur a second pass. for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (child.getVisibility() == GONE) { lp.dimWhenOffset = false; continue; } if (lp.weight > 0) { weightSum += lp.weight; // If we have no width, weight is the only contributor to the // final size. // Measure this view on the weight pass only. if (lp.width == 0) continue; } int childWidthSpec; final int horizontalMargin = lp.leftMargin + lp.rightMargin; if (lp.width == LayoutParams.WRAP_CONTENT) { childWidthSpec = MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin, MeasureSpec.AT_MOST); } else if (lp.width == LayoutParams.FILL_PARENT) { childWidthSpec = MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin, MeasureSpec.EXACTLY); } else { childWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); } int childHeightSpec; if (lp.height == LayoutParams.WRAP_CONTENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST); } else if (lp.height == LayoutParams.FILL_PARENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY); } else { childHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); } child.measure(childWidthSpec, childHeightSpec); final int childWidth = child.getMeasuredWidth(); final int childHeight = child.getMeasuredHeight(); if (heightMode == MeasureSpec.AT_MOST && childHeight > layoutHeight) { layoutHeight = Math.min(childHeight, maxLayoutHeight); } widthRemaining -= childWidth; canSlide |= lp.slideable = widthRemaining < 0; if (lp.slideable) { mSlideableView = child; } } // Resolve weight and make sure non-sliding panels are smaller than the // full screen. if (canSlide || weightSum > 0) { final int fixedPanelWidthLimit = widthAvailable - mOverhangSize; for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (child.getVisibility() == GONE) { continue; } final boolean skippedFirstPass = lp.width == 0 && lp.weight > 0; final int measuredWidth = skippedFirstPass ? 0 : child.getMeasuredWidth(); if (canSlide && child != mSlideableView) { if (lp.width < 0 && (measuredWidth > fixedPanelWidthLimit || lp.weight > 0)) { // Fixed panels in a sliding configuration should // be clamped to the fixed panel limit. final int childHeightSpec; if (skippedFirstPass) { // Do initial height measurement if we skipped // measuring this view // the first time around. if (lp.height == LayoutParams.WRAP_CONTENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST); } else if (lp.height == LayoutParams.FILL_PARENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY); } else { childHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); } } else { childHeightSpec = MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(), MeasureSpec.EXACTLY); } final int childWidthSpec = MeasureSpec.makeMeasureSpec(fixedPanelWidthLimit, MeasureSpec.EXACTLY); child.measure(childWidthSpec, childHeightSpec); } } else if (lp.weight > 0) { int childHeightSpec; if (lp.width == 0) { // This was skipped the first time; figure out a real // height spec. if (lp.height == LayoutParams.WRAP_CONTENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST); } else if (lp.height == LayoutParams.FILL_PARENT) { childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY); } else { childHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); } } else { childHeightSpec = MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(), MeasureSpec.EXACTLY); } if (canSlide) { // Consume available space final int horizontalMargin = lp.leftMargin + lp.rightMargin; final int newWidth = widthAvailable - horizontalMargin; final int childWidthSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY); if (measuredWidth != newWidth) { child.measure(childWidthSpec, childHeightSpec); } } else { // Distribute the extra width proportionally similar to // LinearLayout final int widthToDistribute = Math.max(0, widthRemaining); final int addedWidth = (int) (lp.weight * widthToDistribute / weightSum); final int childWidthSpec = MeasureSpec.makeMeasureSpec(measuredWidth + addedWidth, MeasureSpec.EXACTLY); child.measure(childWidthSpec, childHeightSpec); } } } } final int measuredWidth = widthSize; final int measuredHeight = layoutHeight + getPaddingTop() + getPaddingBottom(); setMeasuredDimension(measuredWidth, measuredHeight); mCanSlide = canSlide; if (mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE && !canSlide) { // Cancel scrolling in progress, it's no longer relevant. mDragHelper.abort(); } }
From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); if (widthMode != MeasureSpec.EXACTLY || heightMode != MeasureSpec.EXACTLY) { if (isInEditMode()) { // Don't crash the layout editor. Consume all of the space if specified // or pick a magic number from thin air otherwise. // TODO Better communication with tools of this bogus state. // It will crash on a real device. if (widthMode == MeasureSpec.AT_MOST) { widthMode = MeasureSpec.EXACTLY; } else if (widthMode == MeasureSpec.UNSPECIFIED) { widthMode = MeasureSpec.EXACTLY; widthSize = 300;//from ww w . j a v a2 s .c o m } if (heightMode == MeasureSpec.AT_MOST) { heightMode = MeasureSpec.EXACTLY; } else if (heightMode == MeasureSpec.UNSPECIFIED) { heightMode = MeasureSpec.EXACTLY; heightSize = 300; } } else { throw new IllegalArgumentException("DrawerLayout must be measured with MeasureSpec.EXACTLY."); } } setMeasuredDimension(widthSize, heightSize); final boolean applyInsets = mLastInsets != null && ViewCompat.getFitsSystemWindows(this); final int layoutDirection = ViewCompat.getLayoutDirection(this); // Gravity value for each drawer we've seen. Only one of each permitted. int foundDrawers = 0; final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (applyInsets) { final int cgrav = GravityCompat.getAbsoluteGravity(lp.gravity, layoutDirection); //if (ViewCompat.getFitsSystemWindows(child)) { IMPL.dispatchChildInsets(child, mLastInsets, cgrav); //} // IMPL.applyMarginInsets(lp, mLastInsets, cgrav); //} else { } if (isContentView(child)) { // Content views get measured at exactly the layout's size. final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY); final int contentHeightSpec = MeasureSpec .makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY); child.measure(contentWidthSpec, contentHeightSpec); } else if (isDrawerView(child)) { final int childGravity = getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK; if ((foundDrawers & childGravity) != 0) { throw new IllegalStateException( "Child drawer has absolute gravity " + gravityToString(childGravity) + " but this " + TAG + " already has a " + "drawer view along that edge"); } final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, mMinDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width); final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height); child.measure(drawerWidthSpec, drawerHeightSpec); } else { throw new IllegalStateException("Child " + child + " at index " + i + " does not have a valid layout_gravity - must be Gravity.LEFT, " + "Gravity.RIGHT or Gravity.NO_GRAVITY"); } } }
From source file:com.android.launcher2.PagedView.java
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (!mIsDataReady) { return;//from w ww .ja v a2s . c om } if (DEBUG) Log.d(TAG, "PagedView.onLayout()"); final int verticalPadding = getPaddingTop() + getPaddingBottom(); final int childCount = getChildCount(); int childLeft = getRelativeChildOffset(0); for (int i = 0; i < childCount; i++) { final View child = getPageAt(i); if (child.getVisibility() != View.GONE) { final int childWidth = getScaledMeasuredWidth(child); final int childHeight = child.getMeasuredHeight(); int childTop = getPaddingTop(); if (mCenterPagesVertically) { childTop += ((getMeasuredHeight() - verticalPadding) - childHeight) / 2; } if (DEBUG) Log.d(TAG, "\tlayout-child" + i + ": " + childLeft + ", " + childTop); child.layout(childLeft, childTop, childLeft + child.getMeasuredWidth(), childTop + childHeight); childLeft += childWidth + mPageSpacing; } } if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { setHorizontalScrollBarEnabled(false); updateCurrentPageScroll(); setHorizontalScrollBarEnabled(true); mFirstLayout = false; } }
From source file:android.support.v7.widget.Toolbar.java
private boolean shouldLayout(View view) { return view != null && view.getParent() == this && view.getVisibility() != GONE; }
From source file:android.support.v7.widget.LinearLayoutCompat.java
/** * Position the children during a layout pass if the orientation of this * LinearLayout is set to {@link #HORIZONTAL}. * * @see #getOrientation()//from www. ja v a 2s . co m * @see #setOrientation(int) * @see #onLayout(boolean, int, int, int, int) * @param left * @param top * @param right * @param bottom */ void layoutHorizontal(int left, int top, int right, int bottom) { final boolean isLayoutRtl = ViewUtils.isLayoutRtl(this); final int paddingTop = getPaddingTop(); int childTop; int childLeft; // Where bottom of child should go final int height = bottom - top; int childBottom = height - getPaddingBottom(); // Space available for child int childSpace = height - paddingTop - getPaddingBottom(); final int count = getVirtualChildCount(); final int majorGravity = mGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK; final int minorGravity = mGravity & Gravity.VERTICAL_GRAVITY_MASK; final boolean baselineAligned = mBaselineAligned; final int[] maxAscent = mMaxAscent; final int[] maxDescent = mMaxDescent; final int layoutDirection = ViewCompat.getLayoutDirection(this); switch (GravityCompat.getAbsoluteGravity(majorGravity, layoutDirection)) { case Gravity.RIGHT: // mTotalLength contains the padding already childLeft = getPaddingLeft() + right - left - mTotalLength; break; case Gravity.CENTER_HORIZONTAL: // mTotalLength contains the padding already childLeft = getPaddingLeft() + (right - left - mTotalLength) / 2; break; case Gravity.LEFT: default: childLeft = getPaddingLeft(); break; } int start = 0; int dir = 1; //In case of RTL, start drawing from the last child. if (isLayoutRtl) { start = count - 1; dir = -1; } for (int i = 0; i < count; i++) { int childIndex = start + dir * i; final View child = getVirtualChildAt(childIndex); if (child == null) { childLeft += measureNullChild(childIndex); } else if (child.getVisibility() != GONE) { final int childWidth = child.getMeasuredWidth(); final int childHeight = child.getMeasuredHeight(); int childBaseline = -1; final LinearLayoutCompat.LayoutParams lp = (LinearLayoutCompat.LayoutParams) child .getLayoutParams(); if (baselineAligned && lp.height != LayoutParams.MATCH_PARENT) { childBaseline = child.getBaseline(); } int gravity = lp.gravity; if (gravity < 0) { gravity = minorGravity; } switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) { case Gravity.TOP: childTop = paddingTop + lp.topMargin; if (childBaseline != -1) { childTop += maxAscent[INDEX_TOP] - childBaseline; } break; case Gravity.CENTER_VERTICAL: // Removed support for baseline alignment when layout_gravity or // gravity == center_vertical. See bug #1038483. // Keep the code around if we need to re-enable this feature // if (childBaseline != -1) { // // Align baselines vertically only if the child is smaller than us // if (childSpace - childHeight > 0) { // childTop = paddingTop + (childSpace / 2) - childBaseline; // } else { // childTop = paddingTop + (childSpace - childHeight) / 2; // } // } else { childTop = paddingTop + ((childSpace - childHeight) / 2) + lp.topMargin - lp.bottomMargin; break; case Gravity.BOTTOM: childTop = childBottom - childHeight - lp.bottomMargin; if (childBaseline != -1) { int descent = child.getMeasuredHeight() - childBaseline; childTop -= (maxDescent[INDEX_BOTTOM] - descent); } break; default: childTop = paddingTop; break; } if (hasDividerBeforeChildAt(childIndex)) { childLeft += mDividerWidth; } childLeft += lp.leftMargin; setChildFrame(child, childLeft + getLocationOffset(child), childTop, childWidth, childHeight); childLeft += childWidth + lp.rightMargin + getNextLocationOffset(child); i += getChildrenSkipCount(child, childIndex); } } }
From source file:bw.com.yunifangstore.view.LazyViewPager.java
@Override public void addView(View child, int index, LayoutParams params) { if (mInLayout) { addViewInLayout(child, index, params); child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec); } else {//from ww w.j a v a 2 s. c om super.addView(child, index, params); } if (USE_CACHE) { if (child.getVisibility() != GONE) { child.setDrawingCacheEnabled(mScrollingCacheEnabled); } else { child.setDrawingCacheEnabled(false); } } }
From source file:com.chenglong.muscle.ui.LazyViewPager.java
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { // ViewPagers should only report accessibility activity_tool_info for the current // page,//from www.ja v a2s.c o m // otherwise things get very confusing. // TODO: Should this note something dlg_about the paging container? final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() == VISIBLE) { final ItemInfo ii = infoForChild(child); if (ii != null && ii.position == mCurItem && child.dispatchPopulateAccessibilityEvent(event)) { return true; } } } return false; }
From source file:com.google.android.flexbox.FlexboxHelper.java
/** * Expand the view if the {@link FlexContainer#getAlignItems()} attribute is set to {@link * AlignItems#STRETCH} or {@link FlexboxLayout.LayoutParams#mAlignSelf} is set as * {@link AlignItems#STRETCH}.// w w w. j a v a2 s . c o m * * @param fromIndex the index from which value, stretch is calculated * @see FlexContainer#getFlexDirection() * @see FlexContainer#setFlexDirection(int) * @see FlexContainer#getAlignItems() * @see FlexContainer#setAlignItems(int) * @see FlexboxLayout.LayoutParams#mAlignSelf */ void stretchViews(int fromIndex) { if (fromIndex >= mFlexContainer.getFlexItemCount()) { return; } int flexDirection = mFlexContainer.getFlexDirection(); if (mFlexContainer.getAlignItems() == AlignItems.STRETCH) { int flexLineIndex = 0; if (mIndexToFlexLine != null) { flexLineIndex = mIndexToFlexLine[fromIndex]; } List<FlexLine> flexLines = mFlexContainer.getFlexLinesInternal(); for (int i = flexLineIndex, size = flexLines.size(); i < size; i++) { FlexLine flexLine = flexLines.get(i); for (int j = 0, itemCount = flexLine.mItemCount; j < itemCount; j++) { int viewIndex = flexLine.mFirstIndex + j; if (j >= mFlexContainer.getFlexItemCount()) { continue; } View view = mFlexContainer.getReorderedFlexItemAt(viewIndex); if (view == null || view.getVisibility() == View.GONE) { continue; } FlexItem flexItem = (FlexItem) view.getLayoutParams(); if (flexItem.getAlignSelf() != AlignSelf.AUTO && flexItem.getAlignSelf() != AlignItems.STRETCH) { continue; } switch (flexDirection) { case FlexDirection.ROW: // Intentional fall through case FlexDirection.ROW_REVERSE: stretchViewVertically(view, flexLine.mCrossSize, viewIndex); break; case FlexDirection.COLUMN: case FlexDirection.COLUMN_REVERSE: stretchViewHorizontally(view, flexLine.mCrossSize, viewIndex); break; default: throw new IllegalArgumentException("Invalid flex direction: " + flexDirection); } } } } else { for (FlexLine flexLine : mFlexContainer.getFlexLinesInternal()) { for (Integer index : flexLine.mIndicesAlignSelfStretch) { View view = mFlexContainer.getReorderedFlexItemAt(index); switch (flexDirection) { case FlexDirection.ROW: // Intentional fall through case FlexDirection.ROW_REVERSE: stretchViewVertically(view, flexLine.mCrossSize, index); break; case FlexDirection.COLUMN: case FlexDirection.COLUMN_REVERSE: stretchViewHorizontally(view, flexLine.mCrossSize, index); break; default: throw new IllegalArgumentException("Invalid flex direction: " + flexDirection); } } } } }