Merge "Remove calls to LM.getItemCount in demos."

This commit is contained in:
Yigit Boyar
2014-06-12 23:05:41 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 4 deletions

View File

@@ -286,7 +286,7 @@ public class AnimatedRecyclerView extends Activity {
final int scrollBy = -Math.min(dy - scrolled, hangingBottom);
scrolled -= scrollBy;
offsetChildrenVertical(scrollBy);
if (scrolled < dy && getItemCount() > mFirstPosition + getChildCount()) {
if (scrolled < dy && state.getItemCount() > mFirstPosition + getChildCount()) {
View v = recycler.getViewForPosition(mFirstPosition + getChildCount());
final int top = getChildAt(getChildCount() - 1).getBottom();
addView(v);
@@ -332,7 +332,7 @@ public class AnimatedRecyclerView extends Activity {
}
}
if (direction == View.FOCUS_DOWN || direction == View.FOCUS_FORWARD) {
while (mFirstPosition + getChildCount() < getItemCount() &&
while (mFirstPosition + getChildCount() < state.getItemCount() &&
newViewsHeight < mScrollDistance) {
View v = recycler.getViewForPosition(mFirstPosition + getChildCount());
final int top = getChildAt(getChildCount() - 1).getBottom();

View File

@@ -176,7 +176,7 @@ public class RecyclerViewActivity extends Activity {
final int scrollBy = -Math.min(dy - scrolled, hangingBottom);
scrolled -= scrollBy;
offsetChildrenVertical(scrollBy);
if (scrolled < dy && getItemCount() > mFirstPosition + getChildCount()) {
if (scrolled < dy && state.getItemCount() > mFirstPosition + getChildCount()) {
View v = recycler.getViewForPosition(mFirstPosition + getChildCount());
final int top = getDecoratedBottom(getChildAt(getChildCount() - 1));
addView(v);
@@ -222,7 +222,7 @@ public class RecyclerViewActivity extends Activity {
}
}
if (direction == View.FOCUS_DOWN || direction == View.FOCUS_FORWARD) {
while (mFirstPosition + getChildCount() < getItemCount() &&
while (mFirstPosition + getChildCount() < state.getItemCount() &&
newViewsHeight < mScrollDistance) {
View v = recycler.getViewForPosition(mFirstPosition + getChildCount());
final int top = getDecoratedBottom(getChildAt(getChildCount() - 1));