Giter VIP home page Giter VIP logo

mvpframe's Introduction

MVPFrame

Download License Blog

MVPFrame for Android 是一个集合了 Retrofit2 + RXJava2 + Mosby3 二次封装的MVP架构基类库,方便敏捷开发,后续会持续更新并完善。

Gif 展示

Image

引入

Maven:

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

Gradle:

compile 'com.king.frame:mvpframe:1.0.0'

Lvy:

<dependency org='com.king.frame' name='mvpframe' rev='1.0.0'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>
如果Gradle出现compile失败的情况,可以在Project的build.gradle里面添加如下:(也可以使用上面的GitPack来complie)
allprojects {
    repositories {
        maven { url 'https://dl.bintray.com/jenly/maven' }
    }
}

引入的库:

    // Model-View-Intent
    compile 'com.hannesdorfmann.mosby3:mvi:3.0.4'
    // Plain MVP
    compile 'com.hannesdorfmann.mosby3:mvp:3.0.4'
    // MVP + ViewState support
    compile 'com.hannesdorfmann.mosby3:viewstate:3.0.4'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'

    compile 'io.reactivex.rxjava2:rxjava:2.1.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

    compile 'com.orhanobut:logger:1.15'

示例

核心代码(在你项目的Application中的onCreate方法里面初始化)

//初始化:第一个参数是基本的Url地址,第二个参数是超时时间(单位为秒,可不填,默认为20s)
ApiManager.init(String baseUrl,int timeout);

代码示例 (示例出自于app中的Api.java)

public class Api {

    private Api(){
        throw new AssertionError();
    }

    private static ApiService getApiService(){
        return ApiManager.getInstance().getApiService(ApiService.class);
    }

    public static void getApiAddr(String ip, SimpleCallback<IPAddress,IIPAddrView> callback){
        getApiService().getIPAddr(ip)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(ApiObserver.getApiObserver(callback));
    }
}

更多使用详情,请查看app中的源码使用示例

关于我

Name: Jenly

Email: [email protected] / [email protected]

CSDN: http://blog.csdn.net/jenly121

Github: https://github.com/jenly1314

微信公众号:

公众号

加入QQ群: 20867961

mvpframe's People

Contributors

jenly1314 avatar

Watchers

James Cloos avatar 燕子 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.