コード例 #1
0
  @Override
  protected void banderDataAndListner() {
    Glide.with(this)
        .load(CommonCache.get().getImageUrl(childTypeId))
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .into(imageView);
    mListView.addHeaderView(imageView);
    articleListAdapter = new ArticleListAdapter(articleList, getActivity());
    mListView.setAdapter(articleListAdapter);

    mPullToRefreshLayout.setOnRefreshListener(
        new PullToRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
            page = 1;
            getArticleListByNet();
          }

          @Override
          public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
            getArticleListByNet();
          }
        });

    mPullToRefreshLayout.setHfBackgroundColor(CommonCache.get().getColorByType(childTypeId));
  }
コード例 #2
0
  @Override
  protected void requestEnd(boolean success, ErrorMessage e, boolean openLoading) {
    super.requestEnd(success, e, openLoading);
    Log.d("ArticleListFragment", "requestEnd:" + e + success);
    if (!openLoading) {
      if (page == 1) {
        Log.d("ArticleListFragment", "-----------------------------------------");
        mPullToRefreshLayout.refreshFinish(success ? State.SUCCEED : State.FAIL);
      } else {
        mPullToRefreshLayout.loadmoreFinish(success ? State.SUCCEED : State.FAIL);
      }
    }

    if (success) {
      page++;
    }
  }