Browse Source

修改群设置退出群聊样式和流程

Pq 1 year ago
parent
commit
b4259f713b

+ 2 - 0
BaseLibrary/src/main/java/com/cooleshow/base/constanst/Constants.java

@@ -24,6 +24,8 @@ public class Constants {
 
 
     public static final String MAIN_PAGE_SELECT_POTION_KEY = "select_position";
+
+    public static final String MAIN_PAGE_SELECT_CHILD_POTION_KEY = "select_child_position";
     public static final String ON_LIVING_TAG = "1";//1是直播中, 0否
 
     public static final int STUDENT_FOCUS_TEACHER_STATUS_NORMAL = 0;//取消关注

+ 7 - 0
BaseLibrary/src/main/java/com/cooleshow/base/utils/JumpUtils.java

@@ -174,4 +174,11 @@ public class JumpUtils {
                 .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, selectPosition)
                 .navigation();
     }
+
+    public static void jumpJGMainAndSelectChild(int i,int childPos) {
+        ARouter.getInstance().build(RouterPath.JGCenter.PATH_HOME)
+                .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, i)
+                .withInt(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY, childPos)
+                .navigation();
+    }
 }

+ 19 - 6
chatModule/src/main/java/com/cooleshow/chatmodule/ui/ChatGroupSettingActivity.java

@@ -17,6 +17,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.listener.OnItemClickListener;
 import com.cooleshow.base.bean.StudentPageListBean;
 import com.cooleshow.base.common.BaseApplication;
+import com.cooleshow.base.constanst.StyleConfig;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.GlideUtils;
@@ -24,6 +25,7 @@ import com.cooleshow.base.utils.JumpUtils;
 import com.cooleshow.base.utils.LogUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
 import com.cooleshow.base.widgets.dialog.CommonDialog;
 import com.cooleshow.chatmodule.R;
 import com.cooleshow.chatmodule.adapter.GroupSettingMemberAdapter;
@@ -36,6 +38,7 @@ import com.cooleshow.chatmodule.databinding.TcActivityChatGroupSettingBinding;
 import com.cooleshow.chatmodule.presenter.ChatGroupSettingPresenter;
 import com.cooleshow.chatmodule.utils.helper.ChatGroupHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
+import com.cooleshow.chatmodule.widget.CommonConfirmDialog2;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.tencent.qcloud.tuicore.TUICore;
 import com.tencent.qcloud.tuikit.tuigroup.bean.GroupInfo;
@@ -109,24 +112,28 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
                 showConfirmDialog();
             } else {
                 //发消息
-                finish();
+                showQuitConfirmDialog();
             }
         }
 
     }
 
     private void showQuitConfirmDialog() {
-        CommonDialog commonDialog = new CommonDialog(this);
+        CommonConfirmDialog2 commonDialog = new CommonConfirmDialog2(this);
         commonDialog.show();
-        commonDialog.setTitle("提示");
-        commonDialog.setContent("确认退出该群聊吗?");
+        commonDialog.setTitle("退出群聊");
+        commonDialog.setContent("请确认是否要退出群聊?");
+        commonDialog.setCancelText("确认");
+        commonDialog.setCancelBackground(R.drawable.shape_2dc7aa_20dp, com.cooleshow.base.R.color.white);
+        commonDialog.setConfirmText("取消");
+        commonDialog.setConfirmBackground(R.drawable.shape_border_dbdbdb_1dp_20dp, com.cooleshow.base.R.color.color_333333);
+        IMThemManager.getInstance().setTextDrawableStyle(commonDialog.getTvCancel());
         commonDialog.setOnConfirmClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (commonDialog != null) {
                     commonDialog.dismiss();
                 }
-                presenter.quitChatGroup(targetId);
             }
         });
         commonDialog.setOnCancelClickListener(new View.OnClickListener() {
@@ -135,6 +142,7 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
                 if (commonDialog != null) {
                     commonDialog.dismiss();
                 }
+                presenter.quitChatGroup(targetId);
             }
         });
     }
@@ -209,7 +217,7 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
             viewBinding.tvGroupNameRemarks.setClickable(true);
             viewBinding.tvGroupNameRemarks.setCompoundDrawablesWithIntrinsicBounds(0, 0, com.cooleshow.base.R.drawable.icon_arrow_right, 0);
         } else {
-            btnConfirm.setText("发消息");
+            btnConfirm.setText("退出群聊");
             viewBinding.llChatJoinApply.setVisibility(View.GONE);
             viewBinding.tvGroupNameRemarks.setClickable(false);
             viewBinding.tvGroupNameRemarks.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
@@ -387,6 +395,11 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
             return;
         }
         ToastUtil.getInstance().showShort("退出成功");
+        if (UserHelper.isTenantAccount()) {
+            JumpUtils.jumpJGMainAndSelectChild(1, 0);
+        } else {
+            JumpUtils.jumpMain(2);
+        }
     }
 
     @Override

+ 6 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/IMThemManager.java

@@ -182,6 +182,12 @@ public class IMThemManager {
         }
     }
 
+    public void setTextDrawableStyles(TextView... textView){
+        for (int i = 0; i < textView.length; i++) {
+            setTextDrawableStyle(textView[i]);
+        }
+    }
+
     public void setTextDrawableStyle(TextView textView) {
         Drawable backgroundDrawable = null;
         backgroundDrawable = textView.getBackground();

+ 121 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/widget/CommonConfirmDialog2.java

@@ -0,0 +1,121 @@
+package com.cooleshow.chatmodule.widget;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.TextView;
+
+
+import com.cooleshow.chatmodule.R;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/6/17.
+ */
+public class CommonConfirmDialog2 extends Dialog {
+
+    private TextView mTvContent;
+    private TextView mTvCancel;
+    private TextView mTvConfirm;
+    private TextView mTvTitle;
+
+    public CommonConfirmDialog2(@NonNull Context context) {
+        super(context, R.style.tc_BaseDialog);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.tc_dialog_common_confirm_layout);
+        Window window = getWindow();
+        WindowManager.LayoutParams lp = window.getAttributes();
+        lp.gravity = Gravity.CENTER;
+        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
+        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
+        getWindow().setAttributes(lp);
+
+
+        mTvContent = findViewById(R.id.tv_content);
+        mTvCancel = findViewById(R.id.tv_cancel);
+        mTvConfirm = findViewById(R.id.tv_confirm);
+        mTvTitle = findViewById(R.id.tv_title);
+    }
+
+    /**
+     * 设置主文本
+     *
+     * @param text
+     */
+    public void setContent(String text) {
+        if (mTvContent != null) {
+            mTvContent.setText(text);
+        }
+    }
+
+    public void setTitle(String title) {
+        if (mTvTitle != null) {
+            mTvTitle.setText(title);
+        }
+    }
+
+    /**
+     * 设置取消按钮text
+     *
+     * @param text
+     */
+    public void setCancelText(String text) {
+        if (mTvCancel != null) {
+            mTvCancel.setText(text);
+        }
+    }
+
+    /**
+     * 设置确认按钮text
+     *
+     * @param text
+     */
+    public void setConfirmText(String text) {
+        if (mTvConfirm != null) {
+            mTvConfirm.setText(text);
+        }
+    }
+
+    public void setConfirmBackground(int background, int textColor) {
+        if (mTvConfirm != null) {
+            mTvConfirm.setBackgroundResource(background);
+            mTvConfirm.setTextColor(getContext().getResources().getColor(textColor));
+        }
+    }
+
+    public void setCancelBackground(int background, int textColor) {
+        if (mTvCancel != null) {
+            mTvCancel.setBackgroundResource(background);
+            mTvCancel.setTextColor(getContext().getResources().getColor(textColor));
+        }
+    }
+
+    public void setOnConfirmClickListener(View.OnClickListener listener) {
+        if (mTvConfirm != null) {
+            mTvConfirm.setOnClickListener(listener);
+        }
+    }
+
+    public void setOnCancelClickListener(View.OnClickListener listener) {
+        if (mTvCancel != null) {
+            mTvCancel.setOnClickListener(listener);
+        }
+    }
+
+    public TextView getTvConfirm() {
+        return mTvConfirm;
+    }
+
+    public TextView getTvCancel() {
+        return mTvCancel;
+    }
+}

+ 5 - 0
chatModule/src/main/res/drawable/shape_2dc7aa_20dp.xml

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

+ 5 - 0
chatModule/src/main/res/drawable/shape_border_dbdbdb_1dp_20dp.xml

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

+ 80 - 0
chatModule/src/main/res/layout/tc_dialog_common_confirm_layout.xml

@@ -0,0 +1,80 @@
+<?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"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="30dp"
+    android:layout_marginEnd="30dp"
+    android:orientation="vertical">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_10dp_white"
+        android:paddingBottom="20dp">
+
+
+        <TextView
+            android:id="@+id/tv_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:paddingTop="20dp"
+            android:textColor="@color/color_333333"
+            android:textSize="@dimen/sp_18"
+            android:textStyle="bold"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            tools:text="我是标题" />
+
+        <TextView
+            android:id="@+id/tv_content"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="14dp"
+            android:layout_marginEnd="14dp"
+            android:gravity="center"
+            android:paddingTop="20dp"
+            android:paddingBottom="25dp"
+            android:textColor="@color/color_666666"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tv_title"
+            tools:text="结束后直播间关闭本场直播结束,不可再次开启" />
+
+
+        <TextView
+            android:id="@+id/tv_cancel"
+            android:layout_width="0dp"
+            android:layout_height="40dp"
+            android:layout_marginStart="15dp"
+            android:layout_marginEnd="8dp"
+            android:background="@drawable/shape_border_dbdbdb_1dp_20dp"
+            android:gravity="center"
+            android:text="取消"
+            android:textColor="@color/color_666666"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toLeftOf="@+id/tv_confirm"
+            app:layout_constraintTop_toBottomOf="@+id/tv_content" />
+
+        <TextView
+            android:id="@+id/tv_confirm"
+            android:layout_width="0dp"
+            android:layout_height="40dp"
+            android:layout_marginStart="8dp"
+            android:layout_marginEnd="15dp"
+            android:background="@drawable/shape_2dc7aa_20dp"
+            android:gravity="center"
+            android:text="确认"
+            android:textColor="@color/white"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toRightOf="@+id/tv_cancel"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="@+id/tv_cancel" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</LinearLayout>

+ 12 - 0
chatModule/src/main/res/values/styles.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="tc_BaseDialog" parent="Theme.AppCompat.Light.Dialog">
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowBackground">@android:color/transparent</item>
+        <item name="android:colorBackgroundCacheHint">@null</item>
+        <item name="android:windowSoftInputMode">adjustPan</item>
+        <item name="android:windowIsFloating">true</item>
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+</resources>

+ 62 - 0
institution/src/main/java/com/cooleshow/institution/stu/ui/main/MainActivity.java

@@ -1,6 +1,7 @@
 package com.cooleshow.institution.stu.ui.main;
 
 import android.Manifest;
+import android.content.Intent;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.KeyEvent;
@@ -8,13 +9,17 @@ import android.view.View;
 import android.widget.TextView;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
+import com.cooleshow.base.bean.RouteBean;
 import com.cooleshow.base.common.BaseApplication;
+import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.constanst.LoginStatusConstants;
 import com.cooleshow.base.constanst.StyleConfig;
 import com.cooleshow.base.event.LoginStatusEvent;
 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.GsonUtils;
+import com.cooleshow.base.utils.JumpUtils;
 import com.cooleshow.base.utils.LogUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.helper.MidiFileHelper;
@@ -46,6 +51,8 @@ import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import cn.jpush.android.api.JPushInterface;
 
+import static com.cooleshow.base.constanst.Constants.MAIN_PAGE_SELECT_POTION_KEY;
+
 /**
  * Author by pq, Date on 2023/9/11.
  */
@@ -72,6 +79,7 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
         super.onCreate(savedInstanceState);
         QMUIStatusBarHelper.setStatusBarDarkMode(this);
         EventBus.getDefault().register(this);
+        parseIntent(getIntent());
     }
 
     @Override
@@ -99,6 +107,48 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
         IMCenter.getInstance().addUnReadMessageObserver(mUnReadMessageObserver);
     }
 
+    @Override
+    protected void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        parseIntent(intent);
+    }
+
+    private void parseIntent(Intent intent) {
+        if (intent.hasExtra(Constants.MAIN_PAGE_SELECT_POTION_KEY)) {
+            //跳转选中某个tab
+            int selectPos = intent.getIntExtra(Constants.MAIN_PAGE_SELECT_POTION_KEY, 0);
+            if (selectPos >= mFragments.size()) {
+                return;
+            }
+            setPositionItem(selectPos);
+            if (intent.hasExtra(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY)) {
+                if (selectPos == 1) {
+                    if (mChatFragment != null) {
+                        int childPos = intent.getIntExtra(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY, 0);
+                        mChatFragment.selectPos(childPos);
+                    }
+                }
+            }
+            return;
+        }
+//        String intentResult = PushIntentParseHelper.getIntentMemoFrom(intent);
+//        LogUtils.i("pq", "intentResult:" + intentResult);
+//        if (!TextUtils.isEmpty(intentResult)) {
+//            if (TextUtils.equals(intentResult, PushIntentParseHelper.RONG_PUSH_ACTION_TAG)) {
+//                //融云推送相关
+//                //选中聊天
+//                setPositionItem(2);
+//                return;
+//            }
+//            try {
+//                RouteBean routeBean = GsonUtils.fromJson(intentResult, RouteBean.class);
+//                JumpUtils.jump(routeBean);
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//        }
+    }
+
     private void setStyleConfig() {
         StyleConfig.isStudentStyle = false;
         IMThemManager.getInstance().setEmptyDrawable(getResources().getDrawable(R.drawable.jg_icon_empty_content));
@@ -115,6 +165,18 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
         IMThemManager.getInstance().setAddPicDefaultImgRes(R.drawable.jg_tc_ic_update_photo);
     }
 
+    public void setPositionItem(int position) {
+        if (position == 0) {
+            onTabClick(viewBinding.viewHome);
+        }
+        if (position == 1) {
+            onTabClick(viewBinding.viewChat);
+        }
+        if (position == 2) {
+            onTabClick(viewBinding.viewMine);
+        }
+    }
+
     public void onTabClick(View view) {
         int id = view.getId();
         if (id == R.id.view_home) {

+ 6 - 0
institution/src/main/res/drawable/jg_cancel_btn_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <corners android:radius="@dimen/dp_24"/>
+    <stroke android:color="#2DC7AA" android:width="@dimen/dp_1"/>
+</shape>

+ 2 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/mine/SelectTenantMemberPresenter.java

@@ -24,6 +24,8 @@ public class SelectTenantMemberPresenter extends BasePresenter<SelectTenantMembe
         JSONObject jsonObject = new JSONObject();
         try {
             jsonObject.put("bindTenant", 1);
+            jsonObject.put("page", 1);
+            jsonObject.put("rows", Integer.MAX_VALUE);
         } catch (JSONException e) {
             throw new RuntimeException(e);
         }

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

@@ -276,4 +276,9 @@ public class UserHelper {
         }
         return false;
     }
+
+    public static boolean isTenantAccount(){
+        String tenantId = getTenantId();
+        return isTenantAccount(tenantId);
+    }
 }