Browse Source

修改拒收消息提示弹窗

Pq 3 months ago
parent
commit
585c795073

+ 3 - 2
chatModule/src/main/java/com/cooleshow/chatmodule/ui/ChatFragment.java

@@ -22,6 +22,7 @@ import com.cooleshow.chatmodule.manager.IMCenter;
 import com.cooleshow.chatmodule.utils.helper.ChatAvatarClickHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.chatmodule.widget.CommonConfirmDialog2;
+import com.cooleshow.chatmodule.widget.RefuseMessageTipDialog;
 import com.google.android.material.tabs.TabLayout;
 import com.google.android.material.tabs.TabLayoutMediator;
 import com.tencent.imsdk.BaseConstants;
@@ -119,8 +120,8 @@ public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> impl
             public boolean onParseError(Context context, String module, int errCode, String errMsg) {
                 if(errCode == BaseConstants.ERR_SVR_MSG_IN_PEER_BLACKLIST){
                     //黑名单
-                    CommonConfirmDialog2 commonConfirmDialog2 =new CommonConfirmDialog2(context);
-                    commonConfirmDialog2.show();
+                    RefuseMessageTipDialog tipDialog =new RefuseMessageTipDialog(context);
+                    tipDialog.show();
                     return true;
                 }
                 return false;

+ 1 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/ui/SingleChatSettingActivity.java

@@ -89,6 +89,7 @@ public class SingleChatSettingActivity extends BaseMVPActivity<TcActivityChatSin
     @Override
     protected void initView() {
         initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "设置");
+        IMThemManager.getInstance().setCheckButtonDrawable(viewBinding.cbBlack);
     }
 
     @Override

+ 127 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/widget/RefuseMessageTipDialog.java

@@ -0,0 +1,127 @@
+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 RefuseMessageTipDialog extends Dialog {
+
+    private TextView mTvContent;
+    private TextView mTvCancel;
+    private TextView mTvConfirm;
+    private TextView mTvTitle;
+
+    public RefuseMessageTipDialog(@NonNull Context context) {
+        super(context, R.style.tc_BaseDialog);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.tc_dialog_refuse_message_tip_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);
+
+        mTvConfirm.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dismiss();
+            }
+        });
+    }
+
+    /**
+     * 设置主文本
+     *
+     * @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;
+    }
+}

+ 84 - 0
chatModule/src/main/res/layout/tc_dialog_refuse_message_tip_layout.xml

@@ -0,0 +1,84 @@
+<?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="wrap_content"
+        android:layout_gravity="center"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_10dp_white"
+        android:paddingStart="30dp"
+        android:paddingEnd="30dp"
+        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"
+            android:visibility="gone"
+            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="25dp"
+            android:paddingBottom="25dp"
+            android:text="对方拒收了您的消息"
+            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"
+            android:visibility="gone"
+            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="130dp"
+            android:layout_height="36dp"
+            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>