@Override public void afterViewCreated() { setTitle(getString(R.string.title_class_week)); long classId = getIntent().getLongExtra(ExtraKeys.CLASS_TABLE_ENTITY_ID, 1L); classEntity = classManager.getDataById(classId); classNameTv.setText(classEntity.getClassName()); int startWeek = classEntity.getStartWeek(); int endWeek = classEntity.getEndWeek(); weekResultTv.setText(String.format(WEEK_RESULT_FORMAT, startWeek, endWeek)); initPicker(startWeekPicker, startWeek); initPicker(endWeekPicker, endWeek); }
@OnClick(R.id.confirmBtn) void click_confirm() { if (startWeekPicker.getValue() == classEntity.getStartWeek() && endWeekPicker.getValue() == classEntity.getEndWeek()) { finish(); return; } if (isInfoCorrect()) { classEntity.setStartWeek(startWeekPicker.getValue()); classEntity.setEndWeek(endWeekPicker.getValue()); classManager.update(classEntity); showToast("课程始末周已修改"); setResult(RESULT_OK); finish(); } else { showToast("起始周不能大于结束周"); } }