2 Star 0 Fork 0

mirrors_zhihu/RxLifecycle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0
RxLifecyle is a library that can help you to unsubscribe the observable sequences automatically when a activity or fragment is destroying. There are some differences between this library and [trello/RxLifecycle](https://github.com/trello/RxLifecycle): - This library will actually unsubscribe the sequence (See [here](https://github.com/trello/RxLifecycle#unsubscription)). It means that the downstream observer will not receive `onComplete()`, `onError()`... anymore when the unsubscription occurs. - This library doesn't require you to inherit any activity or fragment. It will insert a non-gui fragment to your activity or fragment to listen the lifecycle events. The simplest usage: ```java Observable.interval(0, 2, TimeUnit.SECONDS) // ... .compose(RxLifecycle.bind(this) .<Long>disposeObservableWhen(LifecycleEvent.DESTROY_VIEW)) .subscribe(); ``` In order to make sure the downstream will not continue to emit items, you need to put the `compose(RxLifecycle.bind ..)` at the bottom of the chain call. See the [example](example/src/main/java/cn/nekocode/rxlifecycle/sample/MainActivity.java) for learning more usages. To integrate this library to your project, you need to add the JitPack repository to `build.gradle` repositories firstly. ```gradle repositories { maven { url "https://jitpack.io" } } ``` And then add library dependencies: ```gradle dependencies { compile 'com.github.nekocode.rxlifecycle:rxlifecycle:{lastest-version}' compile 'com.github.nekocode.rxlifecycle:rxlifecycle-compact:{lastest-version}' // Optional } ``` This project is licensed under [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). The lastest version of the library is [![Release](https://jitpack.io/v/zhihu/rxlifecycle.svg)](https://jitpack.io/#zhihu/rxlifecycle).

简介

暂无描述 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_zhihu/RxLifecycle.git
git@gitee.com:mirrors_zhihu/RxLifecycle.git
mirrors_zhihu
RxLifecycle
RxLifecycle
master

搜索帮助