Przeglądaj źródła

Merge remote-tracking branch 'origin/dev' into dev

邓琴文 3 lat temu
rodzic
commit
23b58f0d59
38 zmienionych plików z 1167 dodań i 27 usunięć
  1. 4 1
      BaseLibrary/src/main/java/com/cooleshow/base/presenter/BasePresenter.java
  2. 1 0
      BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt
  3. 2 2
      BaseLibrary/src/main/res/layout/common_toolbar_layout.xml
  4. 8 0
      student/src/main/java/com/cooleshow/student/adapter/CourseTableListAdapter.kt
  5. 11 6
      teacher/src/main/AndroidManifest.xml
  6. 41 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/CommonPagerAdapter.java
  7. 2 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/CourseTableListAdapter.kt
  8. 89 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/LiveListAdapter.java
  9. 21 0
      teacher/src/main/java/com/cooleshow/teacher/api/APIService.java
  10. 116 0
      teacher/src/main/java/com/cooleshow/teacher/bean/LiveListBean.java
  11. 33 0
      teacher/src/main/java/com/cooleshow/teacher/bean/LivePlayBackDataBean.java
  12. 1 1
      teacher/src/main/java/com/cooleshow/teacher/bean/TeacherUserInfo.java
  13. 24 0
      teacher/src/main/java/com/cooleshow/teacher/contract/LiveListContract.java
  14. 0 6
      teacher/src/main/java/com/cooleshow/teacher/presenter/live/CreateLivePresenter.java
  15. 86 0
      teacher/src/main/java/com/cooleshow/teacher/presenter/live/LiveListPresenter.java
  16. 15 7
      teacher/src/main/java/com/cooleshow/teacher/ui/course/MineLiveCourseActivity.java
  17. 110 0
      teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListActivity.java
  18. 216 0
      teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListFragment.java
  19. 2 1
      teacher/src/main/java/com/cooleshow/teacher/ui/main/MainActivity.java
  20. 1 3
      teacher/src/main/java/com/cooleshow/teacher/ui/main/MineFragment.java
  21. 79 0
      teacher/src/main/java/com/cooleshow/teacher/widgets/dialog/LivePlaybackDialog.java
  22. BIN
      teacher/src/main/res/drawable-xhdpi/bg_live_play_back.png
  23. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image1.png
  24. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image2.png
  25. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image3.png
  26. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image4.png
  27. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image5.png
  28. BIN
      teacher/src/main/res/drawable-xhdpi/icon_live_list_tag.png
  29. BIN
      teacher/src/main/res/drawable-xxhdpi/bg_live_play_back.png
  30. BIN
      teacher/src/main/res/drawable-xxhdpi/icon_live_list_tag.png
  31. 5 0
      teacher/src/main/res/drawable/shape_2dc7aa_22dp.xml
  32. 5 0
      teacher/src/main/res/drawable/shape_ff806f_22dp.xml
  33. 35 0
      teacher/src/main/res/layout/activity_live_list_layout.xml
  34. 51 0
      teacher/src/main/res/layout/dialog_live_play_back_layout.xml
  35. 23 0
      teacher/src/main/res/layout/fragment_live_list_on_layout.xml
  36. 138 0
      teacher/src/main/res/layout/item_live_list_layout.xml
  37. 32 0
      teacher/src/main/res/layout/item_live_playback_layout.xml
  38. 16 0
      usercenter/src/main/java/com/cooleshow/usercenter/helper/UserHelper.java

+ 4 - 1
BaseLibrary/src/main/java/com/cooleshow/base/presenter/BasePresenter.java

@@ -54,7 +54,10 @@ public class BasePresenter<V extends BaseView> implements IPresenter<V> {
     }
 
     public V getView() {
-        return viewRef.get();
+        if (viewRef != null) {
+            return viewRef.get();
+        }
+        return null;
     }
 
 

+ 1 - 0
BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt

@@ -26,6 +26,7 @@ object RouterPath {
             const val ACTIVITY_LIVE_ROOM = "/com/cooleshow/student/ui/live/LiveRoomActivity"
             const val ACTIVITY_LIVE_ROOM_TEACHER = "/teacher/ui/live/LiveRoomActivity"
             const val TEACHER_MINE_CREATE_COURSE = "/teacher/ui/live/CreateLiveActivity"
+            const val TEACHER_LIVE_LIST = "/teacher/ui/live/LiveListActivity"
         }
     }
 

+ 2 - 2
BaseLibrary/src/main/res/layout/common_toolbar_layout.xml

@@ -30,7 +30,7 @@
         android:layout_height="wrap_content"
         android:layout_centerInParent="true"
         android:layout_gravity="center"
-        android:textColor="@color/common_black"
+        android:textColor="@color/color_333333"
         android:textSize="@dimen/sp_18"
         android:textStyle="bold"
         tools:text="我的课程" />
@@ -63,7 +63,7 @@
         android:layout_marginRight="15dp"
         android:scaleType="centerCrop"
         android:text=""
-        android:textColor="@color/white"
+        android:textColor="@color/color_333333"
         android:textSize="15sp"
         android:visibility="gone"
         tools:text="右侧标题"

+ 8 - 0
student/src/main/java/com/cooleshow/student/adapter/CourseTableListAdapter.kt

@@ -89,6 +89,10 @@ class CourseTableListAdapter(layoutResId: Int) :
                 tvCourseStatusBt.setVisible(true)
                 tvCourseStatusBt.text = "进入教室"
                 baseViewHolder.setText(R.id.tv_course_status, "进行中")
+                baseViewHolder.setTextColor(
+                    R.id.tv_course_status,
+                    context.resources.getColor(com.cooleshow.base.R.color.color_2dc7aa)
+                )
                 tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_ing);
                 tvCourseStatusBt.setTextColor(context.resources.getColor(R.color.white))
 
@@ -107,6 +111,10 @@ class CourseTableListAdapter(layoutResId: Int) :
                     tvCourseStatusBt.text = "已评价"
                 }
                 baseViewHolder.setText(R.id.tv_course_status, "已结束")
+                baseViewHolder.setTextColor(
+                    R.id.tv_course_status,
+                    context.resources.getColor(com.cooleshow.base.R.color.color_999999)
+                )
                 tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_normal);
                 tvCourseStatusBt.setTextColor(context.resources.getColor(com.cooleshow.base.R.color.color_2dc7aa))
             }

+ 11 - 6
teacher/src/main/AndroidManifest.xml

@@ -63,8 +63,8 @@
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:exported="false"
             android:launchMode="singleTask"
-            android:windowSoftInputMode="adjustPan"
-            android:screenOrientation="portrait" />
+            android:screenOrientation="portrait"
+            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.splash.GuideActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
@@ -80,8 +80,8 @@
         <activity
             android:name=".ui.web.HtmlActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
-            android:windowSoftInputMode="adjustResize"
-            android:screenOrientation="portrait" />
+            android:screenOrientation="portrait"
+            android:windowSoftInputMode="adjustResize" />
         <activity
             android:name=".ui.web.HtmlHorizontalScreenActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
@@ -214,6 +214,12 @@
             android:name=".ui.live.CreateLiveActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:screenOrientation="portrait" />
+
+        <activity
+            android:name=".ui.live.LiveListActivity"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:screenOrientation="portrait" />
+
         <activity
             android:name=".ui.score.MineScoreActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
@@ -280,8 +286,7 @@
             android:exported="false"
             android:launchMode="singleTask"
             android:screenOrientation="portrait"
-            android:windowSoftInputMode="adjustNothing">
-        </activity> <!-- 分享开始 -->
+            android:windowSoftInputMode="adjustNothing"></activity> <!-- 分享开始 -->
         <activity
             android:name=".wxapi.WXEntryActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"

+ 41 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/CommonPagerAdapter.java

@@ -0,0 +1,41 @@
+package com.cooleshow.teacher.adapter;
+
+import java.util.List;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
+
+/**
+ * 创建日期:2022/5/23 10:53
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class CommonPagerAdapter extends FragmentPagerAdapter {
+
+    private List<String> titles;
+
+    private List<Fragment> fragments;
+
+    public CommonPagerAdapter(FragmentManager fm, List<Fragment> fragments, List<String> titles) {
+        super(fm);
+        this.titles = titles;
+        this.fragments = fragments;
+    }
+
+    @Override
+    public Fragment getItem(int position) {
+        return fragments != null && fragments.size() > position ? fragments.get(position) : null;
+    }
+
+    @Override
+    public int getCount() {
+        return fragments == null ? 0 : fragments.size();
+    }
+
+    @Override
+    public CharSequence getPageTitle(int position) {
+        return titles != null && titles.size() > position ? titles.get(position) : "";
+    }
+}

+ 2 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/CourseTableListAdapter.kt

@@ -94,6 +94,7 @@ class CourseTableListAdapter(layoutResId: Int) :
                 tvCourseStatusBt.setVisible(true)
                 tvCourseStatusBt.text = "进入教室"
                 baseViewHolder.setText(R.id.tv_course_status, "进行中")
+                baseViewHolder.setTextColor(R.id.tv_course_status, context.resources.getColor(com.cooleshow.base.R.color.color_2dc7aa))
                 tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_ing);
                 tvCourseStatusBt.setTextColor(context.resources.getColor(R.color.white))
 
@@ -112,6 +113,7 @@ class CourseTableListAdapter(layoutResId: Int) :
                     tvCourseStatusBt.text = "已评价"
                 }
                 baseViewHolder.setText(R.id.tv_course_status, "已结束")
+                baseViewHolder.setTextColor(R.id.tv_course_status, context.resources.getColor(com.cooleshow.base.R.color.color_999999))
                 tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_normal);
                 tvCourseStatusBt.setTextColor(context.resources.getColor(com.cooleshow.base.R.color.color_2dc7aa))
             }

+ 89 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/LiveListAdapter.java

@@ -0,0 +1,89 @@
+package com.cooleshow.teacher.adapter;
+
+import android.graphics.drawable.AnimationDrawable;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.module.BaseLoadMoreModule;
+import com.chad.library.adapter.base.module.LoadMoreModule;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.bean.LiveListBean;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+public class LiveListAdapter extends BaseQuickAdapter<LiveListBean.RowsBean, BaseViewHolder> implements LoadMoreModule {
+
+    private AnimationDrawable mEnterLiveAnim;
+
+    public LiveListAdapter() {
+        super(R.layout.item_live_list_layout);
+        addChildClickViewIds(R.id.ll_enter_live, R.id.tv_look_playback);
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder holder, LiveListBean.RowsBean rowsBean) {
+        //title
+        holder.setText(R.id.tv_title, rowsBean.roomTitle);
+        //直播内容
+        holder.setText(R.id.tv_des, rowsBean.liveRemark);
+        //结束时间
+        holder.setText(R.id.tv_end_time, "结束时间:" + rowsBean.liveEndTime);
+        LinearLayout ll_enter_live = holder.getView(R.id.ll_enter_live);
+        ImageView iv_enter_live = holder.getView(R.id.iv_enter_live);
+        TextView tv_look_playback = holder.getView(R.id.tv_look_playback);
+        if (rowsBean.liveState == 1) {
+            //已开始
+            ll_enter_live.setVisibility(View.VISIBLE);
+            tv_look_playback.setVisibility(View.INVISIBLE);
+            startEnterLiveAnim(iv_enter_live);
+        } else if (rowsBean.liveState == 2) {
+            //已结束
+            ll_enter_live.setVisibility(View.INVISIBLE);
+            tv_look_playback.setVisibility(View.VISIBLE);
+            iv_enter_live.clearAnimation();
+        } else {
+            ll_enter_live.setVisibility(View.INVISIBLE);
+            tv_look_playback.setVisibility(View.INVISIBLE);
+            iv_enter_live.clearAnimation();
+        }
+    }
+
+    /**
+     * 进入直播间动画
+     */
+    private void startEnterLiveAnim(ImageView targetView) {
+        if (targetView != null) {
+            targetView.setVisibility(View.VISIBLE);
+            if (mEnterLiveAnim == null) {
+                mEnterLiveAnim = new AnimationDrawable();
+                mEnterLiveAnim.addFrame(getContext().getDrawable(R.drawable.icon_home_live_image1), 200);
+                mEnterLiveAnim.addFrame(getContext().getDrawable(R.drawable.icon_home_live_image2), 200);
+                mEnterLiveAnim.addFrame(getContext().getDrawable(R.drawable.icon_home_live_image3), 200);
+                mEnterLiveAnim.addFrame(getContext().getDrawable(R.drawable.icon_home_live_image4), 200);
+                mEnterLiveAnim.addFrame(getContext().getDrawable(R.drawable.icon_home_live_image5), 200);
+            }
+            mEnterLiveAnim.setOneShot(false);
+            targetView.setImageDrawable(mEnterLiveAnim);
+            mEnterLiveAnim.start();
+        }
+    }
+
+    private void release() {
+        if (mEnterLiveAnim != null) {
+            mEnterLiveAnim.stop();
+        }
+    }
+
+    @NonNull
+    @Override
+    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
+        return new BaseLoadMoreModule(baseQuickAdapter);
+    }
+}

+ 21 - 0
teacher/src/main/java/com/cooleshow/teacher/api/APIService.java

@@ -3,6 +3,8 @@ package com.cooleshow.teacher.api;
 import com.common.im.bean.ContactRoomListBean;
 import com.cooleshow.base.data.net.BaseResponse;
 import com.cooleshow.teacher.bean.HomeLiveAndVideoBean;
+import com.cooleshow.teacher.bean.LiveListBean;
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
 import com.cooleshow.teacher.bean.request.AssignHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.CommentHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.LiveCourseEntry;
@@ -50,6 +52,7 @@ import com.cooleshow.teacher.bean.request.UnBindCardEntry;
 import com.cooleshow.usercenter.bean.SetDetailBean;
 import com.cooleshow.usercenter.bean.UserInfo;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -623,6 +626,24 @@ public interface APIService {
     @POST(TEACHER_GROUP + "liveRoom/createTempLiveRoom")
     Observable<BaseResponse<String>> createLiveRoom(@Body RequestBody body);
 
+
+    /**
+     * 获取直播间列表信息
+     *
+     * @return
+     */
+    @POST(TEACHER_GROUP + "liveRoom/queryPageRoom")
+    Observable<BaseResponse<LiveListBean>> getLiveListData(@Body RequestBody body);
+
+    /**
+     * 获取直播间列表信息
+     *
+     * @return
+     */
+    @GET(TEACHER_GROUP + "liveRoomVideo/queryVideo")
+    Observable<BaseResponse<ArrayList<LivePlayBackDataBean>>> getLivePlaybackData(@Query("roomUid") String  roomUid);
+
+
     /**
      * 查询直播房间信息
      *

+ 116 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/LiveListBean.java

@@ -0,0 +1,116 @@
+package com.cooleshow.teacher.bean;
+
+import java.util.List;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+public class LiveListBean {
+
+    /**
+     * footer : [{"courseGroupId":0,"courseId":0,"coverPic":"","createdBy":0,"createdTime":"","id":0,"liveEndTime":"","liveRemark":"","liveStartTime":"","liveState":0,"roomState":0,"roomTitle":"","roomUid":"","speakerId":0,"type":"","updatedBy":0,"updatedTime":""}]
+     * limit : 0
+     * nextPage : 0
+     * offset : 0
+     * pageNo : 0
+     * prePage : 0
+     * rows : [{"courseGroupId":0,"courseId":0,"coverPic":"","createdBy":0,"createdTime":"","id":0,"liveEndTime":"","liveRemark":"","liveStartTime":"","liveState":0,"roomState":0,"roomTitle":"","roomUid":"","speakerId":0,"type":"","updatedBy":0,"updatedTime":""}]
+     * statInfo : {}
+     * total : 0
+     * totalPage : 0
+     */
+
+    public int limit;
+    public int nextPage;
+    public int offset;
+    public int pageNo;
+    public int prePage;
+    public StatInfoBean statInfo;
+    public int total;
+    public int totalPage;
+    public List<FooterBean> footer;
+    public List<RowsBean> rows;
+
+    public static class StatInfoBean {
+    }
+
+    public static class FooterBean {
+        /**
+         * courseGroupId : 0
+         * courseId : 0
+         * coverPic :
+         * createdBy : 0
+         * createdTime :
+         * id : 0
+         * liveEndTime :
+         * liveRemark :
+         * liveStartTime :
+         * liveState : 0
+         * roomState : 0
+         * roomTitle :
+         * roomUid :
+         * speakerId : 0
+         * type :
+         * updatedBy : 0
+         * updatedTime :
+         */
+
+        public int courseGroupId;
+        public int courseId;
+        public String coverPic;
+        public int createdBy;
+        public String createdTime;
+        public int id;
+        public String liveEndTime;
+        public String liveRemark;
+        public String liveStartTime;
+        public int liveState;
+        public int roomState;
+        public String roomTitle;
+        public String roomUid;
+        public int speakerId;
+        public String type;
+        public int updatedBy;
+        public String updatedTime;
+    }
+
+    public static class RowsBean {
+        /**
+         * courseGroupId : 0
+         * courseId : 0
+         * coverPic :
+         * createdBy : 0
+         * createdTime :
+         * id : 0
+         * liveEndTime :
+         * liveRemark :
+         * liveStartTime :
+         * liveState : 0
+         * roomState : 0
+         * roomTitle :
+         * roomUid :
+         * speakerId : 0
+         * type :
+         * updatedBy : 0
+         * updatedTime :
+         */
+
+        public int courseGroupId;
+        public int courseId;
+        public String coverPic;
+        public int createdBy;
+        public String createdTime;
+        public int id;
+        public String liveEndTime;
+        public String liveRemark;
+        public String liveStartTime;
+        public int liveState;
+        public int roomState;
+        public String roomTitle;
+        public String roomUid;
+        public int speakerId;
+        public String type;
+        public int updatedBy;
+        public String updatedTime;
+    }
+}

+ 33 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/LivePlayBackDataBean.java

@@ -0,0 +1,33 @@
+package com.cooleshow.teacher.bean;
+
+import java.io.Serializable;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+public class LivePlayBackDataBean {
+
+    /**
+     * courseGroupId : 0
+     * courseId : 0
+     * createdTime :
+     * endTime :
+     * id : 0
+     * recordId :
+     * roomUid :
+     * startTime :
+     * type : 0
+     * url :
+     */
+
+    public int courseGroupId;
+    public int courseId;
+    public String createdTime;
+    public String endTime;
+    public int id;
+    public String recordId;
+    public String roomUid;
+    public String startTime;
+    public int type;
+    public String url;
+}

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

@@ -58,7 +58,7 @@ public class TeacherUserInfo implements Serializable {
     public String idCardNo;
     public String gender;
     public int isReal;
-    public int liveFlag;
+    public int liveFlag;//是否有直播权限 0 否 1 是
     public int isBank;
     public String heardUrl;
     public String entryStatus;

+ 24 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/LiveListContract.java

@@ -0,0 +1,24 @@
+package com.cooleshow.teacher.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.teacher.bean.LiveListBean;
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
+
+import java.util.ArrayList;
+
+/**
+ * 创建日期:2022/5/20 15:02
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public interface LiveListContract {
+    interface LiveListView extends BaseView {
+        void getListDataSuccess(int page, LiveListBean liveListBean);
+
+        void getPlaybackDataSuccess(ArrayList<LivePlayBackDataBean> datas);
+    }
+
+    interface Presenter {
+    }
+}

+ 0 - 6
teacher/src/main/java/com/cooleshow/teacher/presenter/live/CreateLivePresenter.java

@@ -48,17 +48,11 @@ public class CreateLivePresenter extends BasePresenter<CreateLiveContract.Create
             @Override
             public void onComplete() {
                 super.onComplete();
-                if (getView() != null) {
-                    getView().hideLoading();
-                }
             }
 
             @Override
             public void onError(Throwable e) {
                 super.onError(e);
-                if (e instanceof ApiException) {
-                    ErrorParse.getInstance().parseError(e);
-                }
             }
         });
     }

+ 86 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/live/LiveListPresenter.java

@@ -0,0 +1,86 @@
+package com.cooleshow.teacher.presenter.live;
+
+import com.cooleshow.base.constanst.Constants;
+import com.cooleshow.base.data.net.ApiException;
+import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.ErrorParse;
+import com.cooleshow.base.utils.RequestBodyUtil;
+import com.cooleshow.teacher.api.APIService;
+import com.cooleshow.teacher.bean.LiveListBean;
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
+import com.cooleshow.teacher.contract.LiveListContract;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+public class LiveListPresenter extends BasePresenter<LiveListContract.LiveListView> implements LiveListContract.Presenter {
+
+    /**
+     * 获取直播间列表数据
+     *
+     * @param liveState
+     * @param page
+     */
+    public void getLiveListData(boolean isShowLoading, String liveState, int page) {
+        if (isShowLoading && getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("liveState", liveState);
+            jsonObject.putOpt("page", page);
+            jsonObject.putOpt("rows", Constants.DEFAULT_DATA_SIZE);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        addSubscribe(create(APIService.class).getLiveListData(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<LiveListBean>(getView()) {
+            @Override
+            protected void onSuccess(LiveListBean data) {
+                if (getView() != null) {
+                    getView().getListDataSuccess(page, data);
+                }
+            }
+
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+
+
+    /**
+     * 获取直播回放数据
+     *
+     * @param roomUid
+     */
+    public void getLivePlaybackData(String roomUid) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        addSubscribe(create(APIService.class).getLivePlaybackData(roomUid), new BaseObserver<ArrayList<LivePlayBackDataBean>>(getView()) {
+            @Override
+            protected void onSuccess(ArrayList<LivePlayBackDataBean> data) {
+                if (getView() != null) {
+                    getView().getPlaybackDataSuccess(data);
+                }
+            }
+
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+
+}

+ 15 - 7
teacher/src/main/java/com/cooleshow/teacher/ui/course/MineLiveCourseActivity.java

@@ -12,10 +12,12 @@ import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.adapter.MineLiveCoursePagerAdapter;
 import com.cooleshow.teacher.databinding.ActivityMineLiveCourseBinding;
 import com.cooleshow.teacher.presenter.course.MineLiveCoursePresenter;
+import com.cooleshow.usercenter.helper.UserHelper;
 import com.google.android.material.tabs.TabLayout;
 
 import java.util.ArrayList;
@@ -36,9 +38,11 @@ public class MineLiveCourseActivity extends BaseMVPActivity<ActivityMineLiveCour
     public void onClick(View view) {
         switch (view.getId()) {
             case R.id.tv_right_text:
-               /* ARouter.getInstance().build(RouterPath.CourseCenter.TEACHER_MINE_CREATE_LIVE_COURSE_INFO)
-                        .navigation();*/
-
+                int teacherLiveFlag = UserHelper.getTeacherLiveFlag();
+                if (teacherLiveFlag == 0) {
+                    ToastUtil.getInstance().showShort("您还未开通直播权限,开通后才可创建\n直播课哦");
+                    return;
+                }
                 ARouter.getInstance()
                         .build(RouterPath.WebCenter.ACTIVITY_HTML)
                         .withString(WebConstants.WEB_URL, WebConstants.TEACHER_LIVE_CREATE)
@@ -46,8 +50,10 @@ public class MineLiveCourseActivity extends BaseMVPActivity<ActivityMineLiveCour
                 break;
         }
     }
+
     private TabLayout tabLayout;
     private ViewPager viewPager;
+
     @Override
     protected void initView() {
         initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "直播课");
@@ -55,24 +61,26 @@ public class MineLiveCourseActivity extends BaseMVPActivity<ActivityMineLiveCour
         viewBinding.toolbarInclude.tvRightText.setVisibility(View.VISIBLE);
         viewBinding.toolbarInclude.tvRightText.setText("创建课程");
         viewBinding.toolbarInclude.tvRightText.setOnClickListener(this);
-        tabLayout=viewBinding.tablayout;
-        viewPager=viewBinding.viewpager;
+        tabLayout = viewBinding.tablayout;
+        viewPager = viewBinding.viewpager;
         viewPager.setCurrentItem(0);
 
     }
+
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         StatusBarUtil.setStatusBarDarkTheme(this, true);
     }
+
     @Override
     public void initData() {
         super.initData();
         initTabLayoutAndViewPager();
     }
 
-    private List<String> titles = new ArrayList<String>(Arrays.asList("进行中","未上架","销售中","已完成","已取消"));
-    private List<String> types = new ArrayList<String>(Arrays.asList("ING","NOT_SALE","APPLY","COMPLETE","CANCEL"));
+    private List<String> titles = new ArrayList<String>(Arrays.asList("进行中", "未上架", "销售中", "已完成", "已取消"));
+    private List<String> types = new ArrayList<String>(Arrays.asList("ING", "NOT_SALE", "APPLY", "COMPLETE", "CANCEL"));
     private List<Fragment> fragments = new ArrayList<>();
 
     private void initTabLayoutAndViewPager() {

+ 110 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListActivity.java

@@ -0,0 +1,110 @@
+package com.cooleshow.teacher.ui.live;
+
+import android.os.Bundle;
+import android.view.View;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.base.ui.activity.BaseActivity;
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.CommonPagerAdapter;
+import com.cooleshow.teacher.adapter.HomeWorkPagerAdapter;
+import com.cooleshow.teacher.bean.LiveListBean;
+import com.cooleshow.teacher.contract.LiveListContract;
+import com.cooleshow.teacher.databinding.ActivityLiveListLayoutBinding;
+import com.cooleshow.teacher.presenter.live.LiveListPresenter;
+import com.cooleshow.teacher.ui.work.HomeWorkFragment;
+import com.google.android.material.tabs.TabLayout;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.viewpager.widget.ViewPager;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+@Route(path = RouterPath.LiveCenter.TEACHER_LIVE_LIST)
+public class LiveListActivity extends BaseActivity<ActivityLiveListLayoutBinding> implements View.OnClickListener {
+    private static final String[] TITLES = new String[]{"直播中", "已结束"};
+    private static final String[] LIVE_STATUS = new String[]{"1", "2"};// 0未开始 1已开始 2已结束
+    private TabLayout tabLayout;
+    private ViewPager viewPager;
+    private ArrayList<Fragment> fragments = new ArrayList<>();
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
+    @Override
+    protected void initView() {
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "课后作业");
+        viewBinding.toolbarInclude.tvRightText.setVisibility(View.VISIBLE);
+        viewBinding.toolbarInclude.tvRightText.setText("创建直播");
+        viewBinding.toolbarInclude.tvRightText.setOnClickListener(this);
+        tabLayout = viewBinding.tablayout;
+        viewPager = viewBinding.viewpager;
+        viewPager.setCurrentItem(0);
+    }
+
+    @Override
+    public void initData() {
+        super.initData();
+        initTabLayoutAndViewPager();
+    }
+
+    private void initTabLayoutAndViewPager() {
+        tabLayout.removeAllTabs();
+        fragments.clear();
+        for (int i = 0; i < TITLES.length; i++) {
+            tabLayout.addTab(tabLayout.newTab().setText(TITLES[i]));
+            LiveListFragment liveListFragment = LiveListFragment.newInstance(LIVE_STATUS[i]);
+            fragments.add(liveListFragment);
+        }
+        List<String> titles = Arrays.asList(TITLES);
+        viewPager.setAdapter(new CommonPagerAdapter(getSupportFragmentManager(), fragments, titles));
+        tabLayout.setupWithViewPager(viewPager);
+
+        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+//                HomeWorkFragment fragment = (HomeWorkFragment) fragments.get(position);
+//                if (fragment != null) {
+//                    fragment.queryCourse(false);
+//                }
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+
+            }
+        });
+    }
+
+    @Override
+    protected ActivityLiveListLayoutBinding getLayoutView() {
+        return ActivityLiveListLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == com.cooleshow.base.R.id.tv_right_text) {
+            ARouter.getInstance().build(RouterPath.LiveCenter.TEACHER_MINE_CREATE_COURSE)
+                    .navigation();
+        }
+    }
+}

+ 216 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListFragment.java

@@ -0,0 +1,216 @@
+package com.cooleshow.teacher.ui.live;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.listener.OnItemChildClickListener;
+import com.chad.library.adapter.base.listener.OnLoadMoreListener;
+import com.cooleshow.base.constanst.Constants;
+import com.cooleshow.base.ui.fragment.BaseFragment;
+import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.ToastUtil;
+import com.cooleshow.base.widgets.EmptyViewLayout;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.LiveListAdapter;
+import com.cooleshow.teacher.bean.LiveListBean;
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
+import com.cooleshow.teacher.contract.LiveListContract;
+import com.cooleshow.teacher.databinding.FragmentLiveListOnLayoutBinding;
+import com.cooleshow.teacher.presenter.live.LiveListPresenter;
+import com.cooleshow.teacher.ui.work.HomeWorkFragment;
+import com.cooleshow.teacher.widgets.dialog.LivePlaybackDialog;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ * 直播中
+ */
+public class LiveListFragment extends BaseMVPFragment<FragmentLiveListOnLayoutBinding, LiveListPresenter> implements LiveListContract.LiveListView {
+    public static final String LIVE_STATUS_TAG_KEY = "live_status_tag_key";
+    private String mLiveTag;
+    private int currentPage = 1;
+    private LiveListAdapter mLiveListAdapter;
+    private boolean hasNext = true;
+    private EmptyViewLayout mEmptyView;
+    private LivePlaybackDialog mLivePlaybackDialog;
+
+    public static LiveListFragment newInstance(String liveStatusTag) {
+        Bundle args = new Bundle();
+        LiveListFragment liveListFragment = new LiveListFragment();
+        args.putString(LIVE_STATUS_TAG_KEY, liveStatusTag);
+        liveListFragment.setArguments(args);
+        return liveListFragment;
+    }
+
+    @Override
+    protected FragmentLiveListOnLayoutBinding getLayoutView() {
+        return FragmentLiveListOnLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected LiveListPresenter createPresenter() {
+        return new LiveListPresenter();
+    }
+
+    @Override
+    protected void initView(View rootView) {
+        if (getArguments() != null) {
+            mLiveTag = getArguments().getString(LIVE_STATUS_TAG_KEY);
+        }
+
+    }
+
+    @Override
+    protected void initData() {
+        mLiveListAdapter = new LiveListAdapter();
+        setEmptyView();
+        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+        mViewBinding.recyclerView.setAdapter(mLiveListAdapter);
+
+
+        mLiveListAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
+            @Override
+            public void onItemChildClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
+                if (position < mLiveListAdapter.getData().size()) {
+                    LiveListBean.RowsBean rowsBean = mLiveListAdapter.getData().get(position);
+                    if (view.getId() == R.id.ll_enter_live) {
+                        //进入直播间
+                        TeacherLiveRoomActivity.start(getContext(), rowsBean.roomUid);
+                        return;
+                    }
+                    if (view.getId() == R.id.tv_look_playback) {
+                        //查看回放
+                        getLivePlaybackData(rowsBean.roomUid);
+                        return;
+                    }
+                }
+            }
+        });
+
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                getData(true);
+            }
+        });
+        mLiveListAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
+            @Override
+            public void onLoadMore() {
+                //上拉加载
+                if (hasNext) {
+                    currentPage++;
+                    getData(false);
+                } else {
+                    mLiveListAdapter.getLoadMoreModule().loadMoreEnd();
+                }
+            }
+        });
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        getData(true);
+    }
+
+    private void showPlayBackDialog(ArrayList<LivePlayBackDataBean> datas) {
+        if (mLivePlaybackDialog == null) {
+            mLivePlaybackDialog = new LivePlaybackDialog(getContext());
+        }
+        if (!mLivePlaybackDialog.isShowing()) {
+            mLivePlaybackDialog.show();
+            mLivePlaybackDialog.setData(datas);
+        }
+    }
+
+    private void getData(boolean isShowLoading) {
+        if (presenter != null) {
+            presenter.getLiveListData(isShowLoading, mLiveTag, currentPage);
+        }
+    }
+
+    private void getLivePlaybackData(String roomId) {
+        if (TextUtils.isEmpty(roomId)) {
+            return;
+        }
+        if (presenter != null) {
+            presenter.getLivePlaybackData(roomId);
+        }
+    }
+
+    @Override
+    public void getListDataSuccess(int page, LiveListBean liveListBean) {
+        if (isDetached()) {
+            return;
+        }
+        if (liveListBean != null) {
+            if (page == 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mLiveListAdapter != null) {
+                    mLiveListAdapter.getData().clear();
+                    mLiveListAdapter.notifyDataSetChanged();
+                    if (liveListBean.rows != null && liveListBean.rows.size() > 0) {
+                        checkHasNext(liveListBean.rows.size());
+                        mLiveListAdapter.setNewInstance(liveListBean.rows);
+                    }
+                }
+            } else {
+                //加载更多
+                if (mLiveListAdapter != null) {
+                    if (liveListBean.rows != null && liveListBean.rows.size() > 0) {
+                        mLiveListAdapter.getLoadMoreModule().loadMoreComplete();
+                        checkHasNext(liveListBean.rows.size());
+                        mLiveListAdapter.addData(liveListBean.rows);
+                    } else {
+                        mLiveListAdapter.getLoadMoreModule().loadMoreEnd();
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void getPlaybackDataSuccess(ArrayList<LivePlayBackDataBean> datas) {
+        if (isDetached()) {
+            return;
+        }
+        if (datas != null && datas.size() > 0) {
+            showPlayBackDialog(datas);
+        } else {
+            ToastUtil.getInstance().showShort("暂无回放");
+        }
+    }
+
+
+    /**
+     * 显示空视图
+     */
+    private void setEmptyView() {
+        if (mEmptyView == null) {
+            mEmptyView = new EmptyViewLayout(getContext());
+        }
+        mEmptyView.setContent(com.cooleshow.base.R.drawable.icon_empty_content, "暂无内容~");
+        mLiveListAdapter.setEmptyView(mEmptyView);
+    }
+
+
+    /**
+     * 检查是否还有下一页
+     *
+     * @param dataSize
+     */
+    private void checkHasNext(int dataSize) {
+        hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
+    }
+}

+ 2 - 1
teacher/src/main/java/com/cooleshow/teacher/ui/main/MainActivity.java

@@ -276,8 +276,9 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
         if (isFinishing() || isDestroyed()) {
             return;
         }
-        //save老师认证状态
+        //save老师认证状态和开通直播状态
         UserHelper.saveTeacherCertificationStatus(teacherUserInfo.entryStatus);
+        UserHelper.saveTeacherOpenLiveFlag(teacherUserInfo.liveFlag);
         if (mHomeFragment != null) {
             mHomeFragment.getTeacherInfoSuccess(teacherUserInfo);
         }

+ 1 - 3
teacher/src/main/java/com/cooleshow/teacher/ui/main/MineFragment.java

@@ -220,8 +220,6 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                         .navigation();
 
 //                支付测试
-            /*   ARouter.getInstance().build(RouterPath.MineCenter.MINE_PAY_TEST)
-                        .navigation();*/
                 break;
             case R.id.tv_authentication:
                 //银行卡
@@ -235,7 +233,7 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                             .withString(WebConstants.WEB_URL, WebConstants.TEACHER_OPEN_LIVE)
                             .navigation();
                 } else {
-                    ARouter.getInstance().build(RouterPath.LiveCenter.TEACHER_MINE_CREATE_COURSE)
+                    ARouter.getInstance().build(RouterPath.LiveCenter.TEACHER_LIVE_LIST)
                             .navigation();
                 }
 

+ 79 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/dialog/LivePlaybackDialog.java

@@ -0,0 +1,79 @@
+package com.cooleshow.teacher.widgets.dialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.listener.OnItemClickListener;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.ui.video.VideoPlayActivity;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.base.utils.SizeUtils;
+import com.cooleshow.base.utils.UiUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.bean.LivePlayBackDataBean;
+import com.cooleshow.teacher.widgets.VideoCourseListItemDecoration;
+
+import java.util.ArrayList;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Size;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * Author by pq, Date on 2022/7/7.
+ */
+public class LivePlaybackDialog extends Dialog {
+
+    private Adapter mAdapter;
+
+    public LivePlaybackDialog(@NonNull Context context) {
+        super(context, com.cooleshow.base.R.style.DialogStyle);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.dialog_live_play_back_layout);
+        RecyclerView recyclerView = findViewById(R.id.recyclerView);
+        GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
+        VideoCourseListItemDecoration itemDecoration = new VideoCourseListItemDecoration(SizeUtils.dp2px(9), 0, 0, 0, SizeUtils.dp2px(7));
+        recyclerView.addItemDecoration(itemDecoration);
+        recyclerView.setLayoutManager(gridLayoutManager);
+        mAdapter = new Adapter(R.layout.item_live_playback_layout);
+        recyclerView.setAdapter(mAdapter);
+        mAdapter.setOnItemClickListener(new OnItemClickListener() {
+            @Override
+            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
+                if (position < mAdapter.getData().size()) {
+                    LivePlayBackDataBean livePlayBackDataBean = mAdapter.getData().get(position);
+                    VideoPlayActivity.start(getContext(), livePlayBackDataBean.url);
+                }
+            }
+        });
+    }
+
+    public void setData(ArrayList<LivePlayBackDataBean> datas) {
+        if (mAdapter != null) {
+            mAdapter.setNewInstance(datas);
+        }
+    }
+
+    private class Adapter extends BaseQuickAdapter<LivePlayBackDataBean, BaseViewHolder> {
+
+        public Adapter(int layoutResId) {
+            super(layoutResId);
+        }
+
+        @Override
+        protected void convert(@NonNull BaseViewHolder holder, LivePlayBackDataBean livePlayBackDataBean) {
+            ImageView iv_bg = holder.getView(R.id.iv_bg);
+            GlideUtils.INSTANCE.loadVideoThumbnail(getContext(), livePlayBackDataBean.url, iv_bg);
+            holder.setText(R.id.tv_time, UiUtils.getCourseTimeString(livePlayBackDataBean.startTime, livePlayBackDataBean.endTime));
+        }
+    }
+}

BIN
teacher/src/main/res/drawable-xhdpi/bg_live_play_back.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_home_live_image1.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_home_live_image2.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_home_live_image3.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_home_live_image4.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_home_live_image5.png


BIN
teacher/src/main/res/drawable-xhdpi/icon_live_list_tag.png


BIN
teacher/src/main/res/drawable-xxhdpi/bg_live_play_back.png


BIN
teacher/src/main/res/drawable-xxhdpi/icon_live_list_tag.png


+ 5 - 0
teacher/src/main/res/drawable/shape_2dc7aa_22dp.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/color_2dc7aa" />
+    <corners android:radius="22dp" />
+</shape>

+ 5 - 0
teacher/src/main/res/drawable/shape_ff806f_22dp.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/color_FF806F" />
+    <corners android:radius="22dp" />
+</shape>

+ 35 - 0
teacher/src/main/res/layout/activity_live_list_layout.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <include
+        android:id="@+id/toolbar_include"
+        layout="@layout/common_toolbar_layout" />
+
+    <com.google.android.material.tabs.TabLayout
+        android:id="@+id/tablayout"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/dp_44"
+        android:scrollbars="none"
+        app:tabBackground="@null"
+        app:tabGravity="fill"
+        app:tabIndicator="@drawable/tab_indicator"
+        app:tabIndicatorColor="@color/color_2dc7aa"
+        app:tabIndicatorFullWidth="false"
+        app:tabIndicatorHeight="4dp"
+        app:tabMode="fixed"
+        app:tabRippleColor="@null"
+        app:tabSelectedTextColor="@color/black_333"
+        app:tabTextAppearance="@style/tab_layout_style"
+        app:tabTextColor="@color/color_666666" />
+
+    <androidx.viewpager.widget.ViewPager
+        android:id="@+id/viewpager"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:overScrollMode="never"
+        android:scrollbars="none" />
+</LinearLayout>

+ 51 - 0
teacher/src/main/res/layout/dialog_live_play_back_layout.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="300dp"
+    android:background="@drawable/bg_white_5dp"
+    android:orientation="vertical">
+
+    <ImageView
+        android:id="@+id/iv_icon"
+        android:layout_width="4dp"
+        android:layout_height="@dimen/dp_18"
+        android:layout_marginStart="@dimen/dp_20"
+        android:layout_marginTop="@dimen/dp_24"
+        android:background="@drawable/btn_green_stu_line_shape"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_title"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/dp_7"
+        android:layout_marginEnd="@dimen/dp_16"
+        android:text="确定退课吗?"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/dp_18"
+        android:textStyle="bold"
+        app:layout_constraintBottom_toBottomOf="@id/iv_icon"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/iv_icon"
+        app:layout_constraintTop_toTopOf="@+id/iv_icon" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/recyclerView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/dp_15"
+        android:background="@color/white"
+        android:overScrollMode="never"
+        android:scrollbars="none"
+        android:visibility="visible"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_title"
+        app:layout_goneMarginTop="@dimen/dp_15" />
+
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 23 - 0
teacher/src/main/res/layout/fragment_live_list_on_layout.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <com.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <com.scwang.smart.refresh.header.ClassicsHeader
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:overScrollMode="never"
+            android:scrollbars="none" />
+    </com.scwang.smart.refresh.layout.SmartRefreshLayout>
+</FrameLayout>

+ 138 - 0
teacher/src/main/res/layout/item_live_list_layout.xml

@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="14dp"
+    android:layout_marginTop="15dp"
+    android:layout_marginEnd="14dp"
+    android:background="@drawable/bg_white_10dp"
+    android:paddingStart="11dp"
+    android:paddingEnd="11dp">
+
+    <ImageView
+        android:id="@+id/iv_tag"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="21dp"
+        android:src="@drawable/icon_live_list_tag"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_16"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_tag"
+        app:layout_constraintLeft_toRightOf="@+id/iv_tag"
+        app:layout_constraintTop_toTopOf="@+id/iv_tag"
+        tools:text="如何培养孩子练习的兴趣和效率" />
+
+    <TextView
+        android:id="@+id/tv_des"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="2"
+        android:textColor="@color/color_666666"
+        android:textSize="@dimen/sp_13"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/iv_tag"
+        tools:text="如何让孩子在家养成良好的器乐练习习惯" />
+
+    <View
+        android:id="@+id/view_line"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:layout_marginTop="11dp"
+        android:background="@color/color_f2f2f2"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_des" />
+
+    <TextView
+        android:gravity="center_vertical"
+        android:id="@+id/tv_end_time"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="5dp"
+        android:drawableLeft="@drawable/icon_clock"
+        android:drawablePadding="5dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="2"
+        android:paddingTop="15dp"
+        android:paddingBottom="15dp"
+        android:textColor="@color/color_666666"
+        android:textSize="@dimen/sp_13"
+        app:layout_constraintBottom_toBottomOf="@+id/ll_enter_live"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@+id/ll_enter_live"
+        app:layout_constraintTop_toTopOf="@+id/ll_enter_live"
+        tools:text="结束时间:2021/09/17 14:00" />
+
+
+    <LinearLayout
+        android:id="@+id/ll_enter_live"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="18dp"
+        android:layout_marginBottom="18dp"
+        android:background="@drawable/shape_ff806f_22dp"
+        android:gravity="center"
+        android:orientation="horizontal"
+        android:paddingStart="8dp"
+        android:paddingTop="5dp"
+        android:paddingEnd="8dp"
+        android:paddingBottom="5dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/view_line">
+
+        <ImageView
+            android:id="@+id/iv_enter_live"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/icon_home_live_image1"
+            app:layout_constraintBottom_toBottomOf="@+id/tv_enter_live"
+            app:layout_constraintHorizontal_chainStyle="packed"
+            app:layout_constraintRight_toLeftOf="@+id/tv_enter_live"
+            app:layout_constraintTop_toTopOf="@+id/tv_enter_live" />
+
+        <TextView
+            android:id="@+id/tv_enter_live"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:includeFontPadding="false"
+            android:paddingStart="2dp"
+            android:text="进入直播"
+            android:textColor="@color/white"
+            android:textSize="@dimen/sp_13" />
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/tv_look_playback"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="@drawable/shape_2dc7aa_22dp"
+        android:gravity="center"
+        android:text="查看回放"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_13"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="@+id/ll_enter_live"
+        app:layout_constraintLeft_toLeftOf="@+id/ll_enter_live"
+        app:layout_constraintRight_toRightOf="@+id/ll_enter_live"
+        app:layout_constraintTop_toTopOf="@+id/ll_enter_live" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 32 - 0
teacher/src/main/res/layout/item_live_playback_layout.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <ImageView
+        android:id="@+id/iv_bg"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:adjustViewBounds="true"
+        android:src="@drawable/bg_live_play_back"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:includeFontPadding="false"
+        android:paddingTop="10dp"
+        android:paddingBottom="10dp"
+        android:textColor="@color/color_666666"
+        android:textSize="@dimen/sp_11"
+        app:layout_constraintLeft_toLeftOf="@+id/iv_bg"
+        app:layout_constraintRight_toRightOf="@+id/iv_bg"
+        app:layout_constraintTop_toBottomOf="@+id/iv_bg"
+        tools:text="2022/06/30 16:00-16:20" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 16 - 0
usercenter/src/main/java/com/cooleshow/usercenter/helper/UserHelper.java

@@ -20,6 +20,7 @@ public class UserHelper {
     public static final String USER_PHONE = "phone";
     public static final String USER_AVATAR = "avatar";
     public static final String TEACHER_CERT_STATUS = "teacherCert";
+    public static final String TEACHER_LIVE_FLAG_STATUS = "teacherLiveFlag";
 
     public static boolean isLogin() {
         return !TextUtils.isEmpty(getUserToken());
@@ -66,6 +67,21 @@ public class UserHelper {
         return SPUtils.getInstance().getString(TEACHER_CERT_STATUS + "_" + getUserId());
     }
 
+    /**
+     * 老师直播权限状态
+     */
+    public static void saveTeacherOpenLiveFlag(int status) {
+        SPUtils.getInstance().put(TEACHER_LIVE_FLAG_STATUS + "_" + getUserId(), status);
+    }
+
+    /**
+     * 老师直播权限状态
+     */
+    public static int getTeacherLiveFlag() {
+        return SPUtils.getInstance().getInt(TEACHER_LIVE_FLAG_STATUS + "_" + getUserId(),0);
+    }
+
+
     public static void saveUserInfo(UserInfo userInfo) {
         if (userInfo == null) {
             return;