{"id":19074975,"url":"https://github.com/iqiyi/lotus","last_synced_at":"2025-04-29T16:45:57.054Z","repository":{"id":92820758,"uuid":"116375366","full_name":"iqiyi/lotus","owner":"iqiyi","description":"lotus is a framework for intereact between views in Android","archived":false,"fork":false,"pushed_at":"2018-03-22T11:27:35.000Z","size":594,"stargazers_count":73,"open_issues_count":3,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-18T19:41:35.154Z","etag":null,"topics":["android","interactive","lifecycle"],"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/iqiyi.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,"zenodo":null}},"created_at":"2018-01-05T10:53:43.000Z","updated_at":"2022-05-18T06:34:00.000Z","dependencies_parsed_at":"2023-04-27T07:16:58.557Z","dependency_job_id":null,"html_url":"https://github.com/iqiyi/lotus","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/iqiyi%2Flotus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqiyi%2Flotus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqiyi%2Flotus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iqiyi%2Flotus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iqiyi","download_url":"https://codeload.github.com/iqiyi/lotus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251543659,"owners_count":21606502,"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","interactive","lifecycle"],"created_at":"2024-11-09T01:52:56.070Z","updated_at":"2025-04-29T16:45:57.049Z","avatar_url":"https://github.com/iqiyi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lotus\r\n\r\nLotus: a library for handling interaction between pages or modules in Android. \r\nImplemented based on Google Lifecycle-aware and the classic observer pattern.\r\n\u003cbr/\u003e\r\n\u003cimg src=\"data-react.png\" width=\"500\" height=\"187\"/\u003e\r\n\r\nFeatures\r\n-------------------\r\n\r\n**Observers have life-cycle attributes**  Observers bind lifecycle owner(Activity/Fragment) with an API. Lifecycle-aware components perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.\r\n\r\n**Single Data pool** Lotus uses the single data pool for dispatching data and it can handle cross-module interaction perfectly. \r\n\r\n**Notify events more efficiently** Lotus only notify events to the observers which    subscribe the event.\r\n\r\n**Support Mutex observer** The Data with a type(DataReactType) can hold one mutex observer.\r\n\r\n**Support Annotation** Write the code with @DataSubscribe annotation to your subscriber methods. The performance can be improved greatly by indexing in build time than reflection in run time.\r\n\r\n**Compatible without lifecycle** Lotus provides api for observes without lifecycle.\r\n\r\n[Click for Chinese-README](Chinese-README.md)\r\n\r\nGetting started\r\n-------------------\r\n\r\n1. Define event type in DataReactType class:\r\n\r\n```java\r\n public static final String LOGIN_SUCCESS = \"type_1\"\r\n```\r\n2. Declare subscribers:\r\n \r\n```java\r\n        @DataSubscribe(dataType ={DataReactType.LOGIN_SUCCESS})\r\n        public void onLoginSuccess(Data data) { \r\n            //do something\r\n            Log.e(TAG, \"get data:\" + data.getData());\r\n        } \r\n```\r\n3. Set data:\r\n\r\n```java\r\n  DataReact.set(new Data(DataReactType.LOGIN_SUCCESS).setData(userInfo));\r\n```\r\n\r\n\r\nLicense\r\n-------------------\r\n\r\nCopyright (C) 2018 iQIYI.com\r\n\r\nLotus binaries and source code can be used according to the [Apache License, Version 2.0](LICENSE).\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqiyi%2Flotus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiqiyi%2Flotus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqiyi%2Flotus/lists"}