use of com.mnnyang.gzuclassschedule.utils.event.CourseDataChangeEvent in project GzuClassSchedule by mnnyang.
the class HomePresenter method downCourse.
/**
* 下载course
*/
@Override
public void downCourse() {
if (TextUtils.isEmpty(Cache.instance().getEmail())) {
mView.pleaseLoginIn();
return;
}
mView.showLoading("同步中");
new MyHttpUtils().downCourse(new HttpCallback<DownCourseWrapper>() {
@Override
public void onSuccess(DownCourseWrapper bean) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
if (bean != null) {
if (bean.getCode() == 1) {
overWriteLocal(bean.getData());
mView.stopLoading();
EventBus.getDefault().post(new CourseDataChangeEvent());
mView.cloudToLocalSucceed();
} else {
mView.showMassage("同步失败:" + bean.getMsg());
}
} else {
mView.showMassage("同步失败");
}
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
mView.showMassage(errMsg);
}
});
}
Aggregations