|
@@ -0,0 +1,190 @@
|
|
|
+package com.cooleshow.chatmodule.ui;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
+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.common.BaseConstant;
|
|
|
+import com.cooleshow.base.router.RouterPath;
|
|
|
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
+import com.cooleshow.base.utils.GlideUtils;
|
|
|
+import com.cooleshow.base.utils.JumpUtils;
|
|
|
+import com.cooleshow.base.utils.LOG;
|
|
|
+import com.cooleshow.base.utils.LogUtils;
|
|
|
+import com.cooleshow.base.utils.ToastUtil;
|
|
|
+import com.cooleshow.base.utils.ToastUtils;
|
|
|
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
+import com.cooleshow.base.widgets.dialog.CommonDialog;
|
|
|
+import com.cooleshow.chatmodule.R;
|
|
|
+import com.cooleshow.chatmodule.adapter.GroupSettingMemberAdapter;
|
|
|
+import com.cooleshow.chatmodule.bean.GroupApplyBean;
|
|
|
+import com.cooleshow.chatmodule.bean.GroupMemberBean;
|
|
|
+import com.cooleshow.chatmodule.bean.IMGroupInfo;
|
|
|
+import com.cooleshow.chatmodule.constants.Constants;
|
|
|
+import com.cooleshow.chatmodule.constants.GroupRoleType;
|
|
|
+import com.cooleshow.chatmodule.constants.TCChatRouterPath;
|
|
|
+import com.cooleshow.chatmodule.contract.ChatGroupSettingContract;
|
|
|
+import com.cooleshow.chatmodule.contract.ChatSingleSettingContract;
|
|
|
+import com.cooleshow.chatmodule.databinding.TcActivityChatGroupSettingBinding;
|
|
|
+import com.cooleshow.chatmodule.databinding.TcActivityChatSingleSettingBinding;
|
|
|
+import com.cooleshow.chatmodule.presenter.ChatGroupSettingPresenter;
|
|
|
+import com.cooleshow.chatmodule.presenter.ChatSingleSettingPresenter;
|
|
|
+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.imsdk.v2.V2TIMFriendInfo;
|
|
|
+import com.tencent.qcloud.tuicore.TUICore;
|
|
|
+import com.tencent.qcloud.tuikit.tuigroup.bean.GroupInfo;
|
|
|
+
|
|
|
+import org.json.JSONException;
|
|
|
+import org.json.JSONObject;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import androidx.annotation.NonNull;
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
+import androidx.recyclerview.widget.RecyclerView;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 创建日期:2022/6/11 14:29
|
|
|
+ *
|
|
|
+ * @author Ryan
|
|
|
+ * 类说明:
|
|
|
+ */
|
|
|
+@Route(path = TCChatRouterPath.CHAT_SINGLE_SETTING)
|
|
|
+public class SingleChatSettingActivity extends BaseMVPActivity<TcActivityChatSingleSettingBinding, ChatSingleSettingPresenter> implements ChatSingleSettingContract.ChatSingleSettingView, View.OnClickListener {
|
|
|
+ private String targetId;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ int id = view.getId();
|
|
|
+ if (id == R.id.ll_report) {
|
|
|
+ goAppeal();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ QMUIStatusBarHelper.setStatusBarLightMode(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initView() {
|
|
|
+ initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "设置");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initData() {
|
|
|
+ super.initData();
|
|
|
+ targetId = getIntent().getStringExtra(Constants.TARGET_ID_KEY);
|
|
|
+ if (TextUtils.isEmpty(targetId)) {
|
|
|
+ ToastUtils.showShort("参数异常");
|
|
|
+ finish();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ initListener();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initListener() {
|
|
|
+ viewBinding.llReport.setOnClickListener(this);
|
|
|
+ viewBinding.cbBlack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (buttonView.isPressed()) {
|
|
|
+ presenter.changeBlackListMode(targetId, isChecked);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void refresh() {
|
|
|
+ presenter.getBlackList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 举报
|
|
|
+ */
|
|
|
+ private void goAppeal() {
|
|
|
+ if (TextUtils.isEmpty(targetId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ARouter.getInstance().build(TCChatRouterPath.CHAT_IM_APPEAL)
|
|
|
+ .withString("targetId", targetId)
|
|
|
+ .withString("name", "")
|
|
|
+ .withString("type", "PERSON")
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void getBlackListError(int code, String desc) {
|
|
|
+ if (!checkActivityExist()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ToastUtils.showShort("获取黑名单信息失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void getBlackListSuccess(List<V2TIMFriendInfo> v2TIMFriendInfos) {
|
|
|
+ if (!checkActivityExist()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (v2TIMFriendInfos != null) {
|
|
|
+ boolean isOnBlack = find(v2TIMFriendInfos);
|
|
|
+ viewBinding.cbBlack.setChecked(isOnBlack);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void operateSuccess() {
|
|
|
+ if (!checkActivityExist()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean find(List<V2TIMFriendInfo> v2TIMFriendInfos) {
|
|
|
+ for (int i = 0; i < v2TIMFriendInfos.size(); i++) {
|
|
|
+ V2TIMFriendInfo v2TIMFriendInfo = v2TIMFriendInfos.get(i);
|
|
|
+ if (TextUtils.equals(v2TIMFriendInfo.getUserID(), targetId)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected TcActivityChatSingleSettingBinding getLayoutView() {
|
|
|
+ return TcActivityChatSingleSettingBinding.inflate(getLayoutInflater());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected ChatSingleSettingPresenter createPresenter() {
|
|
|
+ return new ChatSingleSettingPresenter();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|