分类页面所有presenter层跟Ipresenter层

presenter层:

 

AddCartPresenter:
public class AddCartPresenter implements AddCartPresenterInter {

    private ActivityAddCartInter activityAddCartInter;
    private AddCartModel addCartModel;

    public AddCartPresenter(ActivityAddCartInter activityAddCartInter) {
        this.activityAddCartInter = activityAddCartInter;

        addCartModel = new AddCartModel(this);
    }

    public void addToCart(String addCart, String uid, int pid) {

        addCartModel.addToCart(addCart,uid,pid);

    }

    @Override
    public void onCartAddSuccess(AddCartBean addCartBean) {
        activityAddCartInter.onCartAddSuccess(addCartBean);
    }
}
DeatailPresenter:
public class DeatailPresenter implements DeatilPresenterInter {

    private DeatilModel deatilModel;
    private DetailActivityInter detailActivityInter;

    public DeatailPresenter(DetailActivityInter detailActivityInter) {
        this.detailActivityInter = detailActivityInter;

        deatilModel = new DeatilModel(this);

    }

    public void getDetailData(String detailUrl, int pid) {

        deatilModel.getDetailData(detailUrl,pid);
    }

    @Override
    public void onSuccess(DeatilBean deatilBean) {
        //回调给view
        detailActivityInter.onSuccess(deatilBean);
    }
}
Fenlei_presenter:
public class Fenlei_presenter implements IFenlei_presenter {

    private IFenlei_view iFenlei_view;
    private Fenlei_model fenlei_model;

    public Fenlei_presenter(IFenlei_view iFenlei_view) {
        this.iFenlei_view=iFenlei_view;
        fenlei_model = new Fenlei_model(this);
    }

    public void getFenleiData(String url) {
        fenlei_model.getFenlei(url);
    }

    @Override
    public void postFenlei(GoodsFenleiBean goodsFenleiBean) {
         iFenlei_view.postFenlei(goodsFenleiBean);

    }
}
FragmentFenLeiRightPresenter:
public class FragmentFenLeiRightPresenter implements IFenleiRight_Presenter {

    private IFenleiRight_view iFenleiRight_view;
    private FragmentFenLeiRightModel fragmentFenLeiRightModel;

    public FragmentFenLeiRightPresenter(IFenleiRight_view iFenleiRight_view) {
        this.iFenleiRight_view=iFenleiRight_view;
        fragmentFenLeiRightModel = new FragmentFenLeiRightModel(this);
    }

    public void getChildData(String url, int cid) {

        fragmentFenLeiRightModel.getFenlei(url,cid);

    }

    @Override
    public void postFenleiRight(FenleiRightBean fenleiRightBean) {
          iFenleiRight_view.postFenleiRight(fenleiRightBean);
    }
}

ProductListPresenter:
public class ProductListPresenter implements ProductListPresenterInter {

    private ProductListModel productListModel;
    private ProductListActivityInter productListActivityInter;

    public ProductListPresenter(ProductListActivityInter productListActivityInter) {
        this.productListActivityInter = productListActivityInter;

        productListModel = new ProductListModel(this);
    }

    public void getProductData(String seartchUrl, String keywords, int page) {

        productListModel.getProductData(seartchUrl,keywords,page);
    }

    @Override
    public void onSuccess(ProductListBean productListBean) {
        productListActivityInter.getProductDataSuccess(productListBean);
    }
}

IPresenter(接口):
AddCartPresenterInter:
public interface AddCartPresenterInter {

    void onCartAddSuccess(AddCartBean addCartBean);

}


DeatilPresenterInter:
public interface DeatilPresenterInter {
    void onSuccess(DeatilBean deatilBean);
}


IFenlei_presenter:
public interface IFenlei_presenter {
    void postFenlei(GoodsFenleiBean goodsFenleiBean);
}

IFenleiRight_Presenter:
 public interface IFenleiRight_Presenter {
    void postFenleiRight(FenleiRightBean fenleiRightBean);
}

ProductListPresenterInter:
public interface ProductListPresenterInter {
    void onSuccess(ProductListBean productListBean);
}











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值