1 Star 0 Fork 2

itjac / MVPFrame

forked from Jenly / MVPFrame 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

MVPFrame

Image

Download JitPack CI CircleCI API License Blog QQGroup

MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + OkHttp3 + Mosby3 二次封装的MVP快速开发框架,为敏捷开发而生。

架构

Image

引入

Maven:

<dependency>
  <groupId>com.king.frame</groupId>
  <artifactId>mvpframe</artifactId>
  <version>1.1.3</version>
  <type>pom</type>
</dependency>

Gradle:

implementation 'com.king.frame:mvpframe:1.1.3'

Lvy:

<dependency org='com.king.frame' name='mvpframe' rev='1.1.3'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>
如果Gradle出现compile失败的情况,可以在Project的build.gradle里面添加如下:(也可以使用上面的GitPack来complie)
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帮助文档

版本记录

v1.1.3:2019-6-21

  • 优化部分细节
  • Retrofit更新至v2.6.0
  • RxJava更新至v2.2.9

v1.1.2:2019-5-27

  • 完善BindingFragment相关子类

v1.1.1:2019-4-29

  • 新增DataBinding支持
  • Retrofit更新至v2.6.0
  • RxJava更新至v2.2.8
  • RxAndroid更新至v2.1.1

v1.1.0:2018-7-23

  • Retrofit更新至v2.4.0
  • RxJava更新至v2.1.16
  • RxAndroid更新至v2.0.2

v1.0.6:2018-5-17

  • 暴露Dialog更多参数,让配置更加灵活

v1.0.5:2018-1-29

  • 新增默认信任SSL证书,支持https

v1.0.4:2018-1-18

  • 优化BaseProgressDialog

v1.0.3:2017-12-4

  • 新增请求相应Log日志信息方便调试。

v1.0.2:2017-9-21

  • 新增QuickActivity、QuickFragment。

v1.0.1:2017-8-18

  • 将retrofit中的adapter修改为adapter-rxjava2 v1.0

v1.0.0:2017-7-5

  • MVPFrame初始版本

赞赏

如果您喜欢MVPFrame,或感觉MVPFrame帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢 :smiley:

您也可以扫描下面的二维码,请作者喝杯咖啡 :coffee:

关于我

Name: Jenly

Email: jenly1314#gmail.com / jenly1314#vip.qq.com

CSDN: jenly121

Github: jenly1314

加入QQ群: 20867961

The MIT License (MIT) Copyright (c) 2017 Jenly Yu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + OkHttp3 + Mosby3 二次封装的MVP架构基类库,为敏捷开发而生。 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/itjac/MVPFrame.git
git@gitee.com:itjac/MVPFrame.git
itjac
MVPFrame
MVPFrame
master

搜索帮助