use of com.mnnyang.gzuclassschedule.data.beanv2.CourseV2 in project GzuClassSchedule by mnnyang.
the class HomePresenter method writeShare.
/**
* 分享写入本地
*/
private long writeShare(List<DownCourseWrapper.DownCourse> data) {
CourseV2Dao courseV2Dao = Cache.instance().getCourseV2Dao();
CourseGroup group = new CourseGroup();
group.setCgName("来自热心网友分享" + AppUtils.createUUID().substring(0, 8));
long newGroupId = Cache.instance().getCourseGroupDao().insert(group);
for (DownCourseWrapper.DownCourse downCourse : data) {
CourseV2 courseV2 = new CourseV2().setCouOnlyId(// new only_id
AppUtils.createUUID()).setCouCgId(// new group
newGroupId).setCouName(downCourse.getName()).setCouTeacher(downCourse.getTeacher()).setCouLocation(downCourse.getLocation()).setCouColor(downCourse.getColor()).setCouWeek(downCourse.getWeek()).setCouStartNode(downCourse.getStart_node()).setCouNodeCount(downCourse.getNode_count()).setCouAllWeek(downCourse.getAll_week());
courseV2Dao.insert(courseV2);
}
return newGroupId;
}
use of com.mnnyang.gzuclassschedule.data.beanv2.CourseV2 in project GzuClassSchedule by mnnyang.
the class HomePresenter method addCourse.
/**
* 添加
*/
private void addCourse(DownCourseWrapper.DownCourse downCourse, Long groupId) {
CourseV2Dao courseDao = Cache.instance().getCourseV2Dao();
CourseV2 oldCourse = new CourseV2().setCouOnlyId(downCourse.getOnly_id()).setCouCgId(groupId).setCouName(downCourse.getName()).setCouTeacher(downCourse.getTeacher()).setCouLocation(downCourse.getLocation()).setCouColor(downCourse.getColor()).setCouWeek(downCourse.getWeek()).setCouStartNode(downCourse.getStart_node()).setCouNodeCount(downCourse.getNode_count()).setCouAllWeek(downCourse.getAll_week());
courseDao.insert(oldCourse);
}
use of com.mnnyang.gzuclassschedule.data.beanv2.CourseV2 in project GzuClassSchedule by mnnyang.
the class AddActivity method initEmptyLocation.
private void initEmptyLocation(LinearLayout locationItem) {
CourseV2 defaultCourse = new CourseV2().setCouOnlyId(AppUtils.createUUID()).setCouAllWeek(Constant.DEFAULT_ALL_WEEK).setCouWeek(1).setCouStartNode(1).setCouNodeCount(1);
initNodeInfo(locationItem, defaultCourse);
}
use of com.mnnyang.gzuclassschedule.data.beanv2.CourseV2 in project GzuClassSchedule by mnnyang.
the class AddActivity method addLocation.
private void addLocation(boolean closeable) {
final LinearLayout locationItem = (LinearLayout) View.inflate(this, R.layout.layout_location_item, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.topMargin = ScreenUtils.dp2px(8);
if (closeable) {
locationItem.findViewById(R.id.iv_clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mLayoutLocationContainer.removeView(locationItem);
}
});
initEmptyLocation(locationItem);
} else {
// 建立默认的上课时间和上课地点
locationItem.findViewById(R.id.iv_clear).setVisibility(View.INVISIBLE);
if (mAncestor != null) {
// 屏幕点击过来
CourseV2 defaultCourse = new CourseV2().setCouOnlyId(AppUtils.createUUID()).setCouAllWeek(Constant.DEFAULT_ALL_WEEK).setCouWeek(mAncestor.getRow()).setCouStartNode(mAncestor.getCol()).setCouNodeCount(mAncestor.getRowNum()).init();
initNodeInfo(locationItem, defaultCourse);
} else if (mIntentCourseV2 != null) {
// 编辑过来
initNodeInfo(locationItem, mIntentCourseV2);
mEtlName.setText(mIntentCourseV2.getCouName());
mEtlTeacher.setText(mIntentCourseV2.getCouTeacher());
} else {
//
LogUtil.e(this, "initEmptyLocation");
initEmptyLocation(locationItem);
}
}
locationItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickLocationItem(locationItem);
}
});
mLayoutLocationContainer.addView(locationItem, params);
}
use of com.mnnyang.gzuclassschedule.data.beanv2.CourseV2 in project GzuClassSchedule by mnnyang.
the class CourseActivity method setCourseData.
@Override
public void setCourseData(List<CourseV2> courses) {
mCourseViewV2.clear();
CourseV2Dao courseV2Dao = Cache.instance().getCourseV2Dao();
LogUtil.d(this, "当前课程数:" + courses.size());
for (CourseV2 course : courses) {
if (course.getCouColor() == null || course.getCouColor() == -1) {
course.setCouColor(Utils.getRandomColor());
courseV2Dao.update(course);
}
course.init();
LogUtil.e(this, "即将显示:" + course.toString());
mCourseViewV2.addCourse(course);
}
// 没有课程才显示叶子logo
if (courses.isEmpty()) {
mLayoutCourse.setBackgroundResource(R.drawable.svg_bg);
} else {
mLayoutCourse.setBackgroundResource(0);
}
}
Aggregations