邓琴文 %!s(int64=3) %!d(string=hai) anos
pai
achega
d96f759c0e

+ 1 - 1
BaseLibrary/build.gradle

@@ -183,5 +183,5 @@ dependencies {
     api 'org.greenrobot:eventbus:3.1.1'
 
     //UI适配
-    api 'me.jessyan:autosize:1.2.1'
+//    api 'me.jessyan:autosize:1.2.1'
 }

+ 10 - 7
BaseLibrary/src/main/AndroidManifest.xml

@@ -8,13 +8,16 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
-    <application >
-        <service
-            android:name=".service.PlayMusicService">
-        </service>
-        <activity android:name=".ui.video.VideoPlayActivity"
+    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
+
+    <application>
+        <service android:name=".service.PlayMusicService"></service>
+        <activity
+            android:name=".ui.video.VideoPlayActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="portrait" />
+        <meta-data
+            android:name="design_width_in_dp"
+            android:value="375" />
     </application>
 </manifest>

+ 8 - 0
student/src/main/java/com/cooleshow/student/constants/CourseConstants.java

@@ -15,4 +15,12 @@ public class CourseConstants {
 
     public static final int COURSE_HOMEWORK_STU_SUBMIT = 1;//学员已提交课后作业
     public static final int COURSE_HOMEWORK_STU_NO_SUBMIT = 0;//学员未提交课后作业
+
+    public static final String LIVE_COURSE = "LIVE_COURSE";//直播课
+    public static final String OTHER_COURSE = "PRACTICE";//陪练课
+    public static final String PIANO_ROOM_COURSE = "PIANO_ROOM_CLASS";//琴房课
+
+    public static final String COURSE_ID = "course_id";
+    public static final String COURSE_GROUP_ID = "course_group_id";
+    public static final String STUDENT_ID = "student_id";
 }

+ 1 - 1
student/src/main/java/com/cooleshow/student/ui/course/PracticeCourseDetailActivity.java

@@ -43,7 +43,7 @@ import java.util.List;
  * 创建日期:2022/5/31 9:40
  *
  * @author Ryan
- * 类说明:
+ * 类说明:陪练课详情
  */
 @Route(path = RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
 public class PracticeCourseDetailActivity extends BaseMVPActivity<ActivityPracticeCourseDetailLayoutBinding, PracticeCourseDetailPresenter> implements PracticeCourseDetailContract.PracticeCourseDetailView, View.OnClickListener {

+ 36 - 6
student/src/main/java/com/cooleshow/student/ui/main/HomeFragment.java

@@ -1,5 +1,9 @@
 package com.cooleshow.student.ui.main;
 
+import static com.cooleshow.student.constants.CourseConstants.LIVE_COURSE;
+import static com.cooleshow.student.constants.CourseConstants.OTHER_COURSE;
+import static com.cooleshow.student.constants.CourseConstants.PIANO_ROOM_COURSE;
+
 import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.graphics.Point;
@@ -41,6 +45,7 @@ import com.cooleshow.student.bean.HomeLiveAndVideoBean;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.bean.HotAlbumBean;
 import com.cooleshow.student.bean.StudentUserInfo;
+import com.cooleshow.student.constants.CourseConstants;
 import com.cooleshow.student.contract.HomeContract;
 import com.cooleshow.student.databinding.FragmentHomeLayoutBinding;
 import com.cooleshow.student.presenter.main.HomePresenter;
@@ -347,15 +352,40 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
             mViewBinding.tvLiveTime.setText(TimeUtils.date2String(TimeUtils.getDate(recentCourses.courseStartTime), "yyyy-MM-dd HH:mm"));
         }
         mViewBinding.tvGoLive.setOnClickListener(v -> {
-            //进入直播
-            ARouter.getInstance().build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
-                    .withString(SparringCourseDetailActivity.COURSE_ID, String.valueOf(recentCourses.courseId))
-                    .withString(SparringCourseDetailActivity.COURSE_GROUP_ID, String.valueOf(recentCourses.courseGroupId))
-                    .withString(SparringCourseDetailActivity.STUDENT_ID, UserHelper.getUserId())
-                    .navigation();
+            gotoCourseDetail(recentCourses);
         });
     }
 
+    /**
+     * 跳转直播课详情页面
+     *
+     * @param bean
+     */
+    private void gotoCourseDetail(HomeLiveAndVideoBean.RecentCoursesBean bean) {
+        switch (bean.courseType) {
+            case LIVE_COURSE:
+                ARouter.getInstance()
+                        .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                        .withString(WebConstants.WEB_URL, WebConstants.TEACHER_LIVE_DETAIL + "?groupId=" + bean.courseGroupId)
+                        .navigation();
+                break;
+            case OTHER_COURSE:
+                //陪练课
+                ARouter.getInstance().build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
+                        .withString(CourseConstants.COURSE_ID, String.valueOf(bean.courseId))
+                        .withString(CourseConstants.COURSE_GROUP_ID, String.valueOf(bean.courseGroupId))
+                        .navigation();
+                break;
+            case PIANO_ROOM_COURSE:
+                //琴房课 跳转详情页
+                ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
+                        .withString(CourseConstants.COURSE_ID, String.valueOf(bean.courseId))
+                        .navigation();
+                break;
+        }
+
+    }
+
     private void initLiveCourse(List<HomeLiveAndVideoBean.CourseBean> liveList) {
         if (null == liveList || liveList.size() == 0) {
             mViewBinding.clLiveCourse.setVisibility(View.GONE);

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/HomeLiveAndVideoBean.java

@@ -100,6 +100,7 @@ public class HomeLiveAndVideoBean {
         public String status;
         public long teacherId;
         public String teacherName;
+        public String studentId;
 
     }
 }

+ 8 - 0
teacher/src/main/java/com/cooleshow/teacher/constants/CourseConstants.java

@@ -21,4 +21,12 @@ public class CourseConstants {
 
     public static final int COURSE_HOMEWORK_STU_SUBMIT = 1;//学员已提交课后作业
     public static final int COURSE_HOMEWORK_STU_NO_SUBMIT = 0;//学员未提交课后作业
+
+    public static final String LIVE_COURSE = "LIVE_COURSE";//直播课
+    public static final String OTHER_COURSE = "PRACTICE";//陪练课
+    public static final String PIANO_ROOM_COURSE = "PIANO_ROOM_CLASS";//琴房课
+
+    public static final String COURSE_ID = "course_id";
+    public static final String COURSE_GROUP_ID = "course_group_id";
+    public static final String STUDENT_ID = "student_id";
 }

+ 124 - 17
teacher/src/main/java/com/cooleshow/teacher/ui/main/HomeFragment.kt

@@ -1,5 +1,6 @@
 package com.cooleshow.teacher.ui.main
 
+import android.text.SpannableString
 import android.text.TextUtils
 import android.util.Log
 import android.view.View
@@ -10,9 +11,11 @@ import com.cooleshow.base.router.RouterPath
 import com.cooleshow.base.ui.fragment.BaseMVPFragment
 import com.cooleshow.base.utils.GlideUtils.loadImage
 import com.cooleshow.base.utils.TimeUtils
+import com.cooleshow.base.utils.UiUtils
 import com.cooleshow.base.utils.Utils
 import com.cooleshow.teacher.R
 import com.cooleshow.teacher.bean.*
+import com.cooleshow.teacher.constants.CourseConstants
 import com.cooleshow.teacher.constants.TeacherInfoConstants
 import com.cooleshow.teacher.contract.HomeContract
 import com.cooleshow.teacher.databinding.FragmentHomeLayoutBinding
@@ -211,17 +214,94 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
 
     override fun getHomeCountSuccess(data: HomeCountBean?) {
         if (data != null) {
-            mViewBinding.tvMineCourseCount.text = "本周剩余\n" + data.courseSchedule + "课时"
-            mViewBinding.tvAfterClassHomeworkCount.text = "本周共" + data.courseHomework + "节课\n未布置作业"
-            mViewBinding.tvAfterClassAssessCount.text =
-                "剩余" + data.courseScheduleReplied + "节\n尚未评价"
-            mViewBinding.tvMineMusicSheetCount.text = "共" + data.musicSheet + "支\n乐谱"
-            mViewBinding.tvMineAssessCount.text = "本周收到\n" + data.studentReplied + "个评价"
-            mViewBinding.tvMineIncomeCount.text = "本月收入\n" + data.decimal + "元"
-            mViewBinding.tvMineKotofusaCount.text = "剩余\n" + data.pianoTime + "分钟"
+            if (data.courseSchedule == 0) {
+                mViewBinding.tvMineCourseCount.text = "本周剩余\n0 课时"
+            } else {
+                mViewBinding.tvMineCourseCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "本周剩余\n",
+                        data.courseSchedule.toString() + " ",
+                        "课时"
+                    )
+            }
+            if (data.courseHomework == 0) {
+                mViewBinding.tvAfterClassHomeworkCount.text = "本周共 0 节课\n未布置作业"
+            } else {
+                mViewBinding.tvAfterClassHomeworkCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "本周共",
+                        " " + data.courseHomework + " ",
+                        "节课\n未布置作业"
+                    )
+            }
+            if (data.courseScheduleReplied == 0) {
+                mViewBinding.tvAfterClassAssessCount.text = "剩余 0 节\n尚未评价"
+            } else {
+                mViewBinding.tvAfterClassAssessCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "剩余",
+                        " " + data.courseScheduleReplied + " ",
+                        "节\n尚未评价"
+                    )
+            }
+            if (data.musicSheet == 0) {
+                mViewBinding.tvMineMusicSheetCount.text = "共 0 支\n乐谱"
+            } else {
+                mViewBinding.tvMineMusicSheetCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "共",
+                        " " + data.musicSheet + " ",
+                        "支\n乐谱"
+                    )
+            }
+            if (data.studentReplied == 0) {
+                mViewBinding.tvMineAssessCount.text = "本周收到\n0 个评价"
+            } else {
+                mViewBinding.tvMineAssessCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "本周收到\n",
+                        data.studentReplied.toString() + " ",
+                        "个评价"
+                    )
+
+            }
+            if (data.decimal == 0.00) {
+                mViewBinding.tvMineIncomeCount.text = "本月收入\n0.00 元"
+            } else {
+                mViewBinding.tvMineIncomeCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "本月收入\n",
+                        data.decimal.toString() + " ",
+                        "元"
+                    )
+            }
+            if (data.pianoTime == 0) {
+                mViewBinding.tvMineKotofusaCount.text = "剩余\n0 分钟"
+            } else {
+                mViewBinding.tvMineKotofusaCount.text =
+                    getRoomAuthorTextStyleSpan(
+                        "剩余\n",
+                        data.pianoTime.toString() + " ",
+                        "分钟"
+                    )
+            }
         }
     }
 
+    private fun getRoomAuthorTextStyleSpan(
+        firstText: String,
+        contentText: String,
+        lastText: String
+    ): SpannableString? {
+        return UiUtils.diffColorString(
+            firstText,
+            contentText,
+            lastText,
+            resources.getColor(com.cooleshow.base.R.color.color_999999),
+            resources.getColor(R.color.color_ff5160)
+        )
+    }
+
     private var noticeId: Long = 0
     override fun helpCenterContentListSuccess(data: HelpCenterContentBean?) {
 
@@ -251,25 +331,52 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
     override fun queryLiveAndVideoSuccess(bean: HomeLiveAndVideoBean?) {
         val recentCourses = bean?.recentCourses
         mViewBinding.clLive.setVisible(recentCourses != null)
-        if(recentCourses != null){
+        if (recentCourses != null) {
             mViewBinding.tvLiveTitle.setText(recentCourses.courseGroupName)
             mViewBinding.tvLiveTime.setText(recentCourses.courseStartTime)
             val currentTime = TimeUtils.date2String(Date(System.currentTimeMillis()), "yyyy-MM-dd")
-            val startTime = TimeUtils.date2String(TimeUtils.getDate(recentCourses.courseStartTime), "yyyy-MM-dd")
+            val startTime = TimeUtils.date2String(
+                TimeUtils.getDate(recentCourses.courseStartTime),
+                "yyyy-MM-dd"
+            )
             if (TextUtils.equals(currentTime, startTime)) {
-                val timeText = TimeUtils.date2String(TimeUtils.getDate(recentCourses.courseStartTime), "HH:mm")
+                val timeText =
+                    TimeUtils.date2String(TimeUtils.getDate(recentCourses.courseStartTime), "HH:mm")
                 mViewBinding.tvLiveTime.text = "今日 $timeText"
             } else {
-                mViewBinding.tvLiveTime.text = TimeUtils.date2String(TimeUtils.getDate(recentCourses.courseStartTime), "yyyy-MM-dd HH:mm")
+                mViewBinding.tvLiveTime.text = TimeUtils.date2String(
+                    TimeUtils.getDate(recentCourses.courseStartTime),
+                    "yyyy-MM-dd HH:mm"
+                )
             }
             mViewBinding.tvGoLive.setOnClickListener { v ->
-                //进入直播
+                gotoCourseDetail(recentCourses)
+            }
+        }
+    }
+
+    /**
+     * 跳转直播课详情页面
+     *
+     * @param bean
+     */
+    private fun gotoCourseDetail(bean: HomeLiveAndVideoBean.RecentCoursesBean?) {
+        when (bean?.courseType) {
+            CourseConstants.LIVE_COURSE -> ARouter.getInstance()
+                .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL, WebConstants.TEACHER_LIVE_DETAIL + "?groupId=" + bean.courseGroupId)
+                .navigation()
+            CourseConstants.OTHER_COURSE ->                 //陪练课
                 ARouter.getInstance().build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
-                    .withString(SparringCourseDetailActivity.COURSE_ID, recentCourses.courseId.toString())
-                    .withString(SparringCourseDetailActivity.COURSE_GROUP_ID, recentCourses.courseGroupId.toString())
-                    .withString(SparringCourseDetailActivity.STUDENT_ID, UserHelper.getUserId())
+                    .withString(CourseConstants.COURSE_ID, bean.courseId.toString())
+                    .withString(CourseConstants.COURSE_GROUP_ID, bean.courseGroupId.toString())
+                    .withString(CourseConstants.STUDENT_ID,bean.studentId.toString())
+                    .navigation()
+            CourseConstants.PIANO_ROOM_COURSE ->
+                //琴房课 跳转详情页
+                ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
+                    .withString(CourseConstants.COURSE_ID, bean.courseId.toString())
                     .navigation()
-            }
         }
     }
 

+ 1 - 1
teacher/src/main/java/com/cooleshow/teacher/widgets/CourseSetCommentDialog.java

@@ -75,7 +75,7 @@ public class CourseSetCommentDialog extends Dialog implements View.OnClickListen
         if (method == TYPE_SET_HOMEWORK) {
             //老师布置作业
             mViewBinding.tvTitle.setText("布置作业");
-            mViewBinding.etContent.setHint("请输入您输入本次课程需要布置的作业内容");
+            mViewBinding.etContent.setHint("请输入本次课程作业内容");
         }
         if (method == TYPE_SET_HOMEWORK_COMMENT) {
             //老师提交作业评价

+ 1 - 0
teacher/src/main/res/values/colors.xml

@@ -7,4 +7,5 @@
     <color name="teal_700">#FF018786</color>
     <color name="black">#FF000000</color>
     <color name="white">#FFFFFFFF</color>
+    <color name="color_ff5160">#FF5160</color>
 </resources>