GithubHelp home page GithubHelp logo

cdalwyn / playandroid Goto Github PK

View Code? Open in Web Editor NEW
279.0 2.0 71.0 59.48 MB

:v::fist::wave:玩安卓Mvvm组件化客户端,整合Jetpack组件DataBinding、ViewModel以及LiveData;屏幕适配:heavy_check_mark:状态栏沉浸式:heavy_check_mark:黑夜模式:heavy_check_mark:,无数据、加载失败状态页;骨架屏、Koin依赖注入等

Home Page: https://github.com/cdalwyn/PlayAndroid

License: Apache License 2.0

Kotlin 84.57% Java 15.43%
kotlin mvvm components rxjava2 retrofit glide material-design gson mmkv arouter viewmodel databinding livedata loadsir fragmentation mvvmhabit koin litepal shadowlayout

playandroid's Introduction

Platform GitHub license

✌️✊👋MvvmComponents

项目截图

下载体验请移步: 玩安卓

项目介绍

  • 基于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.

playandroid's People

Contributors

cdalwyn 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

playandroid's Issues

java.lang.NoSuchMethodError

编译通过后,打不开App。gradle:6.7.1 plugin:4.2.1 kotlin:1.5.0
java.lang.NoSuchMethodError: No virtual method elapsedNow-UwyO8pc()D in class Lkotlin/time/TimeMark; or its super classes (declaration of 'kotlin.time.TimeMark' appears in /data/app/com.czl.mvvmcomponents-JvvsC4hfbFCYGv0U6loT6g==/base.apk!classes28.dex) at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:63) at org.koin.core.KoinApplication.modules(KoinApplication.kt:63) at com.czl.lib_base.base.MyApplication$onCreate$1.invoke(MyApplication.kt:70) at com.czl.lib_base.base.MyApplication$onCreate$1.invoke(MyApplication.kt:67) at org.koin.core.context.GlobalContext.startKoin$koin_core(GlobalContext.kt:68) at org.koin.core.context.GlobalContextExtKt.startKoin(GlobalContextExt.kt:32) at org.koin.core.context.GlobalContextExtKt.startKoin$default(GlobalContextExt.kt:31) at com.czl.lib_base.base.MyApplication.onCreate(MyApplication.kt:67) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5817) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6602) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:453) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:821)

BR如何让AS编译通过

e: E:\ASproject\mvvmcomponent-master\lib_base\src\main\java\com\czl\lib_base\data\bean\HttpBean.kt: (9, 25): Unresolved reference: BR
没个模块会这样提示,我直接打开您的项目,是我做错了什么吗,判恢复,tk

bingding问题

请问为什么我编译器总是提示
Cannot access 'androidx.databinding.Observable' which is a supertype of 'com.czl.module_login.databinding.LoginActivitySplashBinding'. Check your module classpath for missing or conflicting dependencies
导致binding.ivSplash 像这样获取控制总是报错,但是又可以编译通过,github不清楚怎么发送图片

DataRepository 采用委托机制会不会更方便一些

class DataRepository constructor(
private val mLocalDataSource: LocalDataSource,
private val mHttpDataSource: HttpDataSource
) : BaseModel(), LocalDataSource, HttpDataSource {

改成

class DataRepository constructor(
private val mLocalDataSource: LocalDataSource,
private val mHttpDataSource: HttpDataSource
) : BaseModel(), LocalDataSource by mLocalDataSource, HttpDataSource by mHttpDataSource {

这样就不用频繁的去重写方法了

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.