{"id":19867278,"url":"https://github.com/fython/eventshelper","last_synced_at":"2026-05-14T06:31:28.699Z","repository":{"id":79626219,"uuid":"183650419","full_name":"fython/EventsHelper","owner":"fython","description":"EventBus-like utility based on annotation processors","archived":false,"fork":false,"pushed_at":"2020-03-13T04:17:54.000Z","size":117,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-11T15:51:00.383Z","etag":null,"topics":["android-library","eventbus","kotlin-android"],"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/fython.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-26T15:14:27.000Z","updated_at":"2022-12-22T06:12:51.000Z","dependencies_parsed_at":"2023-03-07T00:00:28.915Z","dependency_job_id":null,"html_url":"https://github.com/fython/EventsHelper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fython%2FEventsHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fython%2FEventsHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fython%2FEventsHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fython%2FEventsHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fython","download_url":"https://codeload.github.com/fython/EventsHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241278832,"owners_count":19938027,"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-library","eventbus","kotlin-android"],"created_at":"2024-11-12T15:28:55.446Z","updated_at":"2026-05-14T06:31:23.677Z","avatar_url":"https://github.com/fython.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"EventsHelper\n====\n\n# Import\n\n![image](https://api.bintray.com/packages/fython/EventsHelper/events-library-core/images/download.svg)\n\n```groovy\nallprojects {\n    repositories {\n        // ...\n        maven { url 'https://dl.bintray.com/fython/EventsHelper' }\n    }\n}\n\ndependencies {\n    implementation 'moe.feng.common.eventshelper:events-library-core:1.0.3'\n    annotationProcessor 'moe.feng.common.eventshelper:events-compiler:1.0.3'\n    \n    // For Kotlin developers, please use 'kapt' instead of 'annotationProcessor'\n    // kapt 'moe.feng.common.eventshelper:events-compiler:1.0.3'\n    // implementation 'moe.feng.common.eventshelper:events-library-ktx:1.0.3'\n}\n```\n\n# How to use?\n\n## Create a listener and implement it\n\nCreate an interface class annotated with `@EventsListener`:\n\n```java\n@EventsListener\npublic interface MyListener {\n    \n    @EventsOnThread(EventsOnThread.MAIN_THREAD) // Schedule method calls on main thread\n    void onStatusUpdate(int status);\n    \n}\n```\n\nImplement this interface according to your own needs:\n\n```java\npublic class MyActivity extends Activity implements MyListener {\n    \n    ...\n    \n    @Override\n    public void onStatusUpdate(int status) {\n        Log.d(TAG, \"onStatusUpdate: status = \" + status);\n    }\n    \n}\n```\n\n## Register/Unregister listener\n\nRegister/Unregister listener at a proper time of components lifecycle:\n\n```java\npublic class MyActivity extends Activity implements MyListener {\n    \n    ...\n    \n    @Override\n    protected void onStart() {\n        super.onStart();\n        EventsHelper.getInstance(this /* extends Context */)\n                .registerListener(this /* implements MyListener */);\n    }\n    \n    @Override\n    protected void onStop() {\n        super.onStop();\n        EventsHelper.getInstance(this /* extends Context */)\n                .unregisterListener(this /* implements MyListener */);\n    }\n    \n}\n```\n\n## Call listeners by EventsHelper\n\n`EventsHelper` can help you call methods on all specific listener type cross over components.\n\nYou can use this way to get a listener wrapper and call it:\n\n```java\nMyListener listener = EventsHelper.getInstance(context).of(MyListener.class);\nlistener.onStatusUpdate(1000);\n```\n\n## Advanced usage\n\n### Schedule method calls on threads\n\nAnnotating methods with `@EventsOnThread(int type)` can tell `EventsHelper` to schedule calls \non specific threads.\n\nSupported threads type:\n\n- EventsOnThread.CURRENT_THREAD\n- EventsOnThread.MAIN_THREAD\n- EventsOnThread.NEW_THREAD\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2019-2020 Siubeng Fung (fython)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffython%2Feventshelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffython%2Feventshelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffython%2Feventshelper/lists"}