Coder Social home page Coder Social logo

ucodeustory / relax Goto Github PK

View Code? Open in Web Editor NEW
242.0 6.0 17.0 24.02 MB

☘☘Relax 基于Kotlin语言编写的一套组件化框架,不紧整体组件化、内部也高度组件化🎋你可配置MVP、MVVM的开发模式、也可以配置所需要的业务组件🍁🍁

License: MIT License

Kotlin 76.91% Java 23.09%
rxjava retrofit mvvm mvp livedata kotlin kotlin-extensions lifecycle arouter

relax's Introduction

Language SDK License

Relax 基于Kotlin语言编写的一套组件化框架,内部可以实现灵活的配置

Relax is a android frame by Component Frame

语言

Kotlin 使用技巧、里面是我踩过的各种坑(>_<)

架构模式

1. module

  业务层,分解成独立的模块

  module-business-news   module-business-weather   module-business-welfare   module-business-four

  每个模块内部可以实现插件化跟细粒度小功能

2. relax-business-component

  基础业务层和可变的第三方业务(比如地图封装、IM封装、日志上传封装、友盟统计封装、Bugly封装,这些业务我们
  情景1:可能实现方式会变(如图片加载之前用glide,现在想用Fresco,所以通过接口统一实现;
  情景2:有些业务可能在不同的App宿主中不需要,所以提供动态配置来减少安装包体积))
  所以针对第三方业务实现,通过分别实现不同的依赖库封装在BusinessFactory中,同时通过factoryinterface提供
  统一接口

3. relax-data-component

  数据层,提供业务数据,包含网络数据、本地数据,SP数据

4. relax-core-component

  基础组件层, 一些框架必须要用的library、核心的架构实现、如mvvm、mvp基础架构、自定义UI组件等

5. relax-dependents

  公共依赖集合,提供统一配置

6. 统一配置gradle.properties

### 库和应用两种模式间切换
### 只有app 为false 其他模块才可以设置true
relaxBusinessPlugin_isApp = false
relaxBusinessNews_isApp = false
relaxBusinessWeather_isApp = true
relaxBusinessWelfare_isApp = false
relaxBusinessComponent_isApp= false
### 启用检查代码 启用会牺牲打包时间
isCheckCode = false
### 动态配置减少打包体积
glideEnable = true
picassoEnable = false
isMVVM = true
isMVP = false
isApp = false

架构图

项目内容

1. 实现组件化,可以分层调试,单独模块调试;

2. 支持 checkstyle,pmd,findBugs对代码静态扫描,虽然目前只支持Java检查,但开发过程中还是会用到一些Java代码和xml的检查;

3. basic-component层 添加MVVM架构支持;

4. basic-component层,添加MVP架构支持;

5. 根据配置动态选择打包架构;

6. 封装kotlin版本的权限检查,使用更简单;

7. 将Application放到business-component层,因为我们要在这一层做基础业务组件开发,会全局初始化一些组件;

8. 封装data层接口,对外通过DataServiceManager提供统一接口(LocalDataService和NetDataService),在Service

  内部我们可以通过Retrofit、OkHttp、Volley等来实现网络请求,(项目核心使用rxjava来完成数据流,如果用其他网络框架,也尽量返回Observable,来保证封装一致性)

9. 封装图片加载框架,通过ImageEngine对外提供加载图片引擎,通过ILoader对底层提供实现接口

10. 封装插件化框架通过PluginManager进行管理插件

  例子:module-business-plugin模块就是用插件化实现的,具体插件式项目中的RelaxPluginDemo

11. 引入koin来解决kotlin依赖注入,更加方面,里面没有反射、代码生成

12. 封装权限处理 AndroidPermission

13. 封装多个值同时不为Null的判断,避免繁琐嵌套 CheckNullUtil

Libraries Used

  • Lifecycles - Create a UI that automatically responds to lifecycle events.
  • LiveData - Build data objects that notify views when the underlying database changes.
  • Navigation - Handle everything needed for in-app navigation.
  • Room - Access your app's SQLite database with in-app objects and compile-time checks.
  • ViewModel - Store UI-related data that isn't destroyed on app rotations. Easily schedule asynchronous tasks for optimal execution.
  • WorkManager - Manage your Android background jobs.
  • UI - Details on why and how to use UI Components in your apps - together or separate
  • Third party
    • Glide for image loading
    • Rxjava for Reactive Programming
    • ARouter A framework for assisting in the renovation of Android app componentization
    • Retrofit A restful client
    • EventBus An Android event publish/subscribe lightweight framework
    • Dagger a fully static, compile-time dependency injection framework for both Java and Android.
    • GSON Tool class for converting Java objects to Json strings and Json strings to objects
    • LeakCannary Is the main tool for Android to find memory leaks.
    • Aspect optimize your contact center performance through improved customer service and efficiency.
    • Koin A pragmatic lightweight dependency injection framework for Kotlin developers. Written in pure Kotlin using functional resolution only: no proxy, no code generation, no reflection!

开发过程错误总结

relax's People

Contributors

ucodeustory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

relax's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.