当前位置: 首页>>代码示例>>Java>>正文


Java RxFragment类代码示例

本文整理汇总了Java中com.trello.rxlifecycle2.components.support.RxFragment的典型用法代码示例。如果您正苦于以下问题:Java RxFragment类的具体用法?Java RxFragment怎么用?Java RxFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RxFragment类属于com.trello.rxlifecycle2.components.support包,在下文中一共展示了RxFragment类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestList

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public void requestList(String cacheName , int id,boolean update){
  if (update) page = 1;
  mModel.getListData("/tnfs/api/list",cacheName,page,id,update)
      .subscribeOn(Schedulers.io())
      .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
      .doOnSubscribe(disposable ->mRootView.showLoading())//显示上拉刷新的进度条
      .subscribeOn(AndroidSchedulers.mainThread())
      .observeOn(AndroidSchedulers.mainThread())
      .doAfterTerminate(()->mRootView.hideLoading())
      .compose(((RxFragment) mRootView).bindUntilEvent(FragmentEvent.DESTROY))//使用RXlifecycle,使subscription和activity一起销毁
      .subscribe(new SuccessSubscriber<NewsListEntity>(mErrorHandler) {
        @Override
        public void onSuccess(NewsListEntity entity) {
          page++;
          mRootView.loadListData(entity.getTngou(),true);
        }
        @Override
        public void onError(Throwable e) {
          super.onError(e);
          mRootView.loadListData(null,false);
        }
      });
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:24,代码来源:NewsListPresenter.java

示例2: CCDownloadTask

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public CCDownloadTask(RxFragment fragment, String taskKey, String sourceUrl, String savePath, String saveName, int priority, long fileSize, long downloadedSize) {
    super(fragment);
    this.taskKey = taskKey;
    this.sourceUrl = sourceUrl;
    this.savePath = savePath;
    this.saveName = saveName;
    this.priority = priority;
    this.downloadStatus = CCDownloadStatus.WAIT;
    this.fileSize = fileSize;
    this.downloadedSize = downloadedSize;
}
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:12,代码来源:CCDownloadTask.java

示例3: setupFragments

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
private void setupFragments() {
    lastShowFragment = 0;
    CollectionFragment collectionFragment = new CollectionFragment();
    NewFragment newFragment = new NewFragment();
    FeaturedFragment featuredFragment = new FeaturedFragment();
    RandomFragment randomFragment = new RandomFragment();
    mRxFragments = new RxFragment[]{collectionFragment, newFragment, featuredFragment, randomFragment};
    mFragmentManager.beginTransaction()
            .add(R.id.container, collectionFragment)
            .show(collectionFragment)
            .commitAllowingStateLoss();
}
 
开发者ID:alphater,项目名称:garras,代码行数:13,代码来源:NavigationFragment.java

示例4: bindToLifeCycle

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public static LifecycleProvider bindToLifeCycle(IView view) {
    if (view instanceof RxAppCompatActivity) {
        return (LifecycleProvider<ActivityEvent>) view;
    } else if (view instanceof RxFragment) {
        return (LifecycleProvider<Fragment>) view;
    } else {
        throw new IllegalArgumentException("Unable find fragment or activity properly");
    }
}
 
开发者ID:harrylefit,项目名称:EazyBaseMVP,代码行数:10,代码来源:RxUtils.java

示例5: bindToLifecycle

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
    if (view instanceof RxAppCompatActivity) {
        return ((RxAppCompatActivity) view).bindToLifecycle();
    } else if (view instanceof RxFragment) {
        return ((RxFragment) view).bindToLifecycle();
    } else {
        throw new IllegalArgumentException("view isn't activity or fragment");
    }

}
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:11,代码来源:RxUtils.java

示例6: CCBaseDownloadTask

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public CCBaseDownloadTask(RxFragment fragment) {
    this.netLifecycleComposer = fragment.bindUntilEvent(FragmentEvent.DESTROY);
    initTaskStamp();
}
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:5,代码来源:CCBaseDownloadTask.java

示例7: CCDownloadTask2

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public CCDownloadTask2(RxFragment fragment, String taskKey, String sourceUrl, String savePath, String saveName, int priority, long fileSize, long downloadedSize) {
    super(sourceUrl, savePath, saveName, priority, null, fileSize);
    this.taskKey = taskKey;
    this.downloadStatus = CCDownloadStatus.WAIT;
    this.downloadedSize = downloadedSize;
}
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:7,代码来源:CCDownloadTask2.java

示例8: SlotListAdapter

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public SlotListAdapter(ArrayList<SlotRoomViewModel> items, ListType type, RxFragment fragment) {
    this.items = items;
    this.type = type;
    this.fragment = fragment;
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:6,代码来源:SlotListAdapter.java

示例9: fragmentLifecycle

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public static <T> ObservableTransformer<T, T> fragmentLifecycle(RxFragment fragment) {
    return observable ->
        observable.compose(fragment.bindUntilEvent(FragmentEvent.DESTROY));
}
 
开发者ID:xcc3641,项目名称:SeeWeather,代码行数:5,代码来源:RxUtil.java

示例10: fragmentLifecycleF

import com.trello.rxlifecycle2.components.support.RxFragment; //导入依赖的package包/类
public static <T> FlowableTransformer<T, T> fragmentLifecycleF(RxFragment fragment) {
    return flowable ->
        flowable.compose(fragment.bindUntilEvent(FragmentEvent.DESTROY));
}
 
开发者ID:xcc3641,项目名称:SeeWeather,代码行数:5,代码来源:RxUtil.java


注:本文中的com.trello.rxlifecycle2.components.support.RxFragment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。