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:
IPresenter(接口):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); } }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); }