コード例 #1
0
  @Override
  public void onRefresh() {
    super.onRefresh();
    page = 1;
    GetImagelistModel.getImageList(tab, page)
        .subscribe(
            new Observer<NetImage[]>() {
              @Override
              public void onCompleted() {
                JUtils.Log("onCompleted");
              }

              @Override
              public void onError(Throwable e) {
                JUtils.Log("onError");
                getRefreshSubscriber().onError(e);
              }

              @Override
              public void onNext(NetImage[] imgs) {
                netImages.clear();
                netImages.addAll(Arrays.asList(imgs));
                getRefreshSubscriber().onNext(netImages);
                page++;
                getAdapter().setOnItemClickListener(NetImgListPresenter.this);
              }
            });
  }
コード例 #2
0
  @Override
  public void onLoadMore() {
    super.onLoadMore();
    GetImagelistModel.getImageList(tab, page)
        .subscribe(
            new Subscriber<NetImage[]>() {
              @Override
              public void onCompleted() {}

              @Override
              public void onError(Throwable e) {
                getMoreSubscriber().onError(e);
              }

              @Override
              public void onNext(NetImage[] imgs) {
                netImages.addAll(Arrays.asList(imgs));
                getMoreSubscriber().onNext(Arrays.asList(imgs));
                page++;
              }
            });
  }