Ejemplo n.º 1
0
  /**
   * 是否满足处理刷新的条件
   *
   * @return
   */
  private boolean shouldHandleLoadingMore() {
    if (mIsLoadingMore
        || mCurrentRefreshStatus == RefreshStatus.REFRESHING
        || mLoadMoreFooterView == null
        || mDelegate == null) {
      return false;
    }

    // 内容是普通控件,满足
    if (mNormalView != null) {
      return true;
    }

    if (ScrollingUtil.isWebViewToBottom(mWebView)) {
      return true;
    }

    if (ScrollingUtil.isScrollViewToBottom(mScrollView)) {
      return true;
    }

    if (mAbsListView != null) {
      return shouldHandleAbsListViewLoadingMore(mAbsListView);
    }

    if (mRecyclerView != null) {
      return shouldHandleRecyclerViewLoadingMore(mRecyclerView);
    }

    if (mStickyNavLayout != null) {
      return mStickyNavLayout.shouldHandleLoadingMore();
    }

    return false;
  }
Ejemplo n.º 2
0
  @Override
  public void onFinishInflate() {
    super.onFinishInflate();

    if (getChildCount() != 2) {
      throw new RuntimeException(BGARefreshLayout.class.getSimpleName() + "必须有且只有一个子控件");
    }

    mContentView = getChildAt(1);
    if (mContentView instanceof AbsListView) {
      mAbsListView = (AbsListView) mContentView;
    } else if (mContentView instanceof RecyclerView) {
      mRecyclerView = (RecyclerView) mContentView;
    } else if (mContentView instanceof ScrollView) {
      mScrollView = (ScrollView) mContentView;
    } else if (mContentView instanceof WebView) {
      mWebView = (WebView) mContentView;
    } else if (mContentView instanceof BGAStickyNavLayout) {
      mStickyNavLayout = (BGAStickyNavLayout) mContentView;
      mStickyNavLayout.setRefreshLayout(this);
    } else {
      mNormalView = mContentView;
      // 设置为可点击,否则在空白区域无法拖动
      mNormalView.setClickable(true);
    }
  }
Ejemplo n.º 3
0
  /** 显示上拉加载更多控件 */
  private void showLoadingMoreView() {
    mRefreshViewHolder.changeToLoadingMore();
    mLoadMoreFooterView.setVisibility(VISIBLE);

    ScrollingUtil.scrollToBottom(mScrollView);
    ScrollingUtil.scrollToBottom(mRecyclerView);
    ScrollingUtil.scrollToBottom(mAbsListView);
    if (mStickyNavLayout != null) {
      mStickyNavLayout.scrollToBottom();
    }
  }