|
@@ -11,6 +11,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
+import com.cooleshow.base.utils.ToastUtil;
|
|
|
+import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
import com.cooleshow.teacher.R;
|
|
@@ -39,6 +41,7 @@ public class PianoRoomCourseDetailActivity extends BaseMVPActivity<ActivityPiano
|
|
|
private String mCourseId;
|
|
|
private PianoRoomCourseStudentListAdapter mAdapter;
|
|
|
private CourseSetCommentDialog mSetCommentDialog;
|
|
|
+ private PianoRoomCourseInfoBean mInfoBean;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -73,16 +76,20 @@ public class PianoRoomCourseDetailActivity extends BaseMVPActivity<ActivityPiano
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
|
- mAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
|
- @Override
|
|
|
- public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
|
|
- if (position < mAdapter.getData().size()) {
|
|
|
- PianoRoomCourseInfoBean.StudentHomeworkListBean.RecordsBean recordsBean = mAdapter.getData().get(position);
|
|
|
- ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_HOMEWORK)
|
|
|
- .withString("studentId", recordsBean.studentId)
|
|
|
- .withString("course_id", mCourseId)
|
|
|
- .navigation();
|
|
|
- }
|
|
|
+ mAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
+ if (mInfoBean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.equals(mInfoBean.courseStatus, CourseConstants.COURSE_FILTER_HAS_NOT_STARTED)) {
|
|
|
+ ToastUtil.getInstance().showShort("您还未布置作业");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (position < mAdapter.getData().size()) {
|
|
|
+ PianoRoomCourseInfoBean.StudentHomeworkListBean.RecordsBean recordsBean = mAdapter.getData().get(position);
|
|
|
+ ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_HOMEWORK)
|
|
|
+ .withString("studentId", recordsBean.studentId)
|
|
|
+ .withString("course_id", mCourseId)
|
|
|
+ .navigation();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -117,8 +124,9 @@ public class PianoRoomCourseDetailActivity extends BaseMVPActivity<ActivityPiano
|
|
|
if (infoBean == null) {
|
|
|
return;
|
|
|
}
|
|
|
+ mInfoBean = infoBean;
|
|
|
//时间
|
|
|
- viewBinding.tvCourseTime.setText(infoBean.classDate);
|
|
|
+ viewBinding.tvCourseTime.setText(UiUtils.getCourseTimeString(infoBean.startTime, infoBean.endTime));
|
|
|
//title
|
|
|
viewBinding.tvTitle.setText(infoBean.courseGroupName);
|
|
|
//subjectName
|
|
@@ -208,15 +216,19 @@ public class PianoRoomCourseDetailActivity extends BaseMVPActivity<ActivityPiano
|
|
|
}
|
|
|
|
|
|
private void showSetCommentDialog() {
|
|
|
+ if (mInfoBean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.equals(mInfoBean.courseStatus, CourseConstants.COURSE_FILTER_HAS_NOT_STARTED)) {
|
|
|
+ ToastUtil.getInstance().showShort("课程结束之后才可以布置作业哦~");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (mSetCommentDialog == null) {
|
|
|
mSetCommentDialog = new CourseSetCommentDialog(this);
|
|
|
- mSetCommentDialog.setOnSubmitClickListener(new CourseSetCommentDialog.OnSubmitClickListener() {
|
|
|
- @Override
|
|
|
- public void onSubmit(String content, int type) {
|
|
|
- if (type == CourseSetCommentDialog.TYPE_SET_HOMEWORK) {
|
|
|
- //提交布置作业
|
|
|
- presenter.submitSparringCourseHomework(content, mCourseId);
|
|
|
- }
|
|
|
+ mSetCommentDialog.setOnSubmitClickListener((content, type) -> {
|
|
|
+ if (type == CourseSetCommentDialog.TYPE_SET_HOMEWORK) {
|
|
|
+ //提交布置作业
|
|
|
+ presenter.submitSparringCourseHomework(content, mCourseId);
|
|
|
}
|
|
|
});
|
|
|
}
|