Android MVP


/**
* presenter 层,承担业务逻辑处理,数据源处理等
*/
public class MainPresenter extends BasePresenter<MainContract.IMainView> implements MainContract.IMainPresenter {

private MainContract.IMainModel mModel;

@Override
public void attech(IBaseView view) {
super.attech(view);
mModel = new DataModel(http://www.amjmh.com/v/);
}

@Override
public void handlerData() {
getView().showDialog();

mModel.requestBaidu(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}

@Override
public void onResponse(Call call, Response response) throws IOException {
String content = response.body().string();
getView().succes(content);
}
});
}

@Override
public void detech() {
super.detech();
/**
* 释放内存、关闭网络请求、关闭线程等操作
*/
Log.d("==========", "detech: 解除绑定,释放内存");
}
}
--------------------- 

Android MVP

上一篇:Android通用流行框架大全


下一篇:支付宝支付接口-app支付沙箱环境