@Override protected void resetHeader() { super.resetHeader(); if (getShowIndicatorInternal()) { updateIndicatorViewsVisibility(); } }
@Override public final boolean onTouchEvent(MotionEvent event) { if (!isPullToRefreshEnabled()) { return false; } // If we're refreshing, and the flag is set. Eat the event if (mDisableScrollingWhileRefreshing && isRefreshing()) { return true; } if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) { return false; } switch (event.getAction()) { case MotionEvent.ACTION_MOVE: { if (mIsBeingDragged) { mLastMotionY = event.getY(); pullEvent(); return true; } break; } case MotionEvent.ACTION_DOWN: { if (isReadyForPull()) { mLastMotionY = mInitialMotionY = event.getY(); return true; } break; } case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: { if (mIsBeingDragged) { mIsBeingDragged = false; if (mState == RELEASE_TO_REFRESH) { if (null != mOnRefreshListener) { setRefreshingInternal(true); mOnRefreshListener.onRefresh(this); return true; } else if (null != mOnRefreshListener2) { setRefreshingInternal(true); if (mCurrentMode == Mode.PULL_DOWN_TO_REFRESH) { mOnRefreshListener2.onPullDownToRefresh(this); } else if (mCurrentMode == Mode.PULL_UP_TO_REFRESH) { mOnRefreshListener2.onPullUpToRefresh(this); } return true; } else { // If we don't have a listener, just reset resetHeader(); return true; } } smoothScrollTo(0); return true; } break; } } return false; }
@Override public final void onRefreshComplete() { if (mState != PULL_TO_REFRESH) { resetHeader(); } }