Beispiel #1
0
  @Override
  public void computeScroll() {
    if (mScroller.computeScrollOffset()) {
      if (mScrollBack == SCROLL_BACK_HEADER) {
        mHeader.setVisibleHeight(mScroller.getCurrY());
      } else {
        mFooterView.setBottomMargin(mScroller.getCurrY());
      }

      postInvalidate();
      invokeOnScrolling();
    }
    super.computeScroll();
  }
  private void updateHeaderHeight(float delta) {
    mHeader.setVisibleHeight((int) delta + mHeader.getVisibleHeight());

    if (mEnablePullRefresh && !mPullRefreshing) {
      // update the arrow image unrefreshing
      if (mHeader.getVisibleHeight() > mHeaderHeight) {
        mHeader.setState(XHeaderView.STATE_READY);
      } else {
        mHeader.setState(XHeaderView.STATE_NORMAL);
      }
    }

    // scroll to top each time
    setSelection(0);
  }
  /** Auto call back refresh. */
  public void autoRefresh() {
    mHeader.setVisibleHeight(mHeaderHeight);

    if (mEnablePullRefresh && !mPullRefreshing) {
      // update the arrow image not refreshing
      if (mHeader.getVisibleHeight() > mHeaderHeight) {
        mHeader.setState(XHeaderView.STATE_READY);
      } else {
        mHeader.setState(XHeaderView.STATE_NORMAL);
      }
    }

    mPullRefreshing = true;
    mHeader.setState(XHeaderView.STATE_REFRESHING);
    refresh();
  }
Beispiel #4
0
  private void updateHeaderHeight(float delta) {
    mHeader.setVisibleHeight((int) delta + mHeader.getVisibleHeight());

    if (mEnablePullRefresh && !mPullRefreshing) {
      // update the arrow image unrefreshing
      if (mHeader.getVisibleHeight() > mHeaderHeight) {
        mHeader.setState(XHeaderView.STATE_READY);
      } else {
        mHeader.setState(XHeaderView.STATE_NORMAL);
      }
    }

    // scroll to top each time
    post(
        new Runnable() {
          @Override
          public void run() {
            XScrollView.this.fullScroll(ScrollView.FOCUS_UP);
          }
        });
  }