分类购物车presenter

package dongyushan.bwie.com.lianxi.presenter;

import dongyushan.bwie.com.lianxi.view.IBaseView;

public class BasePresenter<V extends IBaseView> {
    private V iv;

    public void attachView(V iv) {
        this.iv = iv;
    }

    public void dettachView() {
        this.iv = null;
    }

    public V getView() {
        return iv;
    }
}

 

 


package dongyushan.bwie.com.lianxi.presenter;

import dongyushan.bwie.com.lianxi.bean.HomeBean;
import dongyushan.bwie.com.lianxi.model.HttpUtils;
import dongyushan.bwie.com.lianxi.view.IBaseView;
import dongyushan.bwie.com.lianxi.view.IFenView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class FenPresenter extends BasePresenter<IFenView>{

    public void loadData() {
        Observable<HomeBean> shouye = HttpUtils.getHttpUtilsInstance().apiClient.shouye();
        shouye.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<HomeBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(HomeBean homeBean) {

                        getView().onSuccess(homeBean);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}

 

 

 

 

package dongyushan.bwie.com.lianxi.presenter;

import dongyushan.bwie.com.lianxi.bean.FenBean;
import dongyushan.bwie.com.lianxi.model.HttpUtils;
import dongyushan.bwie.com.lianxi.view.IFenView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class YouPresenter extends BasePresenter<IFenView>{
    public void loadDataRight(String cids) {
        Observable<FenBean> fenlei = HttpUtils.getHttpUtilsInstance().apiClient.fenlei(cids);
        fenlei.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<FenBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(FenBean fenBean) {

                        getView().right(fenBean);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }

}

 

 

 

 

 

 

package dongyushan.bwie.com.lianxi.presenter;

import android.util.Log;

import java.util.List;

import dongyushan.bwie.com.lianxi.bean.HomeBean;
import dongyushan.bwie.com.lianxi.bean.SouBean;
import dongyushan.bwie.com.lianxi.model.HttpUtils;
import dongyushan.bwie.com.lianxi.view.ISouView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class SouPresenter extends BasePresenter <ISouView>{
    public void souLoadData(String name,int page) {
        Observable<SouBean> sousuo = HttpUtils.getHttpUtilsInstance().apiClient.sousuo(name,page);
        sousuo.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<SouBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(SouBean souBean) {

                        List<SouBean.DataBean> data = souBean.getData();
                        Log.i("ccc",souBean.getData().get(0).getTitle());
                        getView().onSuccess(data);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
}

 

 

 

 

package dongyushan.bwie.com.lianxi.presenter;

import android.util.Log;

import java.util.List;

import dongyushan.bwie.com.lianxi.bean.SouBean;
import dongyushan.bwie.com.lianxi.bean.XiangQingBean;
import dongyushan.bwie.com.lianxi.model.HttpUtils;
import dongyushan.bwie.com.lianxi.view.IXiangQingView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class XiangQingPresenter extends BasePresenter<IXiangQingView> {
    public void souLoadData(int pid) {
        final Observable<XiangQingBean> xiangqing = HttpUtils.getHttpUtilsInstance().apiClient.xiangqing(pid);
        xiangqing.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<XiangQingBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(XiangQingBean xiangQingBean) {
                        String title = xiangQingBean.getData().getTitle();
                        Log.i("aaa",title);
                        getView().onSuccess(xiangQingBean);

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}

 

 

 

 

package dongyushan.bwie.com.lianxi.presenter;

import android.util.Log;

import dongyushan.bwie.com.lianxi.bean.CarBean;
import dongyushan.bwie.com.lianxi.model.HttpUtils;
import dongyushan.bwie.com.lianxi.view.IGouView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class CarsPresenter extends BasePresenter<IGouView> {
    public void GouloadDataFromNet(int uid) {
        Log.i("aaa",uid+"");
        Observable<CarBean> gouwuche = HttpUtils.getHttpUtilsInstance().apiClient.gouwuche(75);
        gouwuche.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<CarBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(CarBean carBean) {
                        Log.i("aaa","tianwangshishagou");
                        getView().onsuccer(carBean);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值