{"id":19228795,"url":"https://github.com/ucodeustory/relax","last_synced_at":"2025-08-20T16:32:30.831Z","repository":{"id":190525104,"uuid":"146243987","full_name":"UCodeUStory/Relax","owner":"UCodeUStory","description":"☘☘Relax 基于Kotlin语言编写的一套组件化框架,不紧整体组件化、内部也高度组件化🎋你可配置MVP、MVVM的开发模式、也可以配置所需要的业务组件🍁🍁","archived":false,"fork":false,"pushed_at":"2019-08-14T08:39:09.000Z","size":24600,"stargazers_count":243,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T18:01:42.669Z","etag":null,"topics":["arouter","kotlin","kotlin-extensions","lifecycle","livedata","mvp","mvvm","retrofit","rxjava"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/UCodeUStory.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}},"created_at":"2018-08-27T03:47:51.000Z","updated_at":"2025-03-24T12:19:19.000Z","dependencies_parsed_at":"2023-08-25T03:40:40.384Z","dependency_job_id":null,"html_url":"https://github.com/UCodeUStory/Relax","commit_stats":null,"previous_names":["ucodeustory/relax"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/UCodeUStory/Relax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UCodeUStory%2FRelax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UCodeUStory%2FRelax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UCodeUStory%2FRelax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UCodeUStory%2FRelax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UCodeUStory","download_url":"https://codeload.github.com/UCodeUStory/Relax/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UCodeUStory%2FRelax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271349823,"owners_count":24744353,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arouter","kotlin","kotlin-extensions","lifecycle","livedata","mvp","mvvm","retrofit","rxjava"],"created_at":"2024-11-09T15:30:08.638Z","updated_at":"2025-08-20T16:32:30.162Z","avatar_url":"https://github.com/UCodeUStory.png","language":"Kotlin","readme":"\n\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"810\" height=\"180\" src=\"https://github.com/UCodeUStory/Relax/blob/master/source/relax.png\"/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n![Language](https://img.shields.io/badge/language-Kotlin-EE0000.svg)\n![](https://img.shields.io/badge/QQ-1483888222-green.svg)\n![SDK](https://img.shields.io/badge/SDK-14%2B-orange.svg)\n[![License](https://img.shields.io/apm/l/vim-mode.svg)](https://github.com/UCodeUStory/Relax/tree/master/LICENSE)\n\n\u003c/div\u003e\n\n\nRelax 基于Kotlin语言编写的一套组件化框架，内部可以实现灵活的配置\n\nRelax is a android frame by Component Frame\n\n### 语言\n[Kotlin 使用技巧、里面是我踩过的各种坑(\u003e_\u003c) ](https://github.com/UCodeUStory/Relax/tree/master/source/kotlin.md)\n\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg width=\"180\" height=\"320\" src=\"https://github.com/UCodeUStory/Relax/blob/master/source/tianqi.jpg\"/\u003e\n\u003cimg width=\"180\" height=\"320\" src=\"https://github.com/UCodeUStory/Relax/blob/master/source/meitu.jpg\"/\u003e\n\u003cimg width=\"180\" height=\"320\" src=\"https://github.com/UCodeUStory/Relax/blob/master/source/xinwen.jpg\"/\u003e\n\n\u003c/div\u003e\n\n\n### 架构模式\n\n#### 1. module\n\n      业务层，分解成独立的模块\n\n      module-business-news   module-business-weather   module-business-welfare   module-business-four\n\n      每个模块内部可以实现插件化跟细粒度小功能\n\n#### 2. relax-business-component\n\n      基础业务层和可变的第三方业务(比如地图封装、IM封装、日志上传封装、友盟统计封装、Bugly封装，这些业务我们\n      情景1：可能实现方式会变(如图片加载之前用glide，现在想用Fresco,所以通过接口统一实现；\n      情景2：有些业务可能在不同的App宿主中不需要，所以提供动态配置来减少安装包体积))\n      所以针对第三方业务实现，通过分别实现不同的依赖库封装在BusinessFactory中，同时通过factoryinterface提供\n      统一接口\n\n#### 3. relax-data-component\n\n      数据层，提供业务数据，包含网络数据、本地数据，SP数据\n\n#### 4. relax-core-component\n\n      基础组件层, 一些框架必须要用的library、核心的架构实现、如mvvm、mvp基础架构、自定义UI组件等\n\n#### 5. relax-dependents\n\n      公共依赖集合，提供统一配置\n\n#### 6. 统一配置gradle.properties\n\n    ### 库和应用两种模式间切换\n    ### 只有app 为false 其他模块才可以设置true\n    relaxBusinessPlugin_isApp = false\n    relaxBusinessNews_isApp = false\n    relaxBusinessWeather_isApp = true\n    relaxBusinessWelfare_isApp = false\n    relaxBusinessComponent_isApp= false\n    ### 启用检查代码 启用会牺牲打包时间\n    isCheckCode = false\n    ### 动态配置减少打包体积\n    glideEnable = true\n    picassoEnable = false\n    isMVVM = true\n    isMVP = false\n    isApp = false\n\n\n### 架构图\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg width=\"1050\" height=\"800\" src=\"https://github.com/UCodeUStory/Relax/blob/master/source/new_frame.png\"/\u003e\n\n\u003c/div\u003e\n\n\n\n### 项目内容\n\n#### 1. 实现组件化，可以分层调试，单独模块调试；\n#### 2. 支持 checkstyle,pmd,findBugs对代码静态扫描，虽然目前只支持Java检查，但开发过程中还是会用到一些Java代码和xml的检查；\n#### 3. basic-component层 添加MVVM架构支持；\n#### 4. basic-component层，添加MVP架构支持；\n#### 5. 根据配置动态选择打包架构；\n#### 6. 封装kotlin版本的权限检查，使用更简单；\n#### 7. 将Application放到business-component层，因为我们要在这一层做基础业务组件开发，会全局初始化一些组件；\n#### 8. 封装data层接口，对外通过DataServiceManager提供统一接口(LocalDataService和NetDataService)，在Service\n\n      内部我们可以通过Retrofit、OkHttp、Volley等来实现网络请求,(项目核心使用rxjava来完成数据流，如果用其他网络框架，也尽量返回Observable,来保证封装一致性)\n\n#### 9. 封装图片加载框架，通过ImageEngine对外提供加载图片引擎，通过ILoader对底层提供实现接口\n#### 10. 封装插件化框架通过PluginManager进行管理插件\n\n      例子：module-business-plugin模块就是用插件化实现的，具体插件式项目中的RelaxPluginDemo\n\n#### 11. 引入koin来解决kotlin依赖注入，更加方面，里面没有反射、代码生成\n\n#### 12. 封装权限处理 AndroidPermission\n\n#### 13. 封装多个值同时不为Null的判断,避免繁琐嵌套 CheckNullUtil\n\nLibraries Used\n--------------\n\n  * [Lifecycles][12] - Create a UI that automatically responds to lifecycle events.\n  * [LiveData][13] - Build data objects that notify views when the underlying database changes.\n  * [Navigation][14] - Handle everything needed for in-app navigation.\n  * [Room][16] - Access your app's SQLite database with in-app objects and compile-time checks.\n  * [ViewModel][17] - Store UI-related data that isn't destroyed on app rotations. Easily schedule\n     asynchronous tasks for optimal execution.\n  * [WorkManager][18] - Manage your Android background jobs.\n* [UI][30] - Details on why and how to use UI Components in your apps - together or separate\n  * [Animations \u0026 Transitions][31] - Move widgets and transition between screens.\n  * [Fragment][34] - A basic unit of composable UI.\n  * [Layout][35] - Lay out widgets using different algorithms.\n* Third party\n  * [Glide][90] for image loading\n  * [Rxjava][91]  for Reactive Programming\n  * [ARouter][92]   A framework for assisting in the renovation of Android app componentization\n  * [Retrofit][93] A restful client\n  * [EventBus][94] An Android event publish/subscribe lightweight framework\n  * [Dagger][95] a fully static, compile-time dependency injection framework for both Java and Android.\n  * [GSON][97] Tool class for converting Java objects to Json strings and Json strings to objects\n  * [LeakCannary][99] Is the main tool for Android to find memory leaks.\n  * [Aspect][100] optimize your contact center performance through improved customer service and efficiency.\n  * [Koin][101] A pragmatic lightweight dependency injection framework for Kotlin developers. Written in pure Kotlin using functional resolution only: no proxy, no code generation, no reflection!\n\n[0]: https://developer.android.com/jetpack/foundation/\n[1]: https://developer.android.com/topic/libraries/support-library/packages#v7-appcompat\n[2]: https://developer.android.com/kotlin/ktx\n[4]: https://developer.android.com/training/testing/\n[10]: https://developer.android.com/jetpack/arch/\n[11]: https://developer.android.com/topic/libraries/data-binding/\n[12]: https://developer.android.com/topic/libraries/architecture/lifecycle\n[13]: https://developer.android.com/topic/libraries/architecture/livedata\n[14]: https://developer.android.com/topic/libraries/architecture/navigation/\n[16]: https://developer.android.com/topic/libraries/architecture/room\n[17]: https://developer.android.com/topic/libraries/architecture/viewmodel\n[18]: https://developer.android.com/topic/libraries/architecture/workmanager\n[30]: https://developer.android.com/jetpack/ui/\n[31]: https://developer.android.com/training/animation/\n[34]: https://developer.android.com/guide/components/fragments\n[35]: https://developer.android.com/guide/topics/ui/declaring-layout\n[90]: https://bumptech.github.io/glide/\n[91]: https://github.com/ReactiveX/RxJava\n[92]: https://github.com/alibaba/ARouter\n[93]: https://github.com/square/retrofit\n[94]: http://greenrobot.org/eventbus/\n[95]: https://google.github.io/dagger/android\n[96]: https://github.com/square/okhttp\n[97]: https://github.com/google/gson\n[98]: https://github.com/bumptech/glide\n[99]: https://github.com/square/leakcanary\n[100]: http://mvnrepository.com/artifact/org.aspectj/aspectjtools\n[101]:https://insert-koin.io/\n\n\n### 开发过程错误总结\n- [错误日志](https://github.com/UCodeUStory/Relax/tree/master/source/error_note.md)\n\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucodeustory%2Frelax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fucodeustory%2Frelax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucodeustory%2Frelax/lists"}