{"id":13694659,"url":"https://github.com/ladingwu/SimpleRxBusApplication","last_synced_at":"2025-05-03T04:30:45.409Z","repository":{"id":95578402,"uuid":"151238319","full_name":"ladingwu/SimpleRxBusApplication","owner":"ladingwu","description":"an easy bus","archived":false,"fork":false,"pushed_at":"2018-11-21T09:54:21.000Z","size":162,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T18:52:34.287Z","etag":null,"topics":["bus","rxbus"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladingwu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-02T10:37:58.000Z","updated_at":"2023-05-01T14:10:07.000Z","dependencies_parsed_at":"2023-05-20T22:30:14.628Z","dependency_job_id":null,"html_url":"https://github.com/ladingwu/SimpleRxBusApplication","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladingwu%2FSimpleRxBusApplication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladingwu%2FSimpleRxBusApplication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladingwu%2FSimpleRxBusApplication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladingwu%2FSimpleRxBusApplication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladingwu","download_url":"https://codeload.github.com/ladingwu/SimpleRxBusApplication/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252144379,"owners_count":21701398,"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":["bus","rxbus"],"created_at":"2024-08-02T17:01:36.714Z","updated_at":"2025-05-03T04:30:43.836Z","avatar_url":"https://github.com/ladingwu.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# SimpleRxBus\n\u003e **一个更加简单易用的RxBus**\n\n- 使用简介\n    - 集成\n    ```\n     //请确保原来项目中已经引入了RxJava2.0+的依赖，如没有，请引入\n    implementation 'com.ladingwu.library:SimpleRxBus:0.3'\n     // 需要v7的support包,如果原项目中已经存在，则不必引入\n    implementation 'com.android.support:appcompat-v7:28.0.0'\n\n\n    ```\n    - 发送普通事件\n    ```\n    RxBusUtils.post(\"filter_message\",mesage);\n    ```\n\n    - 接收事件(自动取消订阅)\n    ```\n    // in Fragment or FragmentActivity\n     RxBusUtils.receive(this,\"filter_message\", new RxBusReceiver\u003cObject\u003e() {\n                @Override\n                public void receive(Object message) {\n                    // handle this\n                }\n            });\n    ```\n\n    - 发送粘性事件\n    ```\n    RxBusUtils.postSticky(\"filter_sticky_message\",message);\n    ```\n    - 接收粘性事件(自动取消订阅)\n    ```\n    // in Fragment or FragmentActivity\n    RxBusUtils.receiveSticky(this,\"filter_message\", new RxBusReceiver\u003cObject\u003e() {\n                @Override\n                public void receive(Object message) {\n                        // handle this\n                }\n            });\n    ```\n\n    - 特殊情况\n    ```\n    //如果无法拿到Fragment/FragmentActivity的实例，则接收事件的时候，需要自行处理取消注册的工作\n        Disposable disposable = RxBusUtils.receive(\"filter\", new RxBusReceiver\u003cObject\u003e() {\n            @Override\n            public void receive(Object data) {\n                // handle this\n            }\n        });\n\n        // 在合适的时机取消注册\n        if (disposable != null \u0026\u0026 !disposable.isDisposed()) {\n            disposable.dispose();\n        }\n    ```\n\n- SimpleRxBus的优点\n    - 简单，好用，支持普通事件/粘性事件的收发\n    - 无需显式的调用注册和取消注册接口，框架会自动注册，并且根据生命周期会自动取消注册\n    - 即插即用，无论是新项目还是老项目，都不需要做额外的处理，在这一点上，对老项目尤为友好","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladingwu%2FSimpleRxBusApplication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladingwu%2FSimpleRxBusApplication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladingwu%2FSimpleRxBusApplication/lists"}