use of com.mnnyang.gzuclassschedule.data.beanv2.DownCourseWrapper in project GzuClassSchedule by mnnyang.
the class HomePresenter method downShare.
/**
* 下载解析分享
*/
@Override
public void downShare(String url) {
if (TextUtils.isEmpty(url)) {
mView.showMassage("分享为空");
return;
}
mView.showLoading("导入中");
new MyHttpUtils().downShare(url, new HttpCallback<DownCourseWrapper>() {
@Override
public void onSuccess(DownCourseWrapper downCourseWrapper) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
if (downCourseWrapper == null || downCourseWrapper.getData() == null) {
mView.showMassage("导入数据为空");
return;
}
long newGroupId = writeShare(downCourseWrapper.getData());
// 通知更新
// 切换到当前课表
Preferences.putLong(app.mContext.getString(R.string.app_preference_current_cs_name_id), newGroupId);
mView.showMassage("导入成功!");
EventBus.getDefault().post(new CourseDataChangeEvent());
mView.cloudToLocalSucceed();
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// view被销毁
return;
}
mView.stopLoading();
mView.showMassage(errMsg);
}
});
}
use of com.mnnyang.gzuclassschedule.data.beanv2.DownCourseWrapper 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