GithubHelp home page GithubHelp logo

shitou9999 / android-mvp-rxjava2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hudawei996/androidappframework

0.0 2.0 0.0 4.23 MB

Android App基本mvp-rxjava2框架,有效的API+DB+登陆登出完整闭环,mvp+Retrofit2+Rxjava;Base Activity,Presenter ,View,Model 的抽象封装

Java 88.59% CMake 0.36% JavaScript 1.18% HTML 2.04% C 7.76% C++ 0.08%

android-mvp-rxjava2's Introduction

FBI WARMIMNG:api 仅供交流,不要外传 !

请先升级到Android Studio 3 以上版本 !

关于本Demo

一直在纠结在何种开发模式之中,重构希望能把关注点集中到代码结构、整体架构、可测试性、可维护性这四个方面 Rxjava2 + retrofit2 + MVP + Drager2 + xxx,应该是当前Android开发主流的框架 ,我们都会参考Google的官方框架https://github.com/googlesamples/android-architecture 或者 Google 的最新的项目架构组件https://github.com/googlesamples/android-architecture-components

关于Http网络请求 (Rxjava2+Retrofit2)

应该没有比Retrofit2 更好的了吧?不过api 不是restful 就需要再封装一下了,网路模块就是数据命脉,做好了 整个app 的结构会简化很多,结合Rxjava2不是更快哉;配合RxLifeCycle 控制生命周期; BaseObserver 中getErrorMsg(HttpException httpException) 方法中的处理和我们的Api 结构有关,请知悉。可以在Activity,fragment,service,broadcast 等发起http请求。

UI架构模型

Android应用的UI架构模型经历了MVC,MVP 和 MVVM 的演变过程。MVC中View 层(Activity,Fragment/自定义的View) 可能代码会随着业务的复杂变得很大,里面不但要处理界面,还要处理很多业务逻辑里面承载了太多的东西,试试MVP吧, 已经是很流行的UI架构模型了。 使用MVP多关注代码结构、整体架构、可测试性、可维护性这四个方面

关于调试工具

推荐Facebook stetho ,可以网络请求(抓包),不root查看DB 文件和sharepreference,甚至在4.4 以后webview 可以远程调试;提高生产力的利器啊。

关于热修复

阿里的HotFix&微信的Tinker android的热修复原理大体上分为两种,其一是通过dex的执行顺序实现Apk热修复的功能(Tinker),但是其需要将App重启才能生 效;其二是通过Native修改函数指针的方式实现热修复(HotFix)。

显然对于修复紧急BUG这个场景,阿里百川HotFix的更为合适,它更加轻量,可以在不重启的情况下生效,且对性能几乎没有影 微信Tinker、QQ空间超级补丁技术更多地把场景定位在发布小的新功能上,采用ClassLoader的模式,牺牲较高的性能代价去实现 类、资源新增或替换的功能。 阿里百川HotFix对应用本身做到无侵入,无性能损耗。

2017年6月阿里手淘推出了首个非侵入式移动热更新解决方案——Sophix。 在Android热修复的三大领域:代码修复、资源修复、SO修复方面,以及方案的安全性和易用性方面,Sophix都做到了业界领先,可是要收费

Rxjava2

目前只是在http 请求的时候用了Rxjava2+retrofit2,没有侵入UI,打好基础才是王道 读取数据库等IO操作还在主线程,虽然影响不大,还是会卡一下的,坐等GreenDao 支持Rxjava2 这样UI就会更加的流畅起来啊

https://realm.io/cn/news/kau-felipe-lima-adopting-rxjava-airbnb-android/

项目中包含的基本的通用模块

android-mvp-rxjava2's People

Contributors

anylifezlb avatar

Watchers

James Cloos avatar zhangyiyi avatar

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.