Android中RxJava+Retrofit2.0+MVP模式的整合

标签: mvp
18875人阅读 评论(25) 收藏 举报
分类:

转载请标明出处:http://blog.csdn.net/u010046908/article/details/50781360 本文出自:【李东的博客】

MVP的工作原理

这里写图片描述

以上是MVP的工作原理图。其中大家注意的Presenter操作View和Mode都是通过接口来实现直接的调用。

MVP的工作流程

  • Presenter负责逻辑的处理,
  • Model提供数据,
  • View负责显示。
    作为一种新的模式,在MVP中View并不直接使用Model,它们之间的通信是通过Presenter来进行的,所有的交互都发生在Presenter内部,而在MVC中View会从直接Model中读取数据而不是通过 Controller。
      

RxJava和Retrofit2.0使用

这二者的使用我就不罗嗦了,github中后好多demo,大家自己看。

MVP、RxJava和Reterofit2.0三者的整合现在开始讲解

首先说一下本项目的结构

这里写图片描述

  • api包主要存放网络请求接口
  • bean包中存放实体类
  • model包中存放处理数据
  • pesenter包中存放主导器
  • view包中存放界面处理

view的代码:

/**
*WeatherView 用于处理界面显示
*/
public interface WeatherView {

    void showProgress();
    void hideProgress();
    void loadWeather(WeatherData weatherData);
}

package com.lidong.demo.android_rapid_development_of_library.mvp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

import com.lidong.android_ibrary.LoadingUIHelper;
import com.lidong.demo.android_rapid_development_of_library.R;
import com.lidong.demo.android_rapid_development_of_library.mvp.bean.WeatherData;
import com.lidong.demo.android_rapid_development_of_library.mvp.presenter.WeatherPresenter;
import com.lidong.demo.android_rapid_development_of_library.mvp.presenter.WeatherPresenterImp;
import com.lidong.demo.android_rapid_development_of_library.mvp.view.WeatherView;

import butterknife.Bind;
import butterknife.ButterKnife;
/**
*展示天气详情
*/
public class WeatherActivity extends AppCompatActivity implements WeatherView {

    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.textView1)
    TextView textView1;
    @Bind(R.id.textView2)
    TextView textView2;
    @Bind(R.id.textView3)
    TextView textView3;
    @Bind(R.id.textView4)
    TextView textView4;
    @Bind(R.id.textView5)
    TextView textView5;
    @Bind(R.id.textView6)
    TextView textView6;
    @Bind(R.id.textView7)
    TextView textView7;
    @Bind(R.id.textView8)
    TextView textView8;
    @Bind(R.id.textView9)
    TextView textView9;
    private WeatherPresenter mWeatherPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_weather);
        ButterKnife.bind(this);
        setSupportActionBar(toolbar);
        mWeatherPresenter = new WeatherPresenterImp(this);
        mWeatherPresenter.getWeatherData("2", "苏州");
    }

    @Override
    public void showProgress() {
        LoadingUIHelper.showDialogForLoading(this,"获取数据",false);
    }

    @Override
    public void hideProgress() {
        LoadingUIHelper.hideDialogForLoading();
        Toast.makeText(this,"服务器异常",Toast.LENGTH_SHORT).show();
         mWeatherPresenter.onUnsubscribe();
    }

    @Override
    public void loadWeather(WeatherData weatherData) {
        Log.d("weatherData", "weatherData==" + weatherData.toString());
        textView1.setText("城市:"+weatherData.getResult().getToday().getCity());
        textView2.setText("日期:"+weatherData.getResult().getToday().getWeek());
        textView3.setText("今日温度:"+weatherData.getResult().getToday().getTemperature());
        textView4.setText("天气标识:" +WeatherIDUtils.transfer(weatherData.getResult().getToday().getWeather_id().getFa()));
        textView5.setText("穿衣指数:" + weatherData.getResult().getToday().getDressing_advice());
        textView6.setText("干燥指数:"+weatherData.getResult().getToday().getDressing_index());
        textView7.setText("紫外线强度:"+weatherData.getResult().getToday().getUv_index());
        textView8.setText("穿衣建议:"+weatherData.getResult().getToday().getDressing_advice());
        textView9.setText("旅游指数:"+weatherData.getResult().getToday().getTravel_index());
    }
}

 @Override
 protected void onDestroy() {
     super.onDestroy();
     //取消注册
     mWeatherPresenter.onUnsubscribe();
 }

model层中的代码

/**
 *
 * Created by lidong on 2016/3/2.
 */
public interface WeatherModel {
    /**
     * 获取天气信息
     * @param format
     * @param city
     */
    Subscription getWeatherData(String format, String city);


}

/**
 * Created by lidong on 2016/3/2.
 */
public class WeatherModelImp  implements WeatherModel {

    private WeatherOnListener mWeatherOnListener;


    public WeatherModelImp(WeatherOnListener mWeatherOnListener) {
        this.mWeatherOnListener = mWeatherOnListener;
    }

    @Override
    public void getWeatherData(String format,String city) {
@Override
    public Subscription getWeatherData(String format,String city) {

        Observable<WeatherData> request = com.lidong.demo.mvp_dagger2.api.ApiManager.getWeatherData(format, city).cache();

        Subscription sub = request.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<WeatherData>() {
                    @Override
                    public void call(WeatherData weatherData) {
                        mWeatherOnListener.onSuccess(weatherData);
                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {
                        mWeatherOnListener.onFailure(throwable);
                    }
                });
        return  sub;
    }
    /**
    *回调接口
    */
    public interface WeatherOnListener{
        void onSuccess(WeatherData s);
        void onFailure(Throwable e);
    }
}

presenter层中的代码:

/**
 * Created by lidong on 16/9/10.
 */
public class BasePresenter {


    protected CompositeSubscription mCompositeSubscription;

    //RXjava取消注册,以避免内存泄露
    public void onUnsubscribe() {
        if (mCompositeSubscription != null && mCompositeSubscription.hasSubscriptions()) {
            mCompositeSubscription.unsubscribe();
        }
    }

    //RXjava注册
    public void addSubscription(Subscription subscriber) {
        if (mCompositeSubscription == null) {
            mCompositeSubscription = new CompositeSubscription();
        }
        mCompositeSubscription.add(subscriber);
    }
}




/**
 * Created by lidong on 2016/3/2.
 */
public abstract class WeatherPresenter extends BasePresenter{
  /**
     * 获取天气信息
     * @param format
     * @param city
     */
  public abstract void getWeatherData(String format, String city);
}

package com.lidong.demo.mvp.presenter;

import android.util.Log;

import com.lidong.demo.mvp.bean.WeatherData;
import com.lidong.demo.mvp.model.WeatherModel;
import com.lidong.demo.mvp.model.WeatherModelImp;
import com.lidong.demo.mvp.view.WeatherView;

/**
 * Created by lidong on 2016/3/2.
 */
public class WeatherPresenterImp  extends WeatherPresenter  implements WeatherModelImp.WeatherOnListener{

    /**
     * WeatherModel和WeatherView都是通过接口来实现,这就Java设计原则中依赖倒置原则使用
     */
   private WeatherModel mWeatherModel;
   private WeatherView mWeatherView;

    public WeatherPresenterImp( WeatherView mWeatherView) {
        this.mWeatherModel = new WeatherModelImp(this);
        this.mWeatherView = mWeatherView;
    }

    @Override
    public void getWeatherData(String format, String city) {
        mWeatherView.showProgress();
        addSubscription(mWeatherModel.getWeatherData(format,city));
    }

    @Override
    public void onSuccess(WeatherData s) {
        mWeatherView.loadWeather(s);
        mWeatherView.hideProgress();
        Log.d("-------", "onSuccess() called with: " + "s = [" + s.toString() + "]");
    }

    @Override
    public void onFailure(Throwable e) {
        mWeatherView.hideProgress();
        Log.d("-------", "onFailure" + e.getMessage());
    }
}

api层的代码

package com.lidong.demo.android_rapid_development_of_library.mvp.api;

import com.lidong.demo.android_rapid_development_of_library.mvp.bean.WeatherData;

import retrofit.GsonConverterFactory;
import retrofit.Retrofit;
import retrofit.RxJavaCallAdapterFactory;
import rx.Observable;

/**
 * Created by lidong on 2016/3/2.
 */
public class ApiManager {

    private static final String ENDPOINT = "http://v.juhe.cn";

    private static final Retrofit sRetrofit = new Retrofit .Builder()
            .baseUrl(ENDPOINT)
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) // 使用RxJava作为回调适配器
            .build();

    private static final ApiManagerService apiManager = sRetrofit.create(ApiManagerService.class);

    /**
     * 获取天气数据
     * @param city
     * @return
     */
    public static Observable<WeatherData> getWeatherData(String format, String city) {
        return apiManager.getWeatherData(format,city,"ad1d20bebafe0668502c8eea5ddd0333");
    }


}

package com.lidong.demo.android_rapid_development_of_library.mvp.api;

import com.lidong.demo.android_rapid_development_of_library.mvp.bean.WeatherData;

import retrofit.http.GET;
import retrofit.http.Query;
import rx.Observable;

/**
 * @className:ApiManagerService
 * Created by lidong on 2016/3/2.
 */
public interface ApiManagerService {
//http://v.juhe.cn/weather/index?format=2&cityname=%E8%8B%8F%E5%B7%9E&key=ad1d20bebafe0668502c8eea5ddd0333
    /**
     * 获取数据
     * @param cityname
     * @param key
     * @return
     */
    @GET("/weather/index")
    Observable<WeatherData> getWeatherData(@Query("format") String format,@Query("cityname") String cityname,@Query("key") String key);

}

bean层的代码

package com.lidong.demo.android_rapid_development_of_library.mvp.bean;

import java.util.List;

/**
 * Created by Administrator on 2015/12/21.
 */
public class WeatherData {

    /**
     * resultcode : 200
     * reason : successed!
     * result : {"sk":{"temp":"18","wind_direction":"东南风","wind_strength":"2级","humidity":"41%","time":"14:32"},"today":{"temperature":"8℃~17℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期三","city":"苏州","date_y":"2016年03月02日","dressing_index":"较冷","dressing_advice":"建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。","uv_index":"弱","comfort_index":"","wash_index":"较适宜","travel_index":"较适宜","exercise_index":"较适宜","drying_index":""},"future":[{"temperature":"8℃~17℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期三","date":"20160302"},{"temperature":"11℃~21℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期四","date":"20160303"},{"temperature":"12℃~19℃","weather":"多云转阴","weather_id":{"fa":"01","fb":"02"},"wind":"东南风3-4 级","week":"星期五","date":"20160304"},{"temperature":"10℃~19℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东北风3-4 级","week":"星期六","date":"20160305"},{"temperature":"11℃~20℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期日","date":"20160306"},{"temperature":"10℃~19℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东北风3-4 级","week":"星期一","date":"20160307"},{"temperature":"12℃~19℃","weather":"多云转阴","weather_id":{"fa":"01","fb":"02"},"wind":"东南风3-4 级","week":"星期二","date":"20160308"}]}
     * error_code : 0
     */

    private String resultcode;
    private String reason;
    /**
     * sk : {"temp":"18","wind_direction":"东南风","wind_strength":"2级","humidity":"41%","time":"14:32"}
     * today : {"temperature":"8℃~17℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期三","city":"苏州","date_y":"2016年03月02日","dressing_index":"较冷","dressing_advice":"建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。","uv_index":"弱","comfort_index":"","wash_index":"较适宜","travel_index":"较适宜","exercise_index":"较适宜","drying_index":""}
     * future : [{"temperature":"8℃~17℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期三","date":"20160302"},{"temperature":"11℃~21℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期四","date":"20160303"},{"temperature":"12℃~19℃","weather":"多云转阴","weather_id":{"fa":"01","fb":"02"},"wind":"东南风3-4 级","week":"星期五","date":"20160304"},{"temperature":"10℃~19℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东北风3-4 级","week":"星期六","date":"20160305"},{"temperature":"11℃~20℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东南风3-4 级","week":"星期日","date":"20160306"},{"temperature":"10℃~19℃","weather":"多云","weather_id":{"fa":"01","fb":"01"},"wind":"东北风3-4 级","week":"星期一","date":"20160307"},{"temperature":"12℃~19℃","weather":"多云转阴","weather_id":{"fa":"01","fb":"02"},"wind":"东南风3-4 级","week":"星期二","date":"20160308"}]
     */

    private ResultEntity result;
    private int error_code;

    public void setResultcode(String resultcode) {
        this.resultcode = resultcode;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public void setResult(ResultEntity result) {
        this.result = result;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getResultcode() {
        return resultcode;
    }

    public String getReason() {
        return reason;
    }

    public ResultEntity getResult() {
        return result;
    }

    public int getError_code() {
        return error_code;
    }

    public static class ResultEntity {
        /**
         * temp : 18
         * wind_direction : 东南风
         * wind_strength : 2级
         * humidity : 41%
         * time : 14:32
         */

        private SkEntity sk;
        /**
         * temperature : 8℃~17℃
         * weather : 多云
         * weather_id : {"fa":"01","fb":"01"}
         * wind : 东南风3-4 级
         * week : 星期三
         * city : 苏州
         * date_y : 2016年03月02日
         * dressing_index : 较冷
         * dressing_advice : 建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。
         * uv_index : 弱
         * comfort_index :
         * wash_index : 较适宜
         * travel_index : 较适宜
         * exercise_index : 较适宜
         * drying_index :
         */

        private TodayEntity today;
        /**
         * temperature : 8℃~17℃
         * weather : 多云
         * weather_id : {"fa":"01","fb":"01"}
         * wind : 东南风3-4 级
         * week : 星期三
         * date : 20160302
         */

        private List<FutureEntity> future;

        public void setSk(SkEntity sk) {
            this.sk = sk;
        }

        public void setToday(TodayEntity today) {
            this.today = today;
        }

        public void setFuture(List<FutureEntity> future) {
            this.future = future;
        }

        public SkEntity getSk() {
            return sk;
        }

        public TodayEntity getToday() {
            return today;
        }

        public List<FutureEntity> getFuture() {
            return future;
        }

        public static class SkEntity {
            private String temp;
            private String wind_direction;
            private String wind_strength;
            private String humidity;
            private String time;

            public void setTemp(String temp) {
                this.temp = temp;
            }

            public void setWind_direction(String wind_direction) {
                this.wind_direction = wind_direction;
            }

            public void setWind_strength(String wind_strength) {
                this.wind_strength = wind_strength;
            }

            public void setHumidity(String humidity) {
                this.humidity = humidity;
            }

            public void setTime(String time) {
                this.time = time;
            }

            public String getTemp() {
                return temp;
            }

            public String getWind_direction() {
                return wind_direction;
            }

            public String getWind_strength() {
                return wind_strength;
            }

            public String getHumidity() {
                return humidity;
            }

            public String getTime() {
                return time;
            }

            @Override
            public String toString() {
                return "SkEntity{" +
                        "temp='" + temp + '\'' +
                        ", wind_direction='" + wind_direction + '\'' +
                        ", wind_strength='" + wind_strength + '\'' +
                        ", humidity='" + humidity + '\'' +
                        ", time='" + time + '\'' +
                        '}';
            }
        }

        public static class TodayEntity {

            @Override
            public String toString() {
                return "TodayEntity{" +
                        "temperature='" + temperature + '\'' +
                        ", weather='" + weather + '\'' +
                        ", weather_id=" + weather_id +
                        ", wind='" + wind + '\'' +
                        ", week='" + week + '\'' +
                        ", city='" + city + '\'' +
                        ", date_y='" + date_y + '\'' +
                        ", dressing_index='" + dressing_index + '\'' +
                        ", dressing_advice='" + dressing_advice + '\'' +
                        ", uv_index='" + uv_index + '\'' +
                        ", comfort_index='" + comfort_index + '\'' +
                        ", wash_index='" + wash_index + '\'' +
                        ", travel_index='" + travel_index + '\'' +
                        ", exercise_index='" + exercise_index + '\'' +
                        ", drying_index='" + drying_index + '\'' +
                        '}';
            }

            private String temperature;
            private String weather;
            /**
             * fa : 01
             * fb : 01
             */

            private WeatherIdEntity weather_id;
            private String wind;
            private String week;
            private String city;
            private String date_y;
            private String dressing_index;
            private String dressing_advice;
            private String uv_index;
            private String comfort_index;
            private String wash_index;
            private String travel_index;
            private String exercise_index;
            private String drying_index;

            public void setTemperature(String temperature) {
                this.temperature = temperature;
            }

            public void setWeather(String weather) {
                this.weather = weather;
            }

            public void setWeather_id(WeatherIdEntity weather_id) {
                this.weather_id = weather_id;
            }

            public void setWind(String wind) {
                this.wind = wind;
            }

            public void setWeek(String week) {
                this.week = week;
            }

            public void setCity(String city) {
                this.city = city;
            }

            public void setDate_y(String date_y) {
                this.date_y = date_y;
            }

            public void setDressing_index(String dressing_index) {
                this.dressing_index = dressing_index;
            }

            public void setDressing_advice(String dressing_advice) {
                this.dressing_advice = dressing_advice;
            }

            public void setUv_index(String uv_index) {
                this.uv_index = uv_index;
            }

            public void setComfort_index(String comfort_index) {
                this.comfort_index = comfort_index;
            }

            public void setWash_index(String wash_index) {
                this.wash_index = wash_index;
            }

            public void setTravel_index(String travel_index) {
                this.travel_index = travel_index;
            }

            public void setExercise_index(String exercise_index) {
                this.exercise_index = exercise_index;
            }

            public void setDrying_index(String drying_index) {
                this.drying_index = drying_index;
            }

            public String getTemperature() {
                return temperature;
            }

            public String getWeather() {
                return weather;
            }

            public WeatherIdEntity getWeather_id() {
                return weather_id;
            }

            public String getWind() {
                return wind;
            }

            public String getWeek() {
                return week;
            }

            public String getCity() {
                return city;
            }

            public String getDate_y() {
                return date_y;
            }

            public String getDressing_index() {
                return dressing_index;
            }

            public String getDressing_advice() {
                return dressing_advice;
            }

            public String getUv_index() {
                return uv_index;
            }

            public String getComfort_index() {
                return comfort_index;
            }

            public String getWash_index() {
                return wash_index;
            }

            public String getTravel_index() {
                return travel_index;
            }

            public String getExercise_index() {
                return exercise_index;
            }

            public String getDrying_index() {
                return drying_index;
            }

            public static class WeatherIdEntity {
                private String fa;
                private String fb;

                public void setFa(String fa) {
                    this.fa = fa;
                }

                public void setFb(String fb) {
                    this.fb = fb;
                }

                public String getFa() {
                    return fa;
                }

                public String getFb() {
                    return fb;
                }
            }
        }

        public static class FutureEntity {
            private String temperature;
            private String weather;
            /**
             * fa : 01
             * fb : 01
             */

            private WeatherIdEntity weather_id;
            private String wind;
            private String week;
            private String date;

            public void setTemperature(String temperature) {
                this.temperature = temperature;
            }

            public void setWeather(String weather) {
                this.weather = weather;
            }

            public void setWeather_id(WeatherIdEntity weather_id) {
                this.weather_id = weather_id;
            }

            public void setWind(String wind) {
                this.wind = wind;
            }

            public void setWeek(String week) {
                this.week = week;
            }

            public void setDate(String date) {
                this.date = date;
            }

            public String getTemperature() {
                return temperature;
            }

            public String getWeather() {
                return weather;
            }

            public WeatherIdEntity getWeather_id() {
                return weather_id;
            }

            public String getWind() {
                return wind;
            }

            public String getWeek() {
                return week;
            }

            public String getDate() {
                return date;
            }


            public static class WeatherIdEntity {
                private String fa;
                private String fb;

                public void setFa(String fa) {
                    this.fa = fa;
                }

                public void setFb(String fb) {
                    this.fb = fb;
                }

                public String getFa() {
                    return fa;
                }

                public String getFb() {
                    return fb;
                }

                @Override
                public String toString() {
                    return "WeatherIdEntity{" +
                            "fa='" + fa + '\'' +
                            ", fb='" + fb + '\'' +
                            '}';
                }
            }

            @Override
            public String toString() {
                return "FutureEntity{" +
                        "temperature='" + temperature + '\'' +
                        ", weather='" + weather + '\'' +
                        ", weather_id=" + weather_id +
                        ", wind='" + wind + '\'' +
                        ", week='" + week + '\'' +
                        ", date='" + date + '\'' +
                        '}';
            }
        }

        @Override
        public String toString() {
            return "ResultEntity{" +
                    "sk=" + sk +
                    ", today=" + today +
                    ", future=" + future +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "WeatherData{" +
                "resultcode='" + resultcode + '\'' +
                ", reason='" + reason + '\'' +
                ", result=" + result +
                ", error_code=" + error_code +
                '}';
    }
}

总结

最后总结一下,通过使用mvp对代码进行分层之后,模块化更加的清楚,假如要换网络框架,需要修改model层和api层的代码,其他的层的代码都不需要再动,这样各层之间保持单一职责。代码的易读性变得更强了。

代码的下载地址

代码的运行效果:

这里写图片描述

欢迎大家查看。如果有问题直接回复。

查看评论

Retrofit+RxJava+MVP学习笔记

一、Retrofit: 1、对于统一请求参数的封装(封装到请求头中) public class BaseIntercepter implements Interceptor { @Ove...
  • www851903307
  • www851903307
  • 2016-06-26 15:15:13
  • 2344

【android进阶篇】MVP+Retrofit+RxJava框架结合

【android进阶篇】【android进阶篇】MVP+Retrofit+RxJava框架结合 另一篇MVP优化,[android进阶篇]MVP模式优化,防止内存泄漏和空指针问题 一、前言MVP模...
  • qq137722697
  • qq137722697
  • 2016-08-15 17:22:04
  • 15769

从0开始搭建rxjava+retrofit+mvp+dagger2整合基础框架(rxjava+retrofit网络层搭建)

古语有云,没有规矩,就不成方圆。其实做什么事都一样,做什么事都要有自己熟悉且大家都认同的一套规矩,这样既能提高自己的做事效率,也方便他人的理解。在移动开发中,mvp是新兴的一种软件开发模式,是经过时间...
  • chenbaige
  • chenbaige
  • 2016-12-20 12:00:16
  • 2381

RxJava+Retrofit+MVP 封装带有加载框的Http请求

最近在学习RxJava以及Retrofit,根据所学封装了一个带ProgressBarT弹窗网络请求的demo。并且对过程进行封装,只返回结果。 主要框架:MVP+RxJava...
  • jhl122
  • jhl122
  • 2017-03-13 16:28:24
  • 1401

Rxjava+Retrofit+okhttp+mvp实现的开源小项目

  • 2017年02月14日 11:17
  • 49.1MB
  • 下载

Android轻松搭建MVP + Retrofit + RxJava(MR篇)

上周给大家分享带来了一篇很实用的UI实战的文章(Android实现列表抽屉展示效果),接下来我想用一周的时间用大概两篇文章的内容和大家分享关于MVP + Retrofit + RxJava架构模型(思...
  • u013718120
  • u013718120
  • 2016-11-14 17:32:58
  • 1912

Rxjava+Retrofit+okhttp+mvp实现

最近在学习的网络框架搭建,在网上看了不少的博客,有着各种各样的封装思路,看的实在是激情四射,乘热打铁,赶紧把学到的知识记录下,下面正式开始 关于rxjava,retrofit,okhttp,...
  • z4909801
  • z4909801
  • 2017-02-28 09:35:28
  • 2228

Android开源项目 MVP+MD+Retrofit+RxJava 看了你会上瘾的

Android开源项目 MVP+MD+Retrofit+RxJava 看了你会上瘾的前言:去年这个时候独立开发上架了一款APP(应用宝:叙恋),用到的技术都是比较老旧。今年趁着回学校写论文的时间,会陆...
  • sinat_27033869
  • sinat_27033869
  • 2017-03-27 15:39:58
  • 3544

[android架构篇]mvp+rxjava+retrofit+eventBus

android架构篇mvp+rxjava+retrofit+eventBus高层不应该知道低层的细节,应该是面向抽象的编程。业务的实现交给实现的接口的类。高层只负责调用。首先,要介绍一下一个项目中好架...
  • ccj659
  • ccj659
  • 2016-07-12 15:49:39
  • 4844

手把手带你走进MVP +Dagger2 + DataBinding+ Rxjava+Retrofit 的世界

0.0 Android开发现在的变化用一个词来形容就是 :翻天覆地 越来越多的项目使用了MVP + Rxjava+Retrofit +Dagger2 + DataBinding等等东西。。 但是这...
  • wingichoy
  • wingichoy
  • 2016-07-21 14:35:00
  • 10194
    个人资料
    专栏达人 持之以恒
    等级:
    访问量: 53万+
    积分: 4846
    排名: 7373
    博客专栏
    最新评论