未验证 提交 611c7554 编写于 作者: T Takeshi Hagikura 提交者: GitHub

Fix compiler warnings (#540)

Fix compiler warnings
上级 5b9f5318
...@@ -976,7 +976,7 @@ class FlexboxHelper { ...@@ -976,7 +976,7 @@ class FlexboxHelper {
if (widthMode == View.MeasureSpec.EXACTLY) { if (widthMode == View.MeasureSpec.EXACTLY) {
mainSize = widthSize; mainSize = widthSize;
} else { } else {
mainSize = largestMainSize > widthSize ? widthSize : largestMainSize; mainSize = Math.min(largestMainSize, widthSize);
} }
paddingAlongMainAxis = mFlexContainer.getPaddingLeft() paddingAlongMainAxis = mFlexContainer.getPaddingLeft()
+ mFlexContainer.getPaddingRight(); + mFlexContainer.getPaddingRight();
...@@ -1016,10 +1016,10 @@ class FlexboxHelper { ...@@ -1016,10 +1016,10 @@ class FlexboxHelper {
private void ensureChildrenFrozen(int size) { private void ensureChildrenFrozen(int size) {
if (mChildrenFrozen == null) { if (mChildrenFrozen == null) {
mChildrenFrozen = new boolean[size < INITIAL_CAPACITY ? INITIAL_CAPACITY : size]; mChildrenFrozen = new boolean[Math.max(size, INITIAL_CAPACITY)];
} else if (mChildrenFrozen.length < size) { } else if (mChildrenFrozen.length < size) {
int newCapacity = mChildrenFrozen.length * 2; int newCapacity = mChildrenFrozen.length * 2;
mChildrenFrozen = new boolean[newCapacity >= size ? newCapacity : size]; mChildrenFrozen = new boolean[Math.max(newCapacity, size)];
} else { } else {
Arrays.fill(mChildrenFrozen, false); Arrays.fill(mChildrenFrozen, false);
} }
...@@ -1908,20 +1908,20 @@ class FlexboxHelper { ...@@ -1908,20 +1908,20 @@ class FlexboxHelper {
void ensureMeasuredSizeCache(int size) { void ensureMeasuredSizeCache(int size) {
if (mMeasuredSizeCache == null) { if (mMeasuredSizeCache == null) {
mMeasuredSizeCache = new long[size < INITIAL_CAPACITY ? INITIAL_CAPACITY : size]; mMeasuredSizeCache = new long[Math.max(size, INITIAL_CAPACITY)];
} else if (mMeasuredSizeCache.length < size) { } else if (mMeasuredSizeCache.length < size) {
int newCapacity = mMeasuredSizeCache.length * 2; int newCapacity = mMeasuredSizeCache.length * 2;
newCapacity = newCapacity >= size ? newCapacity : size; newCapacity = Math.max(newCapacity, size);
mMeasuredSizeCache = Arrays.copyOf(mMeasuredSizeCache, newCapacity); mMeasuredSizeCache = Arrays.copyOf(mMeasuredSizeCache, newCapacity);
} }
} }
void ensureMeasureSpecCache(int size) { void ensureMeasureSpecCache(int size) {
if (mMeasureSpecCache == null) { if (mMeasureSpecCache == null) {
mMeasureSpecCache = new long[size < INITIAL_CAPACITY ? INITIAL_CAPACITY : size]; mMeasureSpecCache = new long[Math.max(size, INITIAL_CAPACITY)];
} else if (mMeasureSpecCache.length < size) { } else if (mMeasureSpecCache.length < size) {
int newCapacity = mMeasureSpecCache.length * 2; int newCapacity = mMeasureSpecCache.length * 2;
newCapacity = newCapacity >= size ? newCapacity : size; newCapacity = Math.max(newCapacity, size);
mMeasureSpecCache = Arrays.copyOf(mMeasureSpecCache, newCapacity); mMeasureSpecCache = Arrays.copyOf(mMeasureSpecCache, newCapacity);
} }
} }
...@@ -1977,10 +1977,10 @@ class FlexboxHelper { ...@@ -1977,10 +1977,10 @@ class FlexboxHelper {
void ensureIndexToFlexLine(int size) { void ensureIndexToFlexLine(int size) {
if (mIndexToFlexLine == null) { if (mIndexToFlexLine == null) {
mIndexToFlexLine = new int[size < INITIAL_CAPACITY ? INITIAL_CAPACITY : size]; mIndexToFlexLine = new int[Math.max(size, INITIAL_CAPACITY)];
} else if (mIndexToFlexLine.length < size) { } else if (mIndexToFlexLine.length < size) {
int newCapacity = mIndexToFlexLine.length * 2; int newCapacity = mIndexToFlexLine.length * 2;
newCapacity = newCapacity >= size ? newCapacity : size; newCapacity = Math.max(newCapacity, size);
mIndexToFlexLine = Arrays.copyOf(mIndexToFlexLine, newCapacity); mIndexToFlexLine = Arrays.copyOf(mIndexToFlexLine, newCapacity);
} }
} }
...@@ -2002,8 +2002,8 @@ class FlexboxHelper { ...@@ -2002,8 +2002,8 @@ class FlexboxHelper {
// Deleting from the last to avoid unneeded copy it happens when deleting the middle of the // Deleting from the last to avoid unneeded copy it happens when deleting the middle of the
// item in the ArrayList // item in the ArrayList
for (int i = flexLines.size() - 1; i >= fromFlexLine; i--) { if (flexLines.size() > fromFlexLine) {
flexLines.remove(i); flexLines.subList(fromFlexLine, flexLines.size()).clear();
} }
int fillTo = mIndexToFlexLine.length - 1; int fillTo = mIndexToFlexLine.length - 1;
......
...@@ -27,6 +27,7 @@ import android.view.View; ...@@ -27,6 +27,7 @@ import android.view.View;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
/** /**
...@@ -87,14 +88,20 @@ public class FlexboxItemDecoration extends RecyclerView.ItemDecoration { ...@@ -87,14 +88,20 @@ public class FlexboxItemDecoration extends RecyclerView.ItemDecoration {
} }
@Override @Override
public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { public void onDraw(
@NonNull Canvas canvas,
@NonNull RecyclerView parent,
@NonNull RecyclerView.State state) {
drawHorizontalDecorations(canvas, parent); drawHorizontalDecorations(canvas, parent);
drawVerticalDecorations(canvas, parent); drawVerticalDecorations(canvas, parent);
} }
@Override @Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, public void getItemOffsets(
RecyclerView.State state) { @NonNull Rect outRect,
@NonNull View view,
RecyclerView parent,
@NonNull RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view); int position = parent.getChildAdapterPosition(view);
if (position == 0) { if (position == 0) {
return; return;
......
...@@ -223,7 +223,6 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -223,7 +223,6 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
setFlexDirection(flexDirection); setFlexDirection(flexDirection);
setFlexWrap(flexWrap); setFlexWrap(flexWrap);
setAlignItems(AlignItems.STRETCH); setAlignItems(AlignItems.STRETCH);
setAutoMeasureEnabled(true);
mContext = context; mContext = context;
} }
...@@ -262,10 +261,14 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -262,10 +261,14 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
setFlexWrap(FlexWrap.WRAP); setFlexWrap(FlexWrap.WRAP);
setAlignItems(AlignItems.STRETCH); setAlignItems(AlignItems.STRETCH);
setAutoMeasureEnabled(true);
mContext = context; mContext = context;
} }
@Override
public boolean isAutoMeasureEnabled() {
return true;
}
// From here, methods from FlexContainer // From here, methods from FlexContainer
@FlexDirection @FlexDirection
@Override @Override
...@@ -371,6 +374,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -371,6 +374,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
@NonNull
public List<FlexLine> getFlexLines() { public List<FlexLine> getFlexLines() {
List<FlexLine> result = new ArrayList<>(mFlexLines.size()); List<FlexLine> result = new ArrayList<>(mFlexLines.size());
for (int i = 0, size = mFlexLines.size(); i < size; i++) { for (int i = 0, size = mFlexLines.size(); i < size; i++) {
...@@ -537,7 +541,11 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -537,7 +541,11 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
if (getChildCount() == 0) { if (getChildCount() == 0) {
return null; return null;
} }
int firstChildPos = getPosition(getChildAt(0)); View view = getChildAt(0);
if (view == null) {
return null;
}
int firstChildPos = getPosition(view);
int direction = targetPosition < firstChildPos ? -1 : 1; int direction = targetPosition < firstChildPos ? -1 : 1;
if (isMainAxisDirectionHorizontal()) { if (isMainAxisDirectionHorizontal()) {
return new PointF(0, direction); return new PointF(0, direction);
...@@ -738,8 +746,8 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -738,8 +746,8 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
int startOffset; int startOffset;
int endOffset; int endOffset;
int filledToEnd = fill(recycler, state, mLayoutState);
if (mAnchorInfo.mLayoutFromEnd) { if (mAnchorInfo.mLayoutFromEnd) {
int filledToEnd = fill(recycler, state, mLayoutState);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, String.format("filled: %d toward start", filledToEnd)); Log.d(TAG, String.format("filled: %d toward start", filledToEnd));
} }
...@@ -751,7 +759,6 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -751,7 +759,6 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
endOffset = mLayoutState.mOffset; endOffset = mLayoutState.mOffset;
} else { } else {
int filledToEnd = fill(recycler, state, mLayoutState);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, String.format("filled: %d toward end", filledToEnd)); Log.d(TAG, String.format("filled: %d toward end", filledToEnd));
} }
...@@ -1112,8 +1119,11 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1112,8 +1119,11 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
: mOrientationHelper.getDecoratedStart(anchorView); : mOrientationHelper.getDecoratedStart(anchorView);
} else { } else {
if (getChildCount() > 0) { if (getChildCount() > 0) {
int position = getPosition(getChildAt(0)); View view = getChildAt(0);
anchorInfo.mLayoutFromEnd = mPendingScrollPosition < position; if (view != null) {
int position = getPosition(view);
anchorInfo.mLayoutFromEnd = mPendingScrollPosition < position;
}
} }
anchorInfo.assignCoordinateFromPadding(); anchorInfo.assignCoordinateFromPadding();
} }
...@@ -1229,6 +1239,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1229,6 +1239,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
int diff = end > start ? 1 : -1; int diff = end > start ? 1 : -1;
for (int i = start; i != end; i += diff) { for (int i = start; i != end; i += diff) {
View view = getChildAt(i); View view = getChildAt(i);
if (view == null) {
continue;
}
int position = getPosition(view); int position = getPosition(view);
if (position >= 0 && position < itemCount) { if (position >= 0 && position < itemCount) {
if (((RecyclerView.LayoutParams) view.getLayoutParams()).isItemRemoved()) { if (((RecyclerView.LayoutParams) view.getLayoutParams()).isItemRemoved()) {
...@@ -1327,7 +1340,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1327,7 +1340,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
return; return;
} }
View firstView = getChildAt(0); View firstView = getChildAt(0);
if (firstView == null) {
return;
}
int currentLineIndex = mFlexboxHelper.mIndexToFlexLine[getPosition(firstView)]; int currentLineIndex = mFlexboxHelper.mIndexToFlexLine[getPosition(firstView)];
if (currentLineIndex == NO_POSITION) { if (currentLineIndex == NO_POSITION) {
return; return;
...@@ -1336,6 +1351,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1336,6 +1351,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
int recycleTo = -1; int recycleTo = -1;
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View view = getChildAt(i); View view = getChildAt(i);
if (view == null) {
continue;
}
if (canViewBeRecycledFromStart(view, layoutState.mScrollingOffset)) { if (canViewBeRecycledFromStart(view, layoutState.mScrollingOffset)) {
if (flexLine.mLastIndex == getPosition(view)) { if (flexLine.mLastIndex == getPosition(view)) {
// Recycle the views in a flex line if all views end positions are lower than // Recycle the views in a flex line if all views end positions are lower than
...@@ -1371,13 +1389,15 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1371,13 +1389,15 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
return; return;
} }
assert mFlexboxHelper.mIndexToFlexLine != null; assert mFlexboxHelper.mIndexToFlexLine != null;
int limit = mOrientationHelper.getEnd() - layoutState.mScrollingOffset;
int childCount = getChildCount(); int childCount = getChildCount();
if (childCount == 0) { if (childCount == 0) {
return; return;
} }
View lastView = getChildAt(childCount - 1); View lastView = getChildAt(childCount - 1);
if (lastView == null) {
return;
}
int currentLineIndex = mFlexboxHelper.mIndexToFlexLine[getPosition(lastView)]; int currentLineIndex = mFlexboxHelper.mIndexToFlexLine[getPosition(lastView)];
if (currentLineIndex == NO_POSITION) { if (currentLineIndex == NO_POSITION) {
return; return;
...@@ -1387,6 +1407,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1387,6 +1407,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
FlexLine flexLine = mFlexLines.get(currentLineIndex); FlexLine flexLine = mFlexLines.get(currentLineIndex);
for (int i = childCount - 1; i >= 0; i--) { for (int i = childCount - 1; i >= 0; i--) {
View view = getChildAt(i); View view = getChildAt(i);
if (view == null) {
continue;
}
if (canViewBeRecycledFromEnd(view, layoutState.mScrollingOffset)) { if (canViewBeRecycledFromEnd(view, layoutState.mScrollingOffset)) {
if (flexLine.mFirstIndex == getPosition(view)) { if (flexLine.mFirstIndex == getPosition(view)) {
// Recycle the views in a flex line if all views start positions are beyond the // Recycle the views in a flex line if all views start positions are beyond the
...@@ -1914,8 +1937,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -1914,8 +1937,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
@Override @Override
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler,
RecyclerView.State state) { RecyclerView.State state) {
if (!isMainAxisDirectionHorizontal() || if (!isMainAxisDirectionHorizontal() || (mFlexWrap == FlexWrap.NOWRAP)) {
(mFlexWrap == FlexWrap.NOWRAP && isMainAxisDirectionHorizontal())) {
int scrolled = handleScrollingMainOrientation(dx, recycler, state); int scrolled = handleScrollingMainOrientation(dx, recycler, state);
mViewCache.clear(); mViewCache.clear();
return scrolled; return scrolled;
...@@ -2046,6 +2068,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2046,6 +2068,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
boolean columnAndRtl = !mainAxisHorizontal && mIsRtl; boolean columnAndRtl = !mainAxisHorizontal && mIsRtl;
if (layoutDirection == LayoutState.LAYOUT_END) { if (layoutDirection == LayoutState.LAYOUT_END) {
View lastVisible = getChildAt(getChildCount() - 1); View lastVisible = getChildAt(getChildCount() - 1);
if (lastVisible == null) {
return;
}
mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(lastVisible); mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(lastVisible);
int lastVisiblePosition = getPosition(lastVisible); int lastVisiblePosition = getPosition(lastVisible);
int lastVisibleLinePosition = mFlexboxHelper.mIndexToFlexLine[lastVisiblePosition]; int lastVisibleLinePosition = mFlexboxHelper.mIndexToFlexLine[lastVisiblePosition];
...@@ -2067,8 +2092,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2067,8 +2092,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(referenceView); mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(referenceView);
mLayoutState.mScrollingOffset = -mOrientationHelper.getDecoratedStart(referenceView) mLayoutState.mScrollingOffset = -mOrientationHelper.getDecoratedStart(referenceView)
+ mOrientationHelper.getStartAfterPadding(); + mOrientationHelper.getStartAfterPadding();
mLayoutState.mScrollingOffset = mLayoutState.mScrollingOffset >= 0 ? mLayoutState.mScrollingOffset = Math.max(mLayoutState.mScrollingOffset, 0);
mLayoutState.mScrollingOffset : 0;
} else { } else {
mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(referenceView); mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(referenceView);
mLayoutState.mScrollingOffset = mOrientationHelper.getDecoratedEnd(referenceView) mLayoutState.mScrollingOffset = mOrientationHelper.getDecoratedEnd(referenceView)
...@@ -2100,7 +2124,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2100,7 +2124,9 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
} else { } else {
View firstVisible = getChildAt(0); View firstVisible = getChildAt(0);
if (firstVisible == null) {
return;
}
mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(firstVisible); mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(firstVisible);
int firstVisiblePosition = getPosition(firstVisible); int firstVisiblePosition = getPosition(firstVisible);
int firstVisibleLinePosition = mFlexboxHelper.mIndexToFlexLine[firstVisiblePosition]; int firstVisibleLinePosition = mFlexboxHelper.mIndexToFlexLine[firstVisiblePosition];
...@@ -2129,8 +2155,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2129,8 +2155,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(referenceView); mLayoutState.mOffset = mOrientationHelper.getDecoratedEnd(referenceView);
mLayoutState.mScrollingOffset = mOrientationHelper.getDecoratedEnd(referenceView) mLayoutState.mScrollingOffset = mOrientationHelper.getDecoratedEnd(referenceView)
- mOrientationHelper.getEndAfterPadding(); - mOrientationHelper.getEndAfterPadding();
mLayoutState.mScrollingOffset = mLayoutState.mScrollingOffset >= 0 ? mLayoutState.mScrollingOffset = Math.max(mLayoutState.mScrollingOffset, 0);
mLayoutState.mScrollingOffset : 0;
} else { } else {
mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(referenceView); mLayoutState.mOffset = mOrientationHelper.getDecoratedStart(referenceView);
mLayoutState.mScrollingOffset = -mOrientationHelper.getDecoratedStart(referenceView) mLayoutState.mScrollingOffset = -mOrientationHelper.getDecoratedStart(referenceView)
...@@ -2207,7 +2232,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2207,7 +2232,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeHorizontalScrollExtent(RecyclerView.State state) { public int computeHorizontalScrollExtent(@NonNull RecyclerView.State state) {
int scrollExtent = computeScrollExtent(state); int scrollExtent = computeScrollExtent(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeHorizontalScrollExtent: " + scrollExtent); Log.d(TAG, "computeHorizontalScrollExtent: " + scrollExtent);
...@@ -2216,7 +2241,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2216,7 +2241,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeVerticalScrollExtent(RecyclerView.State state) { public int computeVerticalScrollExtent(@NonNull RecyclerView.State state) {
int scrollExtent = computeScrollExtent(state); int scrollExtent = computeScrollExtent(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeVerticalScrollExtent: " + scrollExtent); Log.d(TAG, "computeVerticalScrollExtent: " + scrollExtent);
...@@ -2242,7 +2267,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2242,7 +2267,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeHorizontalScrollOffset(RecyclerView.State state) { public int computeHorizontalScrollOffset(@NonNull RecyclerView.State state) {
int scrollOffset = computeScrollOffset(state); int scrollOffset = computeScrollOffset(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeHorizontalScrollOffset: " + scrollOffset); Log.d(TAG, "computeHorizontalScrollOffset: " + scrollOffset);
...@@ -2251,7 +2276,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2251,7 +2276,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeVerticalScrollOffset(RecyclerView.State state) { public int computeVerticalScrollOffset(@NonNull RecyclerView.State state) {
int scrollOffset = computeScrollOffset(state); int scrollOffset = computeScrollOffset(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeVerticalScrollOffset: " + scrollOffset); Log.d(TAG, "computeVerticalScrollOffset: " + scrollOffset);
...@@ -2288,7 +2313,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2288,7 +2313,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeHorizontalScrollRange(RecyclerView.State state) { public int computeHorizontalScrollRange(@NonNull RecyclerView.State state) {
int scrollRange = computeScrollRange(state); int scrollRange = computeScrollRange(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeHorizontalScrollRange: " + scrollRange); Log.d(TAG, "computeHorizontalScrollRange: " + scrollRange);
...@@ -2297,7 +2322,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2297,7 +2322,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
public int computeVerticalScrollRange(RecyclerView.State state) { public int computeVerticalScrollRange(@NonNull RecyclerView.State state) {
int scrollRange = computeScrollRange(state); int scrollRange = computeScrollRange(state);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "computeVerticalScrollRange: " + scrollRange); Log.d(TAG, "computeVerticalScrollRange: " + scrollRange);
...@@ -2929,6 +2954,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -2929,6 +2954,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
@NonNull
public String toString() { public String toString() {
return "AnchorInfo{" + return "AnchorInfo{" +
"mPosition=" + mPosition + "mPosition=" + mPosition +
...@@ -3001,6 +3027,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -3001,6 +3027,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
} }
@Override @Override
@NonNull
public String toString() { public String toString() {
return "LayoutState{" + return "LayoutState{" +
"mAvailable=" + mAvailable + "mAvailable=" + mAvailable +
...@@ -3074,6 +3101,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements ...@@ -3074,6 +3101,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
}; };
@Override @Override
@NonNull
public String toString() { public String toString() {
return "SavedState{" + return "SavedState{" +
"mAnchorPosition=" + mAnchorPosition + "mAnchorPosition=" + mAnchorPosition +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册