|
@@ -1,5 +1,6 @@
|
|
|
package com.cooleshow.teacher.ui.main
|
|
|
|
|
|
+import android.text.TextUtils
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.MotionEvent
|
|
|
import android.view.View
|
|
@@ -7,11 +8,14 @@ import android.widget.ImageView
|
|
|
import android.widget.TextView
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter
|
|
|
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
|
|
import com.bigkoo.pickerview.listener.CustomListener
|
|
|
import com.bigkoo.pickerview.listener.OnTimeSelectListener
|
|
|
import com.bigkoo.pickerview.view.TimePickerView
|
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener
|
|
|
+import com.cooleshow.base.common.WebConstants
|
|
|
+import com.cooleshow.base.router.RouterPath
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment
|
|
|
import com.cooleshow.base.utils.SizeUtils
|
|
|
import com.cooleshow.base.utils.TimeUtils
|
|
@@ -23,6 +27,8 @@ import com.cooleshow.teacher.bean.CourseTableDataBean
|
|
|
import com.cooleshow.teacher.contract.CourseTableContract
|
|
|
import com.cooleshow.teacher.databinding.FragmentCourseTableLayoutBinding
|
|
|
import com.cooleshow.teacher.presenter.main.CourseTablePresenter
|
|
|
+import com.cooleshow.teacher.ui.comment.CourseCommentDetailActivity
|
|
|
+import com.cooleshow.teacher.ui.course.SparringCourseDetailActivity
|
|
|
import com.cooleshow.teacher.widgets.CalendarExpandDecoration
|
|
|
import com.cooleshow.teacher.widgets.CalendarShrinkDecoration
|
|
|
import com.haibin.calendarview.CalendarView
|
|
@@ -44,6 +50,7 @@ class CourseTableFragment :
|
|
|
private lateinit var calendarShrinkDecoration: CalendarShrinkDecoration
|
|
|
private lateinit var adapter: CourseTableListAdapter
|
|
|
private lateinit var pvTime: TimePickerView
|
|
|
+ private lateinit var pvCourseTime: TimePickerView
|
|
|
private lateinit var emptyView: EmptyViewLayout
|
|
|
private lateinit var emptyText: TextView
|
|
|
private lateinit var emptyIcon: ImageView
|
|
@@ -97,11 +104,47 @@ class CourseTableFragment :
|
|
|
}
|
|
|
})
|
|
|
adapter.setOnItemClickListener(OnItemClickListener() { adapter, view, position ->
|
|
|
+ var data: CourseTableDataBean.StudentListBean =
|
|
|
+ adapter.data[position] as CourseTableDataBean.StudentListBean;
|
|
|
+ if (TextUtils.equals(CourseTableListAdapter.OTHER_COURSE, data?.courseType)) {
|
|
|
+ //陪练课
|
|
|
+ when (data?.status) {
|
|
|
+ CourseTableListAdapter.NOT_START -> {
|
|
|
+ //调课(调整时间)
|
|
|
+ var targetDate: Date = TimeUtils.getDate(data.startTime)
|
|
|
+ showCourseTimeSelectView(targetDate, data.courseId);
|
|
|
+ }
|
|
|
+ CourseTableListAdapter.ING -> {
|
|
|
+ //进行中的
|
|
|
+ }
|
|
|
+ CourseTableListAdapter.COMPLETE -> {
|
|
|
+ //评价
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.CommentCenter.TEACHER_COURSE_COMMENT_DETAIL)
|
|
|
+ .withString(CourseCommentDetailActivity.COURSE_ID, data.courseId)
|
|
|
+ .withString(
|
|
|
+ CourseCommentDetailActivity.COURSE_GROUP_ID,
|
|
|
+ data.courseGoupId
|
|
|
+ )
|
|
|
+ .withString(CourseCommentDetailActivity.STUDENT_ID, data.userId)
|
|
|
+ .navigation()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //直播课
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
+ .withString(
|
|
|
+ WebConstants.WEB_URL,
|
|
|
+ WebConstants.TEACHER_LIVE_DETAIL + "?groupId=" + data.courseGoupId
|
|
|
+ )
|
|
|
+ .navigation()
|
|
|
+ }
|
|
|
})
|
|
|
mViewBinding.refreshLayout.setOnRefreshListener {
|
|
|
queryCurrentDataCourse()
|
|
|
}
|
|
|
- mViewBinding.refreshLayout.isEnabled=false
|
|
|
+ mViewBinding.refreshLayout.isEnabled = false
|
|
|
}
|
|
|
|
|
|
override fun initData() {
|
|
@@ -145,6 +188,7 @@ class CourseTableFragment :
|
|
|
setMontAndDay(year, month, day)
|
|
|
queryCurrentDataCourse()
|
|
|
}
|
|
|
+
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
queryCurrentDataCourse()
|
|
@@ -178,13 +222,13 @@ class CourseTableFragment :
|
|
|
recyclerView.removeItemDecoration(calendarExpandDecoration)
|
|
|
if (recyclerView.itemDecorationCount == 0 || recyclerView.getItemDecorationAt(0) !is CalendarShrinkDecoration) {
|
|
|
recyclerView.addItemDecoration(calendarShrinkDecoration, 0)
|
|
|
- mViewBinding.refreshLayout.isEnabled=false
|
|
|
+ mViewBinding.refreshLayout.isEnabled = false
|
|
|
}
|
|
|
} else {
|
|
|
recyclerView.removeItemDecoration(calendarShrinkDecoration)
|
|
|
if (recyclerView.itemDecorationCount == 0 || recyclerView.getItemDecorationAt(0) !is CalendarExpandDecoration) {
|
|
|
recyclerView.addItemDecoration(calendarExpandDecoration, 0)
|
|
|
- mViewBinding.refreshLayout.isEnabled=true
|
|
|
+ mViewBinding.refreshLayout.isEnabled = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -210,10 +254,18 @@ class CourseTableFragment :
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
override fun onGetCourseDateByMonthError() {
|
|
|
mViewBinding.refreshLayout.finishRefresh()
|
|
|
}
|
|
|
|
|
|
+ override fun onUpDateCourseDataSuccess() {
|
|
|
+ if (isDetached) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ queryCurrentDataCourse();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询当天的课程
|
|
|
*/
|
|
@@ -249,6 +301,42 @@ class CourseTableFragment :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun showCourseTimeSelectView(targetTime: Date, courseId: String) {
|
|
|
+ //正确设置方式 原因:注意事项有说明
|
|
|
+ if (!::pvCourseTime.isInitialized) {
|
|
|
+ pvCourseTime = TimePickerBuilder(
|
|
|
+ requireContext(),
|
|
|
+ OnTimeSelectListener { date: Date?, v: View? -> //选中事件回调
|
|
|
+ presenter.updateCourseTime(date, courseId);
|
|
|
+ }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_default_layout,
|
|
|
+ CustomListener { v -> //自定义布局中的控件初始化及事件处理
|
|
|
+ val tvSubmit =
|
|
|
+ v.findViewById<View>(com.cooleshow.base.R.id.tv_finish) as TextView
|
|
|
+ val ivCancel =
|
|
|
+ v.findViewById<View>(com.cooleshow.base.R.id.tv_cancel) as TextView
|
|
|
+ tvSubmit.setOnClickListener {
|
|
|
+ pvCourseTime.returnData()
|
|
|
+ pvCourseTime.dismiss()
|
|
|
+ }
|
|
|
+ ivCancel.setOnClickListener { pvCourseTime.dismiss() }
|
|
|
+ })
|
|
|
+ .setLineSpacingMultiplier(2.5f)
|
|
|
+ .setType(booleanArrayOf(true, true, true, true, true, true)) // 默认全部显示
|
|
|
+ .isCyclic(true) //是否循环滚动
|
|
|
+ .setOutSideCancelable(true) //点击屏幕,点在控件外部范围时,是否取消显示
|
|
|
+ .setTextColorCenter(resources.getColor(com.cooleshow.base.R.color.color_1a1a1a)) //设置选中项的颜色
|
|
|
+ .isDialog(false) //是否显示为对话框样式
|
|
|
+ .setLabel("年", "月", "日", "时", "分", "秒")
|
|
|
+ .build()
|
|
|
+ }
|
|
|
+ var calendar = Calendar.getInstance();
|
|
|
+ calendar.time = targetTime
|
|
|
+ pvCourseTime.setDate(calendar)
|
|
|
+ if (!pvCourseTime.isShowing) {
|
|
|
+ pvCourseTime.show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 显示日期选择view
|
|
|
*/
|
|
@@ -282,7 +370,7 @@ class CourseTableFragment :
|
|
|
// .setRangDate(null, endDate) //起始终止年月日设定
|
|
|
// .setDate(endDate)
|
|
|
.isDialog(false) //是否显示为对话框样式
|
|
|
- .setLabel("年", "月", "日", "", "", "")
|
|
|
+ .setLabel("年", "月", "日", "时", "分", "秒")
|
|
|
.build()
|
|
|
}
|
|
|
var calendar = Calendar.getInstance();
|