コード例 #1
0
  private boolean tryToPerformRefresh() {
    if (mStatus != PTR_STATUS_PREPARE) {
      return false;
    }

    //
    if ((mPtrIndicator.isOverOffsetToKeepHeaderWhileLoading() && isAutoRefresh())
        || mPtrIndicator.isOverOffsetToRefresh()) {
      mStatus = PTR_STATUS_LOADING;
      performRefresh();
    }
    return false;
  }
コード例 #2
0
  public void autoRefresh(boolean atOnce, int duration) {

    if (mStatus != PTR_STATUS_INIT) {
      return;
    }

    mFlag |= atOnce ? FLAG_AUTO_REFRESH_AT_ONCE : FLAG_AUTO_REFRESH_BUT_LATER;

    mStatus = PTR_STATUS_PREPARE;
    if (mPtrUIHandlerHolder.hasHandler()) {
      mPtrUIHandlerHolder.onUIRefreshPrepare(this);
      if (DEBUG) {
        PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag);
      }
    }
    mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToRefresh(), duration);
    if (atOnce) {
      mStatus = PTR_STATUS_LOADING;
      performRefresh();
    }
  }