Skip to content
This repository was archived by the owner on Oct 15, 2018. It is now read-only.

Commit b1a278f

Browse files
author
Steve Lhomme
committed
Fix the pull happening when the top element is not shown
1 parent 3bd8ef6 commit b1a278f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,10 @@ private boolean isFirstItemVisible() {
388388
* now we'll just add one to account for it and rely on the inner
389389
* condition which checks getTop().
390390
*/
391-
if (mRefreshableView.getFirstVisiblePosition() <= 1) {
391+
if ((null == mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() == 0) ||
392+
(null != mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() <= 1)) {
392393
final View firstVisibleChild = mRefreshableView.getChildAt(0);
393-
if (firstVisibleChild != null) {
394+
if (firstVisibleChild != null && firstVisibleChild != mIndicatorIvTop) {
394395
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
395396
}
396397
}
@@ -423,10 +424,11 @@ private boolean isLastItemVisible() {
423424
* account for it and rely on the inner condition which checks
424425
* getBottom().
425426
*/
426-
if (lastVisiblePosition >= lastItemPosition - 1) {
427+
if ((null == mIndicatorIvBottom && lastVisiblePosition == lastItemPosition) ||
428+
(null != mIndicatorIvBottom && lastVisiblePosition >= lastItemPosition - 1)) {
427429
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
428430
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
429-
if (lastVisibleChild != null) {
431+
if (lastVisibleChild != null && lastVisibleChild != mIndicatorIvBottom) {
430432
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
431433
}
432434
}

0 commit comments

Comments
 (0)