mvvmcomponent

Introduction: :v::fist::wave:玩安卓 Mvvm 组件化客户端,整合 Jetpack 组件 DataBinding、ViewModel 以及 LiveData;屏幕适配:heavy_check_mark:状态栏沉浸式:heavy_check_mark:黑夜模式:heavy_check_mark:,使用 Koin 实现的依赖注入等
More: Author   ReportBugs   OfficialWebsite   
Tags:

Platform GitHub license

项目截图

下载体验请移步: 玩安卓

项目介绍

  • 基于 Mvvm 模式集成谷歌官方推荐的 JetPack 组件库 LiveData+ViewModel+DataBinding,以 ARouter 为组件路由实现的玩 Android 开放 API 安卓客户端
  • 数据源于玩 Android 开放 API,集成了登录注册、收藏、分享、搜索、浏览热门博客和项目、添加 Todo 待办功能等,涵盖了几乎所有玩 Android 开放接口
  • 项目结合 okhttp+Retrofit+RxJava2+Gson 组合实现网络请求、Glide 图像加载、Koin 实现依赖注入、阿里 ARouter 实现组件路由通信跳转、腾讯 MMKV 替代 Sharedpreferences 实现高性能本地缓存、基于 LiveData 的消息总线 LiveEventbus 事件分发等等
  • 以一个通用库模块+多业务组件的 Mvvm 组件化方案,编译、调试、多人开发更方便更快捷

项目架构

Google 官方推荐架构图

遵循如上 Google Mvvm 官方推荐架构,UI 与数据分离,以 ViewModel 为中介进行通信,实现数据驱动 UI。通过 Koin 依赖注入本地数据+远程数据=数据仓库,外部只需一行代码调用,隐藏具体实现,规避数据滥用、后期维护难等问题

采用单一容器 ContainerActivity+多 Fragment 配合 Fragmentation 库、阿里 ARouter 通信跳转实现单 activity 多 fragment 组件化架构

  • lib_base:通用功能组件,支撑业务组件基础,提供其他业务组件实现能力
  • module_login:业务组件,注册登录模块,以及启动页
  • module_main:业务组件,app 内 Tab 首页模块
  • module_project:业务组件,app 内 Tab 项目模块
  • module_search:功能组件,提供搜索功能
  • module_square:业务组件,app 内 Tab 广场模块
  • module_user:业务组件,用户管理以及系统设置模块
  • module_web:功能组件,提供 H5 功能

快速上手

Mvvm 组件化脚手架

未来版本

  • [ ] 网络框架使用 Retrofit+Kotlin Coroutines 更轻便更简洁
  • [ ] 依赖注入使用谷歌专为 Android 打造的 Dagger Hilt 实现

感谢

License

   Copyright 2021 cdalwyn(陈志龙)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools