Java Code Examples for android.support.v7.widget.RecyclerView.LayoutParams#isItemChanged()
The following examples show how to use
android.support.v7.widget.RecyclerView.LayoutParams#isItemChanged() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaggeredGridLayoutHelper.java From vlayout with MIT License | 5 votes |
void prependToSpan(View view, OrientationHelperEx helper) { LayoutParams lp = getLayoutParams(view); mViews.add(0, view); mCachedStart = INVALID_LINE; if (mViews.size() == 1) { mCachedEnd = INVALID_LINE; } if (lp.isItemRemoved() || lp.isItemChanged()) { mDeletedSize += helper.getDecoratedMeasurement(view); } }
Example 2
Source File: StaggeredGridLayoutHelper.java From vlayout with MIT License | 5 votes |
void appendToSpan(View view, OrientationHelperEx helper) { LayoutParams lp = getLayoutParams(view); mViews.add(view); mCachedEnd = INVALID_LINE; if (mViews.size() == 1) { mCachedStart = INVALID_LINE; } if (lp.isItemRemoved() || lp.isItemChanged()) { mDeletedSize += helper.getDecoratedMeasurement(view); } }
Example 3
Source File: StaggeredGridLayoutHelper.java From vlayout with MIT License | 5 votes |
void popEnd(OrientationHelperEx helper) { final int size = mViews.size(); View end = mViews.remove(size - 1); final LayoutParams lp = getLayoutParams(end); if (lp.isItemRemoved() || lp.isItemChanged()) { mDeletedSize -= helper.getDecoratedMeasurement(end); } if (size == 1) { mCachedStart = INVALID_LINE; } mCachedEnd = INVALID_LINE; }
Example 4
Source File: StaggeredGridLayoutHelper.java From vlayout with MIT License | 5 votes |
void popStart(OrientationHelperEx helper) { View start = mViews.remove(0); final LayoutParams lp = getLayoutParams(start); if (mViews.size() == 0) { mCachedEnd = INVALID_LINE; } if (lp.isItemRemoved() || lp.isItemChanged()) { mDeletedSize -= helper.getDecoratedMeasurement(start); } mCachedStart = INVALID_LINE; }
Example 5
Source File: LinearLayoutManager.java From letv with Apache License 2.0 | 4 votes |
void layoutChunk(Recycler recycler, State state, LayoutState layoutState, LayoutChunkResult result) { View view = layoutState.next(recycler); if (view == null) { result.mFinished = true; return; } int right; int left; int bottom; int top; LayoutParams params = (LayoutParams) view.getLayoutParams(); if (layoutState.mScrapList == null) { if (this.mShouldReverseLayout == (layoutState.mLayoutDirection == -1)) { addView(view); } else { addView(view, 0); } } else { if (this.mShouldReverseLayout == (layoutState.mLayoutDirection == -1)) { addDisappearingView(view); } else { addDisappearingView(view, 0); } } measureChildWithMargins(view, 0, 0); result.mConsumed = this.mOrientationHelper.getDecoratedMeasurement(view); if (this.mOrientation == 1) { if (isLayoutRTL()) { right = getWidth() - getPaddingRight(); left = right - this.mOrientationHelper.getDecoratedMeasurementInOther(view); } else { left = getPaddingLeft(); right = left + this.mOrientationHelper.getDecoratedMeasurementInOther(view); } if (layoutState.mLayoutDirection == -1) { bottom = layoutState.mOffset; top = layoutState.mOffset - result.mConsumed; } else { top = layoutState.mOffset; bottom = layoutState.mOffset + result.mConsumed; } } else { top = getPaddingTop(); bottom = top + this.mOrientationHelper.getDecoratedMeasurementInOther(view); if (layoutState.mLayoutDirection == -1) { right = layoutState.mOffset; left = layoutState.mOffset - result.mConsumed; } else { left = layoutState.mOffset; right = layoutState.mOffset + result.mConsumed; } } layoutDecorated(view, left + params.leftMargin, top + params.topMargin, right - params.rightMargin, bottom - params.bottomMargin); if (params.isItemRemoved() || params.isItemChanged()) { result.mIgnoreConsumed = true; } result.mFocusable = view.isFocusable(); }
Example 6
Source File: LinearLayoutManager.java From Mupdf with Apache License 2.0 | 4 votes |
void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, LayoutState layoutState, LayoutChunkResult result) { View view = layoutState.next(recycler); if (view == null) { if (DEBUG && layoutState.mScrapList == null) { throw new RuntimeException("received null view when unexpected"); } // if we are laying out views in scrap, this may return null which means there is // no more items to layout. result.mFinished = true; return; } LayoutParams params = (LayoutParams) view.getLayoutParams(); if (layoutState.mScrapList == null) { if (mShouldReverseLayout == (layoutState.mLayoutDirection == LayoutState.LAYOUT_START)) { addView(view); } else { addView(view, 0); } } else { if (mShouldReverseLayout == (layoutState.mLayoutDirection == LayoutState.LAYOUT_START)) { addDisappearingView(view); } else { addDisappearingView(view, 0); } } measureChildWithMargins(view, 0, 0); result.mConsumed = mOrientationHelper.getDecoratedMeasurement(view); int left, top, right, bottom; if (mOrientation == VERTICAL) { if (isLayoutRTL()) { right = getWidth() - getPaddingRight(); left = right - mOrientationHelper.getDecoratedMeasurementInOther(view); } else { left = getPaddingLeft(); right = left + mOrientationHelper.getDecoratedMeasurementInOther(view); } if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { bottom = layoutState.mOffset; top = layoutState.mOffset - result.mConsumed; } else { top = layoutState.mOffset; bottom = layoutState.mOffset + result.mConsumed; } } else { top = getPaddingTop(); bottom = top + mOrientationHelper.getDecoratedMeasurementInOther(view); if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { right = layoutState.mOffset; left = layoutState.mOffset - result.mConsumed; } else { left = layoutState.mOffset; right = layoutState.mOffset + result.mConsumed; } } // We calculate everything with View's bounding box (which includes decor and margins) // To calculate correct layout position, we subtract margins. layoutDecorated(view, left + params.leftMargin, top + params.topMargin, right - params.rightMargin, bottom - params.bottomMargin); if (DEBUG) { Log.d(TAG, "laid out child at position " + getPosition(view) + ", with l:" + (left + params.leftMargin) + ", t:" + (top + params.topMargin) + ", r:" + (right - params.rightMargin) + ", b:" + (bottom - params.bottomMargin)); } // Consume the available space if the view is not removed OR changed if (params.isItemRemoved() || params.isItemChanged()) { result.mIgnoreConsumed = true; } result.mFocusable = view.isFocusable(); }