代码拉取完成,页面将自动刷新
同步操作将从 Jenly/MVPFrame 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + OkHttp3 + Mosby3 二次封装的MVP快速开发框架,为敏捷开发而生。
<dependency>
<groupId>com.king.frame</groupId>
<artifactId>mvpframe</artifactId>
<version>1.1.3</version>
<type>pom</type>
</dependency>
implementation 'com.king.frame:mvpframe:1.1.3'
<dependency org='com.king.frame' name='mvpframe' rev='1.1.3'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
allprojects {
repositories {
maven { url 'https://dl.bintray.com/jenly/maven' }
}
}
compileOnly 'com.android.support:appcompat-v7:28.0.0'
// Model-View-Intent
api 'com.hannesdorfmann.mosby3:mvi:3.1.1'
// Plain MVP
api 'com.hannesdorfmann.mosby3:mvp:3.1.1'
// MVP + ViewState support
api 'com.hannesdorfmann.mosby3:viewstate:3.1.1'
api 'com.squareup.retrofit2:retrofit:2.6.0'
api 'com.squareup.retrofit2:converter-gson:2.6.0'
api 'com.squareup.retrofit2:adapter-rxjava2:2.6.0'
api 'io.reactivex.rxjava2:rxjava:2.2.9'
api 'io.reactivex.rxjava2:rxandroid:2.1.1'
api 'com.jakewharton.timber:timber:4.7.1'
集成步骤代码示例 (示例出自于app中)
Step.1 启用DataBinding,在你项目中的build.gradle的android{}中添加配置:
dataBinding {
enabled true
}
Step.2 通过ApiManager初始化(在你项目的Application中的onCreate方法里面初始化)
//初始化:第一个参数是基本的Url地址,第二个参数是超时时间(单位为秒,可不填,默认为15s)
ApiManager.init(String baseUrl,int timeout);
Step.3 定义一个类似于app中的Api来管理接口
public class Api {
private ApiService mApiService;
private static Api sInstance;
public static Api getInstance(){
if(sInstance == null){
synchronized (Api.class){
if(sInstance == null){
sInstance = new Api();
}
}
}
return sInstance;
}
private Api(){
mApiService = ApiManager.getInstance().getApiService(ApiService.class);
}
/**
* 获取推荐诗词
* @param callback
*/
public void getRecommendPoetry(SimpleCallback<Result<PoetryInfo>> callback){
ApiObserver.subscribe(mApiService.getRecommendPoetry(),callback);
}
}
更多使用详情,请查看app中的源码使用示例或直接查看API帮助文档
如果您喜欢MVPFrame,或感觉MVPFrame帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢
您也可以扫描下面的二维码,请作者喝杯咖啡
Name: Jenly
Email: jenly1314#gmail.com / jenly1314#vip.qq.com
CSDN: jenly121
Github: jenly1314
加入QQ群: 20867961
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。