1.mvp包分类:
Contact:(1)view接口(2)presenter接口 ----作为接口统筹调用,以供v层和p层的互相调用。也方便开发者理清逻辑
Activity:继承view接口持有presenter 的接口--持有接口不持有presenter实例,以保证层与层调用皆以接口调用。
----对应v层
presernter:继承presenter接口--网络或数据库耗时操作时使用rxjava2.0启动异步
----对应P层
model: (1)DBhelper--Realm(2)API--retrofit2.0
数据库耗时操作和网络请求都在p层调用。
----对应M层
2.具体代码:
扫描二维码关注公众号,回复:
2907012 查看本文章