use of com.mnnyang.gzuclassschedule.data.beanv2.BaseBean in project GzuClassSchedule by mnnyang.
the class SignPresenter method signIn.
@Override
public void signIn(String email, String password) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
if (isOkOfVerifyInput(email, password)) {
return;
}
mView.showLoading("登录中");
email = email.trim();
password = password.trim();
new MyHttpUtils().login(email, password, new HttpCallback<BaseBean>() {
@Override
public void onSuccess(BaseBean baseBean) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
mView.stopLoading();
if (baseBean != null) {
if (baseBean.getCode() == 1) {
mView.signInSucceed(baseBean);
} else {
mView.signInFailed(baseBean.getMsg());
}
} else {
mView.showMassage("返回的数据有误!");
}
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
mView.stopLoading();
mView.showMassage(errMsg);
}
});
}
use of com.mnnyang.gzuclassschedule.data.beanv2.BaseBean in project GzuClassSchedule by mnnyang.
the class HomePresenter method uploadCourse.
/**
* 上传
*/
@Override
public void uploadCourse() {
if (TextUtils.isEmpty(Cache.instance().getEmail())) {
mView.pleaseLoginIn();
return;
}
mView.showLoading("同步中");
JSONObject result = buildJsonOfAllCourse();
MyHttpUtils utils = new MyHttpUtils();
utils.uploadCourse(result.toString(), new HttpCallback<BaseBean>() {
@Override
public void onSuccess(BaseBean baseBean) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
if (baseBean != null) {
if (baseBean.getCode() == 1) {
mView.showMassage("同步成功");
} else {
mView.showMassage("同步失败:" + baseBean.getMsg());
}
} else {
mView.showMassage("同步失败");
}
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
mView.showMassage(errMsg);
}
});
}
use of com.mnnyang.gzuclassschedule.data.beanv2.BaseBean in project GzuClassSchedule by mnnyang.
the class SignPresenter method signUp.
@Override
public void signUp(String email, String password) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
if (isOkOfVerifyInput(email, password)) {
return;
}
mView.showLoading("注册中");
email = email.trim();
password = password.trim();
new MyHttpUtils().register(email, password, new HttpCallback<BaseBean>() {
@Override
public void onSuccess(BaseBean baseBean) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
mView.stopLoading();
if (baseBean != null) {
if (baseBean.getCode() == 1) {
mView.signUpSucceed(baseBean);
} else {
mView.signUpFailed(baseBean.getMsg());
}
}
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
mView.stopLoading();
mView.signUpFailed(errMsg);
}
});
}
Aggregations