Browse Source

修改学生端课表显示和跳转

Pq 3 months ago
parent
commit
35bb40964c

+ 19 - 1
student/src/main/java/com/cooleshow/student/adapter/CourseTableListAdapter.kt

@@ -24,6 +24,7 @@ class CourseTableListAdapter(layoutResId: Int) :
         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"
@@ -45,6 +46,7 @@ class CourseTableListAdapter(layoutResId: Int) :
         val ivAvatar = baseViewHolder.getView<ImageView>(R.id.iv_avatar)
         val viewLine2 = baseViewHolder.getView<View>(R.id.view_line2)
         val tvBuyNum = baseViewHolder.getView<TextView>(R.id.tv_buy_num)
+        val tv_vip_course_tag = baseViewHolder.getView<TextView>(R.id.tv_vip_course_tag)
         val tvCourseStatusBt = baseViewHolder.getView<TextView>(R.id.tv_course_status_bt)
         //开始时间
         tvTime.text = UiUtils.getCourseTimeString(data?.startTime, data?.endTime);
@@ -60,8 +62,10 @@ class CourseTableListAdapter(layoutResId: Int) :
                 ivAvatar,
                 R.drawable.icon_teacher_default_head
             )
+            tv_vip_course_tag.text = "趣纠课"
             viewLine2.setVisible(false)
             tvBuyNum.setVisible(false)
+            tv_vip_course_tag.setVisible(true)
         } else if (TextUtils.equals(PIANO_ROOM_COURSE, data?.courseType)) {
             //琴房课
             ivAvatar.setImageResource(R.drawable.icon_piano_room_course)
@@ -69,7 +73,20 @@ class CourseTableListAdapter(layoutResId: Int) :
             tvBuyNum.text = count + "人"
             viewLine2.setVisible(false)
             tvBuyNum.setVisible(false)
-        } else {
+            tv_vip_course_tag.setVisible(false)
+        }  else if (TextUtils.equals(VIP_COURSE, data?.courseType)) {
+            //VIP课
+            GlideUtils.loadImage(
+                context,
+                data!!.cover,
+                ivAvatar,
+                R.drawable.icon_teacher_default_head
+            )
+            tv_vip_course_tag.text = "VIP定制课"
+            viewLine2.setVisible(false)
+            tvBuyNum.setVisible(false)
+            tv_vip_course_tag.setVisible(true)
+        }else {
             //直播课
             ivAvatar.setImageResource(R.drawable.icon_live_bg)
             var payCount = data?.payCount
@@ -77,6 +94,7 @@ class CourseTableListAdapter(layoutResId: Int) :
             tvBuyNum.text = context.getString(R.string.pay_count_str, payCount)
             viewLine2.setVisible(false)
             tvBuyNum.setVisible(false)
+            tv_vip_course_tag.setVisible(false)
         }
         when (data?.status) {
             NOT_START -> {

+ 10 - 0
student/src/main/java/com/cooleshow/student/ui/main/CourseTableFragment.kt

@@ -134,6 +134,16 @@ class CourseTableFragment :
                 ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
                     .withString("course_id", data.courseId)
                     .navigation()
+            } else  if (TextUtils.equals(CourseTableListAdapter.VIP_COURSE, data?.courseType)) {
+                //VIP课
+                ARouter.getInstance()
+                    .build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
+                    .withString(SparringCourseDetailActivity.COURSE_ID, data.courseId)
+                    .withString(
+                        SparringCourseDetailActivity.COURSE_GROUP_ID,
+                        data.courseGoupId
+                    )
+                    .navigation()
             } else {
                 //直播课
                 ARouter.getInstance()

+ 23 - 3
student/src/main/res/layout/item_course_table_layout.xml

@@ -79,6 +79,26 @@
         app:layout_constraintTop_toTopOf="@+id/tv_title" />
 
     <TextView
+        android:id="@+id/tv_vip_course_tag"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_couse_type_text_bg"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:paddingStart="6dp"
+        android:paddingTop="2dp"
+        android:paddingEnd="6dp"
+        android:paddingBottom="2dp"
+        android:textColor="@color/color_ff8c00"
+        android:textSize="@dimen/sp_11"
+        android:visibility="gone"
+        app:layout_constraintTop_toTopOf="@+id/tv_course_name"
+        app:layout_constraintLeft_toLeftOf="@+id/tv_title"
+        tools:text="单簧管" />
+
+    <TextView
+        app:layout_goneMarginStart="0dp"
+        android:layout_marginStart="4dp"
         android:id="@+id/tv_course_name"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -93,7 +113,7 @@
         android:textColor="@color/color_ff8c00"
         android:textSize="@dimen/sp_11"
         app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
-        app:layout_constraintLeft_toLeftOf="@+id/tv_title"
+        app:layout_constraintLeft_toRightOf="@+id/tv_vip_course_tag"
         app:layout_constraintTop_toBottomOf="@+id/tv_title"
         tools:text="单簧管" />
 
@@ -139,8 +159,8 @@
         android:background="@drawable/shape_course_status_normal"
         android:gravity="center"
         android:textColor="@color/color_2dc7aa"
-        android:textSize="@dimen/sp_14"
-        app:layout_constraintBottom_toBottomOf="parent"
+        android:textSize="@dimen/sp_13"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
         app:layout_constraintRight_toRightOf="parent"
         tools:text="调课" />