Quellcode durchsuchen

增加老师端个人主页粉丝群弹窗

Pq vor 3 Monaten
Ursprung
Commit
5df44f5dde

+ 6 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/HomePageContract.java

@@ -1,8 +1,11 @@
 package com.cooleshow.teacher.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
 import com.cooleshow.usercenter.bean.TeacherUserInfo;
 
+import java.util.List;
+
 /**
  * Author by pq, Date on 2022/4/20.
  */
@@ -10,6 +13,9 @@ public interface HomePageContract {
 
     interface HomePageView extends BaseView {
         void getTeacherInfoSuccess(TeacherUserInfo info);
+
+        void getFunGroupList(List<ContactRoomListBean> list);
+
     }
 
     interface Presenter {

+ 17 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/homePage/HomePagePresenter.java

@@ -2,12 +2,16 @@ package com.cooleshow.teacher.presenter.homePage;
 
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
 import com.cooleshow.teacher.api.APIService;
+import com.cooleshow.teacher.bean.request.QueryGroupListEntry;
 import com.cooleshow.teacher.contract.HomePageContract;
 import com.cooleshow.teacher.contract.MineContract;
 import com.cooleshow.usercenter.bean.TeacherUserInfo;
 import com.cooleshow.usercenter.bean.UserInfo;
 
+import java.util.List;
+
 /**
  * Author by pq, Date on 2022/4/20.
  */
@@ -32,4 +36,17 @@ public class HomePagePresenter extends BasePresenter<HomePageContract.HomePageVi
             }
         });
     }
+
+    public void getTeaGroupList() {
+        QueryGroupListEntry entry = new QueryGroupListEntry();
+        entry.type = "FAN";
+        addSubscribe(create(APIService.class).queryTeaGroupList(entry), new BaseObserver<List<ContactRoomListBean>>(getView()) {
+            @Override
+            protected void onSuccess(List<ContactRoomListBean> list) {
+                if (getView() != null) {
+                    getView().getFunGroupList(list);
+                }
+            }
+        });
+    }
 }

+ 44 - 14
teacher/src/main/java/com/cooleshow/teacher/ui/homepage/HomePageActivity.java

@@ -23,6 +23,7 @@ import com.cooleshow.base.utils.SizeUtils;
 import com.cooleshow.base.utils.UiUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.adapter.HomePagerAdapter;
@@ -33,6 +34,7 @@ import com.cooleshow.teacher.databinding.ActivityHomePageNewLayoutBinding;
 import com.cooleshow.teacher.presenter.homePage.HomePagePresenter;
 import com.cooleshow.teacher.widgets.AppBarLayoutStateChangeListener;
 import com.cooleshow.teacher.widgets.dialog.BadgeDesDialog;
+import com.cooleshow.teacher.widgets.dialog.FansListDialog;
 import com.cooleshow.usercenter.bean.TeacherUserInfo;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.google.android.material.appbar.AppBarLayout;
@@ -43,6 +45,7 @@ import com.zhy.view.flowlayout.TagAdapter;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -63,27 +66,20 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
     private int titleStyleMode = 1;//根据折叠展开状态控制title样式
 
     private AppBarLayoutStateChangeListener.State lastState = AppBarLayoutStateChangeListener.State.EXPANDED;
-
+    private List<ContactRoomListBean> fansList;
+    private FansListDialog mFansListDialog;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
     }
-    
+
     @Override
     protected void initView() {
 //        Utils.setHeadView(viewBinding.viewStatusBar, this, 0);
         viewBinding.tvTitle.setText("");
         viewBinding.toolbar.setNavigationIcon(com.cooleshow.base.R.drawable.icon_back_arrow_white);
-        viewBinding.ivBack.setOnClickListener(this);
-        viewBinding.ivEdit.setOnClickListener(this);
-        viewBinding.toolbar.setNavigationOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                finish();
-            }
-        });
         viewBinding.appBarLayout.addOnOffsetChangedListener(new AppBarLayoutStateChangeListener() {
 
             @Override
@@ -144,7 +140,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         });
         initListener();
         VIPCustomCoursePageFragment vipCustomCoursePageFragment = new VIPCustomCoursePageFragment();
-        InterestCorrectCoursePageFragment  interestCorrectCoursePageFragment = new InterestCorrectCoursePageFragment();
+        InterestCorrectCoursePageFragment interestCorrectCoursePageFragment = new InterestCorrectCoursePageFragment();
         LiveCoursePageFragment liveCoursePageFragment = new LiveCoursePageFragment();
         VideoCoursePageFragment videoCoursePageFragment = new VideoCoursePageFragment();
         mMusicPageFragment = new SheetMusicPageFragment();
@@ -161,6 +157,15 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
     }
 
     private void initListener() {
+        viewBinding.ivBack.setOnClickListener(this);
+        viewBinding.ivEdit.setOnClickListener(this);
+        viewBinding.toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+        viewBinding.flFansGroup.setOnClickListener(this);
         viewBinding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
@@ -213,6 +218,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
     protected void onResume() {
         super.onResume();
         presenter.getTeacherUserInfo();
+        presenter.getTeaGroupList();
     }
 
     @Override
@@ -232,6 +238,12 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
             ARouter.getInstance().build(RouterPath.MineCenter.MINE_STYLE_PAGE)
                     .navigation();
         }
+
+        if (id == R.id.fl_fans_group){
+            //粉丝群
+            showFansListDialog();
+            return;
+        }
     }
 
     private void showBadgeDialog() {
@@ -265,10 +277,10 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         if (mMusicPageFragment != null) {
             mMusicPageFragment.setMusicPersonCertStatus(info.entryStatus);
         }
-        if(TextUtils.isEmpty(info.getIntroduction())){
+        if (TextUtils.isEmpty(info.getIntroduction())) {
             viewBinding.tvIntroduce.setVisibility(View.GONE);
             viewBinding.selfIntroductionEmpty.setVisibility(View.VISIBLE);
-        }else{
+        } else {
             viewBinding.tvIntroduce.setText(info.getIntroduction());
             viewBinding.tvIntroduce.setVisibility(View.VISIBLE);
             viewBinding.selfIntroductionEmpty.setVisibility(View.GONE);
@@ -301,6 +313,14 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         }
     }
 
+    @Override
+    public void getFunGroupList(List<ContactRoomListBean> list) {
+        if (!checkActivityExist()) {
+            return;
+        }
+        this.fansList = list;
+    }
+
     private void addTagView() {
         viewBinding.llSubjectContainer.removeAllViews();
         for (int i = 0; i < subjectNames.size(); i++) {
@@ -336,7 +356,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
     private void updateCertStatusUI(String certStatus) {
         if (TextUtils.equals(certStatus, TeacherInfoConstants.ENTRY_STATUS_PASS)) {
             viewBinding.ivCertStatus.setImageResource(R.drawable.icon_cert_completed);
-        }else{
+        } else {
             viewBinding.ivCertStatus.setImageResource(R.drawable.icon_go_cert);
         }
     }
@@ -350,4 +370,14 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         textView.setBackgroundResource(com.cooleshow.base.R.drawable.shape_33ffffff_10dp);
         return textView;
     }
+
+    private void showFansListDialog() {
+        if (mFansListDialog == null) {
+            mFansListDialog = new FansListDialog(this);
+        }
+        if (!mFansListDialog.isShowing()) {
+            mFansListDialog.show();
+        }
+        mFansListDialog.setData(fansList);
+    }
 }

+ 87 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/dialog/FansListDialog.java

@@ -0,0 +1,87 @@
+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 android.widget.ProgressBar;
+import android.widget.TextView;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebConstants;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.chatmodule.bean.ContactRoomListBean;
+import com.cooleshow.chatmodule.constants.TCChatRouterPath;
+import com.cooleshow.chatmodule.utils.helper.ChatHelper;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.MineStyleFansGroupListAdapter;
+import com.cooleshow.teacher.widgets.StyleEmptyView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.constraintlayout.widget.ConstraintSet;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+
+/**
+ * Author by pq, Date on 2022/8/24.
+ */
+public class FansListDialog extends Dialog {
+
+    private MineStyleFansGroupListAdapter mAdapter;
+
+    public FansListDialog(@NonNull Context context) {
+        super(context, com.cooleshow.base.R.style.BaseDialog);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.dialog_fans_list_layout);
+        RecyclerView recyclerView = findViewById(R.id.recyclerView);
+        LinearLayoutManager layoutManager =new LinearLayoutManager(getContext());
+        mAdapter = new MineStyleFansGroupListAdapter();
+        recyclerView.setLayoutManager(layoutManager);
+        recyclerView.setAdapter(mAdapter);
+        StyleEmptyView fansEmptyView = StyleEmptyView.getInstance(getContext())
+                .setEmptyIcon(R.mipmap.teacher_fans_empty_icon)
+                .setEmptyText(getContext().getString(R.string.fans_empty_text))
+                .setOpeBtn(getContext().getString(R.string.goto_create))
+                .setOpeBtnClickListener(v -> {
+                    ARouter.getInstance().build(TCChatRouterPath.CHAT_CREATE_GROUP)
+                            .navigation();
+                });
+        mAdapter.setEmptyView(fansEmptyView);
+
+        initListener();
+    }
+
+    private void initListener() {
+        findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dismiss();
+            }
+        });
+
+        mAdapter.setOnItemClickListener((adapter, view, position) -> {
+            ContactRoomListBean item = (ContactRoomListBean) adapter.getItem(position);
+            goChat(item.getId() + "", item.getName());
+        });
+    }
+
+    public void setData(List<ContactRoomListBean> list) {
+        if (mAdapter != null) {
+            mAdapter.setNewInstance(list);
+        }
+    }
+
+    private void goChat(String groupId, String groupName) {
+        ChatHelper.getInstance().goGroupChat(groupId,"");
+    }
+}

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


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


+ 34 - 0
teacher/src/main/res/layout/dialog_fans_list_layout.xml

@@ -0,0 +1,34 @@
+<?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"
+    android:layout_width="wrap_content"
+    android:background="@drawable/bg_white_10dp"
+    android:layout_height="wrap_content">
+    <ImageView
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        android:id="@+id/iv_header"
+        android:src="@drawable/bg_fans_list_top"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+    <ImageView
+        android:id="@+id/iv_close"
+        android:padding="13dp"
+        app:layout_constraintRight_toRightOf="@+id/iv_header"
+        app:layout_constraintTop_toTopOf="@+id/iv_header"
+        android:src="@drawable/icon_close_dialog_32_32"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:layout_marginTop="12dp"
+        android:layout_width="0dp"
+        android:id="@+id/recyclerView"
+        app:layout_constraintHeight_min="218dp"
+        app:layout_constraintRight_toRightOf="@+id/iv_header"
+        app:layout_constraintLeft_toLeftOf="@+id/iv_header"
+        app:layout_constraintTop_toBottomOf="@+id/iv_header"
+        android:layout_height="0dp"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 30 - 8
teacher/src/main/res/layout/item_mine_style_fans_group_layout.xml

@@ -4,7 +4,9 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:padding="@dimen/dp_12">
+    android:paddingTop="12dp"
+    android:paddingBottom="12dp"
+    android:paddingStart="20dp">
 
     <de.hdodenhof.circleimageview.CircleImageView
         android:id="@+id/group_aver"
@@ -14,12 +16,17 @@
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
+        android:maxLines="1"
+        android:ellipsize="end"
+        app:layout_constraintRight_toLeftOf="@+id/iv_arrow"
         android:id="@+id/group_name"
-        android:layout_width="wrap_content"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:paddingLeft="@dimen/dp_15"
+        android:paddingLeft="@dimen/dp_12"
         android:textColor="@color/color_1a1a1a"
-        android:textSize="@dimen/sp_16"
+        android:textSize="@dimen/sp_15"
+        app:layout_constraintVertical_chainStyle="packed"
+        app:layout_constraintBottom_toTopOf="@+id/group_desc"
         app:layout_constraintLeft_toRightOf="@+id/group_aver"
         app:layout_constraintTop_toTopOf="parent"
         tools:text="竖笛学习" />
@@ -28,12 +35,27 @@
         android:id="@+id/group_desc"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:paddingLeft="@dimen/dp_14"
-        android:paddingEnd="2dp"
+        android:paddingLeft="@dimen/dp_12"
         android:textColor="@color/color_999999"
-        android:textSize="@dimen/sp_16"
-        app:layout_constraintRight_toRightOf="parent"
+        android:textSize="@dimen/sp_12"
+        android:maxLines="1"
+        android:ellipsize="end"
+        android:layout_marginTop="2dp"
+        app:layout_constraintRight_toLeftOf="@+id/iv_arrow"
+        app:layout_constraintBottom_toBottomOf="@+id/group_aver"
         app:layout_constraintLeft_toRightOf="@+id/group_aver"
         app:layout_constraintTop_toBottomOf="@+id/group_name"
         tools:text="竖笛学竖笛竖笛学竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习习学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习竖笛学习习" />
+
+    <ImageView
+        android:layout_marginEnd="20dp"
+        android:id="@+id/iv_arrow"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintBottom_toBottomOf="@+id/group_aver"
+        app:layout_constraintTop_toTopOf="@+id/group_aver"
+        android:src="@drawable/icon_arrow_right"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+
 </androidx.constraintlayout.widget.ConstraintLayout>