Giter Club home page Giter Club logo

mvpframe's Introduction

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”支持一下,您的支持就是我的动力,谢谢 😃

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

关于我

Name: Jenly

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

CSDN: jenly121

Github: jenly1314

加入QQ群: 20867961

mvpframe's People

Contributors

jenly1314 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.