Prechádzať zdrojové kódy

增加老师端个人风采视频页面

Pq 7 mesiacov pred
rodič
commit
387603d700

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

@@ -156,6 +156,7 @@ object RouterPath {
         companion object {
             const val HOME_PAGE = "/teacher/ui/homepage/HomePageActivity"
             const val MINE_STYLE_PAGE = "/teacher/ui/minestyle/MineStyleActivity"
+            const val MINE_STYLE_VIDEO_PAGE = "/teacher/ui/minestyle/MyStyleVideoListActivity"
             const val MINE_TEACHABLE_INSTRUMENT =
                 "/teacher/ui/minestyle/TeachableInstrumentActivity"
             const val MINE_CHECK_TEACHABLE = "/ui/minestyle/CheckTeachableActivity"

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

@@ -167,6 +167,12 @@
             android:name=".ui.minestyle.MineStylePageActivity"
             android:configChanges="orientation|screenSize|keyboardHidden|fontScale|smallestScreenSize|screenLayout|uiMode"
             android:screenOrientation="portrait" />
+
+        <activity
+            android:name=".ui.minestyle.MyStyleVideoListActivity"
+            android:configChanges="orientation|screenSize|keyboardHidden|fontScale|smallestScreenSize|screenLayout|uiMode"
+            android:screenOrientation="portrait" />
+
         <activity
             android:name=".ui.minestyle.TeachableInstrumentActivity"
             android:configChanges="orientation|screenSize|keyboardHidden|fontScale|smallestScreenSize|screenLayout|uiMode"

+ 68 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/MyStyleVideoListAdapter.java

@@ -0,0 +1,68 @@
+package com.cooleshow.teacher.adapter;
+
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.airbnb.lottie.LottieAnimationView;
+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.base.utils.GlideUtils;
+import com.cooleshow.base.utils.SizeUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.bean.TeacherSelfStyleInfoBean;
+import com.cooleshow.usercenter.helper.UserHelper;
+
+import androidx.annotation.NonNull;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+/**
+ * Author by pq, Date on 2022/8/30.
+ */
+public class MyStyleVideoListAdapter extends BaseQuickAdapter<TeacherSelfStyleInfoBean.StyleVideoBean, BaseViewHolder> implements LoadMoreModule {
+    private final String userName;
+    private final String userAvatar;
+    private int long_img_height = 0;
+    private int normal_img_height = 0;
+
+    public MyStyleVideoListAdapter() {
+        super(R.layout.item_my_style_video_layout);
+        long_img_height = SizeUtils.dp2px(170);
+        normal_img_height = SizeUtils.dp2px(143);
+        userName = UserHelper.getUserName();
+        userAvatar = UserHelper.getUserAvatar();
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder holder, TeacherSelfStyleInfoBean.StyleVideoBean data) {
+        ImageView coverImagView = holder.getView(R.id.iv_cover);
+        ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) coverImagView.getLayoutParams();
+        int position = holder.getLayoutPosition();
+        if (position == 0) {
+            layoutParams.height = normal_img_height;
+        } else {
+            layoutParams.height = long_img_height;
+        }
+        coverImagView.setLayoutParams(layoutParams);
+        //封面
+        GlideUtils.INSTANCE.loadTopRoundImage(getContext(), data.cover, coverImagView, 10, com.cooleshow.base.R.drawable.bg_video_placeholder);
+
+        //头像
+        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
+        GlideUtils.INSTANCE.loadImage(getContext(), userAvatar, iv_avatar, R.drawable.icon_teacher_default_head);
+        //昵称
+        holder.setText(R.id.tv_name,userName);
+        TextView tv_tip = holder.getView(R.id.tv_tip);
+        tv_tip.setText(String.format("%d人观看", data.browse));
+        tv_tip.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
+    }
+
+    @NonNull
+    @Override
+    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
+        return new BaseLoadMoreModule(baseQuickAdapter);
+    }
+}

+ 25 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/MineStyleVideoContract.java

@@ -0,0 +1,25 @@
+package com.cooleshow.teacher.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
+import com.cooleshow.teacher.bean.TeacherSelfStyleInfoBean;
+import com.cooleshow.usercenter.bean.SetDetailBean;
+import com.cooleshow.usercenter.bean.TeacherUserInfo;
+
+import java.util.List;
+
+/**
+ * 创建日期:2022/5/13 14:15
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public interface MineStyleVideoContract {
+    interface View extends BaseView {
+        void getSelfStyleSuccess(TeacherSelfStyleInfoBean data);
+
+    }
+
+    interface Presenter {
+    }
+}

+ 63 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/minestyle/MineStyleVideoPresenter.java

@@ -0,0 +1,63 @@
+package com.cooleshow.teacher.presenter.minestyle;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.text.TextUtils;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
+import com.bumptech.glide.request.target.SimpleTarget;
+import com.bumptech.glide.request.transition.Transition;
+import com.cooleshow.base.constanst.UploadConstants;
+import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.FileUtils;
+import com.cooleshow.base.utils.ImageUtils;
+import com.cooleshow.base.utils.RequestBodyUtil;
+import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.utils.helper.upload.UploadHelper;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
+import com.cooleshow.teacher.api.APIService;
+import com.cooleshow.teacher.bean.TeacherSelfStyleInfoBean;
+import com.cooleshow.teacher.bean.request.QueryGroupListEntry;
+import com.cooleshow.teacher.contract.MineStylePageContract;
+import com.cooleshow.teacher.contract.MineStyleVideoContract;
+import com.cooleshow.usercenter.bean.SetDetailBean;
+import com.cooleshow.usercenter.bean.TeacherUserInfo;
+
+import java.io.File;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
+import io.reactivex.rxjava3.core.Observable;
+import io.reactivex.rxjava3.core.ObservableEmitter;
+import io.reactivex.rxjava3.core.ObservableOnSubscribe;
+import io.reactivex.rxjava3.core.Observer;
+import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.schedulers.Schedulers;
+
+/**
+ * 创建日期:2022/5/13 14:17
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class MineStyleVideoPresenter extends BasePresenter<MineStyleVideoContract.View> implements MineStyleVideoContract.Presenter {
+
+
+    public void getTeacherSelfStyle() {
+        getView().showLoading();
+        addSubscribe(create(APIService.class).getTeacherSelfStyle(), new BaseObserver<TeacherSelfStyleInfoBean>(getView()) {
+            @Override
+            protected void onSuccess(TeacherSelfStyleInfoBean data) {
+                if (getView() != null) {
+                    getView().getSelfStyleSuccess(data);
+                }
+            }
+
+        });
+    }
+}

+ 9 - 2
teacher/src/main/java/com/cooleshow/teacher/ui/homepage/HomePageActivity.java

@@ -136,7 +136,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager, new TabLayoutMediator.TabConfigurationStrategy() {
             @Override
             public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
-                createTab(tab, titles[position],position);
+                createTab(tab, titles[position], position);
             }
         });
         initListener();
@@ -167,6 +167,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
             }
         });
         viewBinding.flFansGroup.setOnClickListener(this);
+        viewBinding.flStyle.setOnClickListener(this);
         viewBinding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
@@ -245,6 +246,12 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
             showFansListDialog();
             return;
         }
+
+        if (id == R.id.fl_style) {
+            ARouter.getInstance().build(RouterPath.MineCenter.MINE_STYLE_VIDEO_PAGE)
+                    .navigation();
+            return;
+        }
     }
 
     private void showBadgeDialog() {
@@ -252,7 +259,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         badgeDesDialog.show();
     }
 
-    private TabLayout.Tab createTab(TabLayout.Tab tab, String text,int position) {
+    private TabLayout.Tab createTab(TabLayout.Tab tab, String text, int position) {
         tab.setCustomView(R.layout.view_homepage_tab_layout);
         View customView = tab.getCustomView();
         if (customView != null) {

+ 108 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/minestyle/MyStyleVideoListActivity.java

@@ -0,0 +1,108 @@
+package com.cooleshow.teacher.ui.minestyle;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.listener.OnItemClickListener;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.base.ui.activity.BaseActivity;
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.ui.video.VideoPlayActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.base.widgets.EmptyViewLayout;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.MyStyleVideoListAdapter;
+import com.cooleshow.teacher.bean.TeacherSelfStyleInfoBean;
+import com.cooleshow.teacher.contract.MineStyleVideoContract;
+import com.cooleshow.teacher.databinding.AcMyStyleVideoListLayoutBinding;
+import com.cooleshow.teacher.presenter.minestyle.MineStyleVideoPresenter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
+
+/**
+ * Author by pq, Date on 2024/11/26.
+ */
+@Route(path = RouterPath.MineCenter.MINE_STYLE_VIDEO_PAGE)
+public class MyStyleVideoListActivity extends BaseMVPActivity<AcMyStyleVideoListLayoutBinding, MineStyleVideoPresenter> implements MineStyleVideoContract.View {
+
+    private MyStyleVideoListAdapter mAdapter;
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
+    @Override
+    protected void initView() {
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "个人风采");
+        EmptyViewLayout emptyViewLayout = new EmptyViewLayout(this);
+        emptyViewLayout.setContent(R.drawable.icon_empty_content, "暂无内容");
+        StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
+        viewBinding.recyclerView.setLayoutManager(staggeredGridLayoutManager);
+        mAdapter = new MyStyleVideoListAdapter();
+        mAdapter.setEmptyView(emptyViewLayout);
+        viewBinding.recyclerView.setAdapter(mAdapter);
+    }
+
+
+    @Override
+    public void initData() {
+        super.initData();
+        viewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                getData();
+            }
+        });
+        mAdapter.setOnItemClickListener(new OnItemClickListener() {
+            @Override
+            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
+                if (position < mAdapter.getData().size()) {
+                    TeacherSelfStyleInfoBean.StyleVideoBean styleVideoBean = mAdapter.getData().get(position);
+                    if (styleVideoBean != null && !TextUtils.isEmpty(styleVideoBean.videoUrl)) {
+                        VideoPlayActivity.start(MyStyleVideoListActivity.this, styleVideoBean.videoUrl);
+                    }
+                }
+            }
+        });
+    }
+
+    private void getData() {
+        presenter.getTeacherSelfStyle();
+    }
+
+    @Override
+    protected AcMyStyleVideoListLayoutBinding getLayoutView() {
+        return AcMyStyleVideoListLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected MineStyleVideoPresenter createPresenter() {
+        return new MineStyleVideoPresenter();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        getData();
+    }
+
+    @Override
+    public void getSelfStyleSuccess(TeacherSelfStyleInfoBean data) {
+        if (!checkActivityExist()) {
+            return;
+        }
+        if (mAdapter != null) {
+            viewBinding.refreshLayout.finishRefresh();
+            mAdapter.setList(data.styleVideo);
+        }
+    }
+}

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


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


+ 31 - 0
teacher/src/main/res/layout/ac_my_style_video_list_layout.xml

@@ -0,0 +1,31 @@
+<?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.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="12dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/sort_view"
+        app:srlEnableLoadMore="false">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginStart="8dp"
+            android:layout_marginEnd="8dp"
+            android:overScrollMode="never"
+            android:scrollbars="none" />
+
+    </com.scwang.smart.refresh.layout.SmartRefreshLayout>
+</LinearLayout>

+ 87 - 0
teacher/src/main/res/layout/item_my_style_video_layout.xml

@@ -0,0 +1,87 @@
+<?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="6dp"
+    android:layout_marginEnd="6dp"
+    android:layout_marginBottom="12dp"
+    android:background="@drawable/bg_white_10dp"
+    android:paddingBottom="14dp">
+
+    <ImageView
+        android:id="@+id/iv_cover"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="100dp"
+        android:scaleType="centerCrop"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:src="@drawable/icon_video_play_tag"
+        app:layout_constraintRight_toRightOf="@+id/iv_cover"
+        app:layout_constraintTop_toTopOf="@+id/iv_cover" />
+
+    <TextView
+        android:id="@+id/tv_title"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="7dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="2"
+        android:paddingStart="11dp"
+        android:paddingEnd="11dp"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_14"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/iv_cover"
+        tools:text="长笛练习过程中的小技巧-换气法" />
+
+    <de.hdodenhof.circleimageview.CircleImageView
+        android:id="@+id/iv_avatar"
+        android:layout_width="16dp"
+        android:layout_height="16dp"
+        android:layout_marginStart="11dp"
+        android:layout_marginTop="12dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_title" />
+
+
+    <TextView
+        android:id="@+id/tv_name"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
+        app:layout_constraintLeft_toRightOf="@+id/iv_avatar"
+        app:layout_constraintRight_toLeftOf="@+id/tv_tip"
+        app:layout_constraintTop_toTopOf="@+id/iv_avatar"
+        tools:text="酷乐秀官方" />
+
+    <TextView
+        android:id="@+id/tv_tip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="11dp"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_999999"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/iv_avatar"
+        tools:text="1112人观看" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>