Skip to content

Commit

Permalink
Fix the pull happening when the top element is not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Lhomme committed Aug 6, 2013
1 parent 3bd8ef6 commit b1a278f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,10 @@ private boolean isFirstItemVisible() {
* now we'll just add one to account for it and rely on the inner
* condition which checks getTop().
*/
if (mRefreshableView.getFirstVisiblePosition() <= 1) {
if ((null == mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() == 0) ||
(null != mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() <= 1)) {
final View firstVisibleChild = mRefreshableView.getChildAt(0);
if (firstVisibleChild != null) {
if (firstVisibleChild != null && firstVisibleChild != mIndicatorIvTop) {
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
}
}
Expand Down Expand Up @@ -423,10 +424,11 @@ private boolean isLastItemVisible() {
* account for it and rely on the inner condition which checks
* getBottom().
*/
if (lastVisiblePosition >= lastItemPosition - 1) {
if ((null == mIndicatorIvBottom && lastVisiblePosition == lastItemPosition) ||
(null != mIndicatorIvBottom && lastVisiblePosition >= lastItemPosition - 1)) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if (lastVisibleChild != null) {
if (lastVisibleChild != null && lastVisibleChild != mIndicatorIvBottom) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
Expand Down

1 comment on commit b1a278f

@renkangke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this bug fixed!

Please sign in to comment.