|
@@ -11,13 +11,16 @@ import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
import com.cooleshow.base.utils.GlideUtils;
|
|
import com.cooleshow.base.utils.GlideUtils;
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.R;
|
|
|
|
+import com.cooleshow.teacher.bean.SparringCourseCommentBean;
|
|
import com.cooleshow.teacher.bean.SparringCourseHomeworkBean;
|
|
import com.cooleshow.teacher.bean.SparringCourseHomeworkBean;
|
|
import com.cooleshow.teacher.constants.CourseConstants;
|
|
import com.cooleshow.teacher.constants.CourseConstants;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
import com.cooleshow.teacher.contract.SparringCourseDetailContract;
|
|
import com.cooleshow.teacher.contract.SparringCourseDetailContract;
|
|
import com.cooleshow.teacher.databinding.ActivitySparringCourseDetailLayoutBinding;
|
|
import com.cooleshow.teacher.databinding.ActivitySparringCourseDetailLayoutBinding;
|
|
import com.cooleshow.teacher.presenter.course.SparringCourseDetailPresenter;
|
|
import com.cooleshow.teacher.presenter.course.SparringCourseDetailPresenter;
|
|
|
|
+import com.cooleshow.teacher.widgets.CourseSetCommentDialog;
|
|
import com.cooleshow.teacher.widgets.HomeworkVideoThumbnailView;
|
|
import com.cooleshow.teacher.widgets.HomeworkVideoThumbnailView;
|
|
|
|
+import com.cooleshow.usercenter.helper.UserHelper;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.viewbinding.ViewBinding;
|
|
import androidx.viewbinding.ViewBinding;
|
|
@@ -28,7 +31,12 @@ import androidx.viewbinding.ViewBinding;
|
|
@Route(path = RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
|
|
@Route(path = RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
|
|
public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparringCourseDetailLayoutBinding, SparringCourseDetailPresenter> implements SparringCourseDetailContract.SparringCourseDetailView, View.OnClickListener {
|
|
public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparringCourseDetailLayoutBinding, SparringCourseDetailPresenter> implements SparringCourseDetailContract.SparringCourseDetailView, View.OnClickListener {
|
|
public static final String COURSE_ID = "course_id";
|
|
public static final String COURSE_ID = "course_id";
|
|
|
|
+ public static final String COURSE_GROUP_ID = "course_group_id";
|
|
|
|
+ public static final String STUDENT_ID = "studentId";
|
|
private String mCourseId;
|
|
private String mCourseId;
|
|
|
|
+ private String mCourseGroupId;
|
|
|
|
+ private String studentId;
|
|
|
|
+ private CourseSetCommentDialog mSetCommentDialog;
|
|
|
|
|
|
@NonNull
|
|
@NonNull
|
|
@Override
|
|
@Override
|
|
@@ -38,21 +46,32 @@ public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparri
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void initView() {
|
|
protected void initView() {
|
|
- super.initView();
|
|
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "课程详情");
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "课程详情");
|
|
mCourseId = getIntent().getStringExtra(COURSE_ID);
|
|
mCourseId = getIntent().getStringExtra(COURSE_ID);
|
|
- if (TextUtils.isEmpty(mCourseId)) {
|
|
|
|
|
|
+ mCourseGroupId = getIntent().getStringExtra(COURSE_GROUP_ID);
|
|
|
|
+ studentId = getIntent().getStringExtra(STUDENT_ID);
|
|
|
|
+ if (TextUtils.isEmpty(mCourseId)
|
|
|
|
+ || TextUtils.isEmpty(mCourseGroupId)
|
|
|
|
+ || TextUtils.isEmpty(studentId)) {
|
|
finish();
|
|
finish();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
viewBinding.tvSetHomework.setOnClickListener(this);
|
|
viewBinding.tvSetHomework.setOnClickListener(this);
|
|
viewBinding.tvHomeworkSetComment.setOnClickListener(this);
|
|
viewBinding.tvHomeworkSetComment.setOnClickListener(this);
|
|
|
|
+ viewBinding.tvSetTeacherComment.setOnClickListener(this);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void initData() {
|
|
public void initData() {
|
|
super.initData();
|
|
super.initData();
|
|
- presenter.getSparringCourseHomework(mCourseId);
|
|
|
|
|
|
+ refresh();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void refresh() {
|
|
|
|
+ if (presenter != null) {
|
|
|
|
+ presenter.getSparringCourseHomework(mCourseId);
|
|
|
|
+ presenter.getSparringCourseComment(mCourseId, mCourseGroupId, studentId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -76,13 +95,12 @@ public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparri
|
|
//时间
|
|
//时间
|
|
viewBinding.tvCourseTime.setText(infoBean.classDate);
|
|
viewBinding.tvCourseTime.setText(infoBean.classDate);
|
|
//学生头像
|
|
//学生头像
|
|
- GlideUtils.INSTANCE.loadImage(this, infoBean.studentAvatar, viewBinding.ivAvatar,R.drawable.icon_teacher_default_head);
|
|
|
|
|
|
+ GlideUtils.INSTANCE.loadImage(this, infoBean.studentAvatar, viewBinding.ivAvatar, R.drawable.icon_teacher_default_head);
|
|
//title
|
|
//title
|
|
- viewBinding.tvTitle.setText(infoBean.studentName);
|
|
|
|
|
|
+ viewBinding.tvTitle.setText(UserHelper.getStudentName(infoBean.studentName, studentId));
|
|
//subjectName
|
|
//subjectName
|
|
viewBinding.tvCourseName.setText(infoBean.subjectName);
|
|
viewBinding.tvCourseName.setText(infoBean.subjectName);
|
|
|
|
|
|
-
|
|
|
|
String status = infoBean.courseStatus;
|
|
String status = infoBean.courseStatus;
|
|
if (TextUtils.equals(CourseConstants.COURSE_STATUS_NOT_START, status)) {
|
|
if (TextUtils.equals(CourseConstants.COURSE_STATUS_NOT_START, status)) {
|
|
//课程未开始
|
|
//课程未开始
|
|
@@ -199,20 +217,139 @@ public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparri
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public void getSparringCourseHomeworkError() {
|
|
|
|
|
|
+ public void getSparringCourseCommentSuccess(SparringCourseCommentBean commentBean) {
|
|
|
|
+ if (isFinishing() || isDestroyed()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (commentBean != null && !TextUtils.isEmpty(commentBean.teacherReplied)) {
|
|
|
|
+ //老师已评价 tv_set_teacher_comment
|
|
|
|
+ viewBinding.tvSetTeacherComment.setVisibility(View.GONE);
|
|
|
|
+ viewBinding.tvTeacherAppraisalEmptyText.setVisibility(View.GONE);
|
|
|
|
+ viewBinding.tvTeacherAppraisalContent.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.tvTeacherAppraisalContent.setText(commentBean.teacherReplied);
|
|
|
|
+ } else {
|
|
|
|
+ //老师未评价
|
|
|
|
+ viewBinding.tvSetTeacherComment.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.tvTeacherAppraisalEmptyText.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.tvTeacherAppraisalContent.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (commentBean != null && !TextUtils.isEmpty(commentBean.studentReplied)) {
|
|
|
|
+ //学生已评价 tv_stu_comment_content
|
|
|
|
+ //评分星级
|
|
|
|
+ viewBinding.ratingBarForStudent.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.ratingBarForStudent.setRating(commentBean.score);
|
|
|
|
|
|
|
|
+ viewBinding.tvStuCommentEmptyText.setVisibility(View.GONE);
|
|
|
|
+ viewBinding.tvStuCommentContent.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.tvStuCommentContent.setText(commentBean.studentReplied);
|
|
|
|
+ } else {
|
|
|
|
+ //学员未评价
|
|
|
|
+ viewBinding.ratingBarForStudent.setVisibility(View.GONE);
|
|
|
|
+ viewBinding.tvStuCommentEmptyText.setVisibility(View.VISIBLE);
|
|
|
|
+ viewBinding.tvStuCommentContent.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
if (v.getId() == R.id.tv_set_homework) {
|
|
if (v.getId() == R.id.tv_set_homework) {
|
|
//布置作业
|
|
//布置作业
|
|
|
|
+ showSetCommentDialog(CourseSetCommentDialog.TYPE_SET_HOMEWORK);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (v.getId() == R.id.tv_homework_set_comment) {
|
|
if (v.getId() == R.id.tv_homework_set_comment) {
|
|
//点评作业
|
|
//点评作业
|
|
|
|
+ showSetCommentDialog(CourseSetCommentDialog.TYPE_SET_HOMEWORK_COMMENT);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (v.getId() == R.id.tv_set_teacher_comment) {
|
|
|
|
+ //提交老师评价
|
|
|
|
+ showSetCommentDialog(CourseSetCommentDialog.TYPE_SET_TEACHER_COMMENT);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void showSetCommentDialog(int typeSetTeacherComment) {
|
|
|
|
+ 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_TEACHER_COMMENT) {
|
|
|
|
+ //提交老师点评
|
|
|
|
+ presenter.submitSparringCourseComment(content,mCourseId,mCourseGroupId,studentId);
|
|
|
|
+ }
|
|
|
|
+ if (type == CourseSetCommentDialog.TYPE_SET_HOMEWORK) {
|
|
|
|
+ //提交布置作业
|
|
|
|
+ presenter.submitSparringCourseHomework(content,mCourseId);
|
|
|
|
+ }
|
|
|
|
+ if (type == CourseSetCommentDialog.TYPE_SET_HOMEWORK_COMMENT) {
|
|
|
|
+ //提交作业点评
|
|
|
|
+ presenter.submitSparringCourseHomeworkComment(content,mCourseId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (!mSetCommentDialog.isShowing()) {
|
|
|
|
+ mSetCommentDialog.show();
|
|
|
|
+ }
|
|
|
|
+ mSetCommentDialog.showMethod(typeSetTeacherComment);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void getSparringCourseCommentError() {
|
|
|
|
+ //获取课程详情评价信息失败
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 提交老师评价成功
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void submitSparringCourseTeacherCommentSuccess() {
|
|
|
|
+ if (isFinishing() || isDestroyed()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ refresh();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 提交布置作业成功
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void submitSparringCourseHomeworkSuccess() {
|
|
|
|
+ if (isFinishing() || isDestroyed()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ refresh();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 提交作业评价成功
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void submitSparringCourseHomeworkCommentSuccess() {
|
|
|
|
+ if (isFinishing() || isDestroyed()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ refresh();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void getSparringCourseHomeworkError() {
|
|
|
|
+ //获取课程详情作业信息失败
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onDestroy() {
|
|
|
|
+ super.onDestroy();
|
|
|
|
+ if (mSetCommentDialog != null) {
|
|
|
|
+ mSetCommentDialog.unbind();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|