Browse Source

增加我的直播间列表

Pq 3 years ago
parent
commit
8f5d71f584
26 changed files with 843 additions and 18 deletions
  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. 11 6
      teacher/src/main/AndroidManifest.xml
  5. 41 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/CommonPagerAdapter.java
  6. 89 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/LiveListAdapter.java
  7. 10 0
      teacher/src/main/java/com/cooleshow/teacher/api/APIService.java
  8. 116 0
      teacher/src/main/java/com/cooleshow/teacher/bean/LiveListBean.java
  9. 19 0
      teacher/src/main/java/com/cooleshow/teacher/contract/LiveListContract.java
  10. 0 6
      teacher/src/main/java/com/cooleshow/teacher/presenter/live/CreateLivePresenter.java
  11. 55 0
      teacher/src/main/java/com/cooleshow/teacher/presenter/live/LiveListPresenter.java
  12. 110 0
      teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListActivity.java
  13. 178 0
      teacher/src/main/java/com/cooleshow/teacher/ui/live/LiveListFragment.java
  14. 1 3
      teacher/src/main/java/com/cooleshow/teacher/ui/main/MineFragment.java
  15. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image1.png
  16. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image2.png
  17. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image3.png
  18. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image4.png
  19. BIN
      teacher/src/main/res/drawable-xhdpi/icon_home_live_image5.png
  20. BIN
      teacher/src/main/res/drawable-xhdpi/icon_live_list_tag.png
  21. BIN
      teacher/src/main/res/drawable-xxhdpi/icon_live_list_tag.png
  22. 5 0
      teacher/src/main/res/drawable/shape_2dc7aa_22dp.xml
  23. 5 0
      teacher/src/main/res/drawable/shape_ff806f_22dp.xml
  24. 35 0
      teacher/src/main/res/layout/activity_live_list_layout.xml
  25. 23 0
      teacher/src/main/res/layout/fragment_live_list_on_layout.xml
  26. 138 0
      teacher/src/main/res/layout/item_live_list_layout.xml

+ 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() {
     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 = "/com/cooleshow/student/ui/live/LiveRoomActivity"
             const val ACTIVITY_LIVE_ROOM_TEACHER = "/teacher/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_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_height="wrap_content"
         android:layout_centerInParent="true"
         android:layout_centerInParent="true"
         android:layout_gravity="center"
         android:layout_gravity="center"
-        android:textColor="@color/common_black"
+        android:textColor="@color/color_333333"
         android:textSize="@dimen/sp_18"
         android:textSize="@dimen/sp_18"
         android:textStyle="bold"
         android:textStyle="bold"
         tools:text="我的课程" />
         tools:text="我的课程" />
@@ -63,7 +63,7 @@
         android:layout_marginRight="15dp"
         android:layout_marginRight="15dp"
         android:scaleType="centerCrop"
         android:scaleType="centerCrop"
         android:text=""
         android:text=""
-        android:textColor="@color/white"
+        android:textColor="@color/color_333333"
         android:textSize="15sp"
         android:textSize="15sp"
         android:visibility="gone"
         android:visibility="gone"
         tools:text="右侧标题"
         tools:text="右侧标题"

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

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

+ 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);
+    }
+}

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

@@ -3,6 +3,7 @@ package com.cooleshow.teacher.api;
 import com.common.im.bean.ContactRoomListBean;
 import com.common.im.bean.ContactRoomListBean;
 import com.cooleshow.base.data.net.BaseResponse;
 import com.cooleshow.base.data.net.BaseResponse;
 import com.cooleshow.teacher.bean.HomeLiveAndVideoBean;
 import com.cooleshow.teacher.bean.HomeLiveAndVideoBean;
+import com.cooleshow.teacher.bean.LiveListBean;
 import com.cooleshow.teacher.bean.request.AssignHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.AssignHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.CommentHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.CommentHomeWorkEntry;
 import com.cooleshow.teacher.bean.request.LiveCourseEntry;
 import com.cooleshow.teacher.bean.request.LiveCourseEntry;
@@ -623,6 +624,15 @@ public interface APIService {
     @POST(TEACHER_GROUP + "liveRoom/createTempLiveRoom")
     @POST(TEACHER_GROUP + "liveRoom/createTempLiveRoom")
     Observable<BaseResponse<String>> createLiveRoom(@Body RequestBody body);
     Observable<BaseResponse<String>> createLiveRoom(@Body RequestBody body);
 
 
+
+    /**
+     * 获取直播间列表信息
+     *
+     * @return
+     */
+    @POST(TEACHER_GROUP + "liveRoom/queryPageRoom")
+    Observable<BaseResponse<LiveListBean>> getLiveListData(@Body RequestBody body);
+
     /**
     /**
      * 查询直播房间信息
      * 查询直播房间信息
      *
      *

+ 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;
+    }
+}

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

@@ -0,0 +1,19 @@
+package com.cooleshow.teacher.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.teacher.bean.LiveListBean;
+
+/**
+ * 创建日期:2022/5/20 15:02
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public interface LiveListContract {
+    interface LiveListView extends BaseView {
+        void getListDataSuccess(int page, LiveListBean liveListBean);
+    }
+
+    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
             @Override
             public void onComplete() {
             public void onComplete() {
                 super.onComplete();
                 super.onComplete();
-                if (getView() != null) {
-                    getView().hideLoading();
-                }
             }
             }
 
 
             @Override
             @Override
             public void onError(Throwable e) {
             public void onError(Throwable e) {
                 super.onError(e);
                 super.onError(e);
-                if (e instanceof ApiException) {
-                    ErrorParse.getInstance().parseError(e);
-                }
             }
             }
         });
         });
     }
     }

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

@@ -0,0 +1,55 @@
+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.contract.LiveListContract;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * 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);
+            }
+        });
+    }
+
+}

+ 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();
+        }
+    }
+}

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

@@ -0,0 +1,178 @@
+package com.cooleshow.teacher.ui.live;
+
+import android.os.Bundle;
+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.widgets.EmptyViewLayout;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.LiveListAdapter;
+import com.cooleshow.teacher.bean.LiveListBean;
+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.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+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;
+
+    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) {
+                        //查看回放
+                        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 getData(boolean isShowLoading) {
+        if (presenter != null) {
+            presenter.getLiveListData(isShowLoading, mLiveTag, currentPage);
+        }
+    }
+
+    @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();
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 显示空视图
+     */
+    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;
+    }
+}

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

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/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>

+ 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>