{"id":19808745,"url":"https://github.com/zhihu/rxlifecycle","last_synced_at":"2025-04-06T05:18:13.461Z","repository":{"id":149234898,"uuid":"79629802","full_name":"zhihu/RxLifecycle","owner":"zhihu","description":"Bind observables to the lifecycle of Activity or Fragment in a non-invasive way.","archived":false,"fork":false,"pushed_at":"2018-06-14T01:42:34.000Z","size":238,"stargazers_count":515,"open_issues_count":4,"forks_count":44,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-30T04:09:55.374Z","etag":null,"topics":["android","rxjava-wrapper","rxjava2"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhihu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-21T07:00:50.000Z","updated_at":"2025-02-09T05:14:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"45c82383-4dc2-4f57-bc07-76a39048477c","html_url":"https://github.com/zhihu/RxLifecycle","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhihu%2FRxLifecycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhihu%2FRxLifecycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhihu%2FRxLifecycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhihu%2FRxLifecycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhihu","download_url":"https://codeload.github.com/zhihu/RxLifecycle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436501,"owners_count":20938579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","rxjava-wrapper","rxjava2"],"created_at":"2024-11-12T09:14:41.211Z","updated_at":"2025-04-06T05:18:13.436Z","avatar_url":"https://github.com/zhihu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"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):\n\n- 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.\n\n- 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.\n\nThe simplest usage:\n\n```java\nObservable.interval(0, 2, TimeUnit.SECONDS)\n        // ...\n        .compose(RxLifecycle.bind(this)\n                .\u003cLong\u003edisposeObservableWhen(LifecycleEvent.DESTROY_VIEW))\n        .subscribe();\n```\n\nIn 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.\n\nTo integrate this library to your project, you need to add the JitPack repository to `build.gradle` repositories firstly.\n\n```gradle\nrepositories {\n    maven { url \"https://jitpack.io\" }\n}\n```\n\nAnd then add library dependencies:\n\n```gradle\ndependencies {\n    compile 'com.github.nekocode.rxlifecycle:rxlifecycle:{lastest-version}'\n    compile 'com.github.nekocode.rxlifecycle:rxlifecycle-compact:{lastest-version}' // Optional\n}\n```\n\nThis 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).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhihu%2Frxlifecycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhihu%2Frxlifecycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhihu%2Frxlifecycle/lists"}