|
@@ -9,6 +9,7 @@ import android.widget.TextView
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
|
|
+import com.cooleshow.base.constanst.CourseType
|
|
|
import com.cooleshow.base.ext.setVisible
|
|
|
import com.cooleshow.base.utils.GlideUtils
|
|
|
import com.cooleshow.base.utils.SizeUtils
|
|
@@ -24,10 +25,10 @@ import kotlin.math.abs
|
|
|
class CourseTableListAdapter(layoutResId: Int) :
|
|
|
BaseQuickAdapter<CourseTableDataBean.StudentListBean?, BaseViewHolder>(layoutResId) {
|
|
|
companion object {
|
|
|
- const val LIVE_COURSE = "LIVE"//直播课
|
|
|
- const val OTHER_COURSE = "PRACTICE"//陪练课
|
|
|
- const val PIANO_ROOM_COURSE = "PIANO_ROOM_CLASS"//琴房课
|
|
|
- const val VIP_COURSE = "VIP"//VIP课
|
|
|
+// const val LIVE_COURSE = "LIVE"//直播课
|
|
|
+// const val OTHER_COURSE = "PRACTICE"//陪练课
|
|
|
+// const val PIANO_ROOM_COURSE = "PIANO_ROOM_CLASS"//琴房课
|
|
|
+// const val VIP_COURSE = "VIP"//VIP课
|
|
|
const val NOT_START = "NOT_START"
|
|
|
const val ING = "ING"
|
|
|
const val COMPLETE = "COMPLETE"
|
|
@@ -57,7 +58,7 @@ class CourseTableListAdapter(layoutResId: Int) :
|
|
|
baseViewHolder.setText(R.id.tv_title, data?.courseName);
|
|
|
//subjectName
|
|
|
baseViewHolder.setText(R.id.tv_course_name, data?.subjectName);
|
|
|
- if (TextUtils.equals(OTHER_COURSE, data?.courseType)) {
|
|
|
+ if (TextUtils.equals(CourseType.PRACTICE.id, data?.courseType)) {
|
|
|
//陪练课
|
|
|
GlideUtils.loadImage(
|
|
|
context,
|
|
@@ -70,7 +71,7 @@ class CourseTableListAdapter(layoutResId: Int) :
|
|
|
tvBuyNum.setVisible(false)
|
|
|
tv_vip_course_tag.setVisible(true)
|
|
|
baseViewHolder.setText(R.id.tv_title, data?.name);
|
|
|
- } else if (TextUtils.equals(PIANO_ROOM_COURSE, data?.courseType)) {
|
|
|
+ } else if (TextUtils.equals(CourseType.PIANO_ROOM_CLASS.id, data?.courseType)) {
|
|
|
//琴房课
|
|
|
ivAvatar.setImageResource(R.drawable.icon_piano_room_course)
|
|
|
val count: String = if (!TextUtils.isEmpty(data?.payCount)) data!!.payCount else "0"
|
|
@@ -78,7 +79,16 @@ class CourseTableListAdapter(layoutResId: Int) :
|
|
|
viewLine2.setVisible(false)
|
|
|
tvBuyNum.setVisible(false)
|
|
|
tv_vip_course_tag.setVisible(false)
|
|
|
- } else if (TextUtils.equals(VIP_COURSE, data?.courseType)) {
|
|
|
+ }
|
|
|
+ else if (TextUtils.equals(CourseType.GROUP.id, data?.courseType)) {
|
|
|
+ //小组课
|
|
|
+ ivAvatar.setImageResource(R.drawable.icon_group_course_avatar_112_112)
|
|
|
+ val count: String = if (!TextUtils.isEmpty(data?.payCount)) data!!.payCount else "0"
|
|
|
+ tvBuyNum.text = count + "人"
|
|
|
+ viewLine2.setVisible(false)
|
|
|
+ tvBuyNum.setVisible(false)
|
|
|
+ tv_vip_course_tag.setVisible(false)
|
|
|
+ } else if (TextUtils.equals(CourseType.VIP.id, data?.courseType)) {
|
|
|
//VIP课
|
|
|
GlideUtils.loadImage(
|
|
|
context,
|
|
@@ -134,7 +144,7 @@ class CourseTableListAdapter(layoutResId: Int) :
|
|
|
}
|
|
|
COMPLETE -> {
|
|
|
//已完成
|
|
|
- if (TextUtils.equals(VIP_COURSE, data?.courseType) || TextUtils.equals(OTHER_COURSE, data?.courseType)) {
|
|
|
+ if (TextUtils.equals(CourseType.VIP.id, data?.courseType) || TextUtils.equals(CourseType.PRACTICE.id, data?.courseType)) {
|
|
|
tvCourseStatusBt.setVisible(true)
|
|
|
} else {
|
|
|
//直播课隐藏
|
|
@@ -181,17 +191,25 @@ class CourseTableListAdapter(layoutResId: Int) :
|
|
|
return false;
|
|
|
}
|
|
|
when (data.courseType) {
|
|
|
- OTHER_COURSE -> {
|
|
|
+ CourseType.VIP.id -> {
|
|
|
+ return isLessThanTargetTime(configBean!!.vipStartTime, data.startTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ CourseType.PRACTICE.id -> {
|
|
|
return isLessThanTargetTime(configBean!!.practiceStartTime, data.startTime);
|
|
|
}
|
|
|
|
|
|
- LIVE_COURSE -> {
|
|
|
+ CourseType.LIVE.id -> {
|
|
|
return isLessThanTargetTime(configBean!!.liveStartTime, data.startTime);
|
|
|
}
|
|
|
|
|
|
- PIANO_ROOM_COURSE -> {
|
|
|
+ CourseType.PIANO_ROOM_CLASS.id -> {
|
|
|
return isLessThanTargetTime(configBean!!.pianoStartTime, data.startTime);
|
|
|
}
|
|
|
+
|
|
|
+ CourseType.GROUP.id -> {
|
|
|
+ return isLessThanTargetTime(configBean!!.groupStartTime, data.startTime);
|
|
|
+ }
|
|
|
}
|
|
|
return false;
|
|
|
}
|