MVC:
model 网络io文件io业务模型
controller和view 都是activity
缺点: 业务复杂时activity庞大臃肿
MVP:
activity代表view,不处理业务逻辑
presenter 中间纽带,处理业务逻辑,避免model直接操作view
特点:通过交互接口,交互都发生在presenter。
优点:将业务逻辑从activity分离。降低activity臃肿。方便单元测试。
缺点:业务复杂可能导致presenter臃肿大量接口。业务改动接口也需要改动。
okhttp流程:
EventBus:
register获取当前类,类作为key,订阅方法合并为list作为values,存储为map
post消息时,根据key获取list,循环加入队列,队列获取每项反射调用方法
unregister,移除map内的相关信息
Dagger2:
控制反转IOC/依赖注入DI框架。框架调控对象赋值
作用:管理类实例、解耦
比较知名的依赖注入框架有Spring
Retrofit2:
通过动态代理生成接口的实体对象,通过注解获取请求的信息
返回的response通过converterFactorty转换成相应的数据model,通过calladapter转换成其他数据类型
NestedScrolling机制:
NestedScrollingChild_startNestedScroll、stopNestedScroll、dispatchNestedScroll
NestedScrollingParent_onStartNestedScroll、onStopNestedScroll、onNestedScroll、onNestedFling
NestedScrollingParentHelper、NestedScrollingChildHelper
事件分发机制:
app启动流程:
启动activity window流程
AMS启动过程