|
@@ -1,6 +1,7 @@
|
|
|
package com.common.im.ui.activity;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
@@ -30,6 +31,11 @@ import com.cooleshow.base.common.BaseApplication;
|
|
|
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.ToastUtil;
|
|
|
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
+import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
|
|
|
+import com.cooleshow.base.widgets.dialog.CommonDialog;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.util.ArrayList;
|
|
@@ -37,6 +43,8 @@ import java.util.List;
|
|
|
|
|
|
import io.rong.imkit.RongIM;
|
|
|
import io.rong.imkit.userinfo.model.GroupUserInfo;
|
|
|
+import io.rong.imkit.utils.helper.ChatGroupHelper;
|
|
|
+import io.rong.imlib.RongIMClient;
|
|
|
import io.rong.imlib.model.Conversation;
|
|
|
|
|
|
/**
|
|
@@ -48,6 +56,7 @@ import io.rong.imlib.model.Conversation;
|
|
|
@Route(path = RouterPath.ChatCenter.CHAT_GROUP_SETTING)
|
|
|
public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupSettingBinding, ChatGroupSettingPresenter> implements ChatGroupSettingContract.ChatGroupSettingView, View.OnClickListener {
|
|
|
private final int REQUEST_GROUP_REMARKS_CODE = 100;
|
|
|
+
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
if (view.getId() == R.id.ll_history_message) {
|
|
@@ -60,13 +69,14 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_GROUP_SET_REMARK)
|
|
|
.withString("targetId", targetId)
|
|
|
.withString("remarks", tv_group_name_remarks.getText().toString().trim())
|
|
|
- .navigation(this,REQUEST_GROUP_REMARKS_CODE);
|
|
|
+ .navigation(this, REQUEST_GROUP_REMARKS_CODE);
|
|
|
} else if (view.getId() == R.id.tv_group_member_list) {
|
|
|
//查看联系人
|
|
|
- ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_GROUP_MEMBER)
|
|
|
- .withSerializable("list", (Serializable) data)
|
|
|
- .navigation();
|
|
|
-
|
|
|
+ if(data!=null){
|
|
|
+ ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_GROUP_MEMBER)
|
|
|
+ .withSerializable("list", (Serializable) data)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
} else if (view.getId() == R.id.tv_group_apply_count) {
|
|
|
//查看入群申请
|
|
|
ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_GROUP_JOIN_APPLY)
|
|
@@ -85,12 +95,39 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
.withString("targetId", targetId)
|
|
|
.navigation();
|
|
|
} else if (view.getId() == R.id.btn_confirm) {
|
|
|
- //发消息
|
|
|
finish();
|
|
|
+// if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+// //老师端解散群组
|
|
|
+// showConfirmDialog();
|
|
|
+// } else {
|
|
|
+// //发消息
|
|
|
+// finish();
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void showConfirmDialog() {
|
|
|
+ CommonDialog commonDialog = new CommonDialog(this);
|
|
|
+ commonDialog.setTitle("提示");
|
|
|
+ commonDialog.setContent("确认解散群组吗?");
|
|
|
+ commonDialog.setOnConfirmClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+// presenter.delLocalConversation();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ commonDialog.setOnCancelClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (commonDialog != null) {
|
|
|
+ commonDialog.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private ImageView iv_portrait;
|
|
|
private TextView tv_group_name;
|
|
|
private TextView tv_class_num;
|
|
@@ -103,6 +140,12 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
MessageSettingGroupMemberAdapter adapter;
|
|
|
|
|
|
@Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ QMUIStatusBarHelper.setStatusBarLightMode(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
protected void initView() {
|
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "群设置");
|
|
|
iv_portrait = viewBinding.ivPortrait;
|
|
@@ -111,6 +154,15 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
tv_group_member_list = viewBinding.tvGroupMemberList;
|
|
|
tv_group_member_list.setOnClickListener(this);
|
|
|
recyclerView = viewBinding.recyclerView;
|
|
|
+
|
|
|
+ Button btnConfirm = viewBinding.btnConfirm;
|
|
|
+ if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+ btnConfirm.setText("发消息");
|
|
|
+ viewBinding.llChatJoinApply.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ btnConfirm.setText("发消息");
|
|
|
+ viewBinding.llChatJoinApply.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
tv_group_apply_count = viewBinding.tvGroupApplyCount;
|
|
|
tv_group_apply_count.setOnClickListener(this);
|
|
|
tv_group_name_remarks = viewBinding.tvGroupNameRemarks;
|
|
@@ -207,16 +259,11 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
if (!BaseApplication.Companion.isTeacherClient()) {
|
|
|
GlideUtils.INSTANCE.loadImage(this, data.getImg(), iv_portrait, R.drawable.rc_default_group_portrait_stu);
|
|
|
} else {
|
|
|
- if (TextUtils.isEmpty(data.getType()) || (!data.getType().equals("VIP") && !data.getType().equals("COMM"))) {
|
|
|
- GlideUtils.INSTANCE.loadImage(this, data.getImg(), iv_portrait, R.drawable.ic_group_list_mussic_team_stu);
|
|
|
- } else {
|
|
|
- GlideUtils.INSTANCE.loadImage(this, data.getImg(), iv_portrait, R.drawable.ic_group_list_vip);
|
|
|
-
|
|
|
- }
|
|
|
+ iv_portrait.setImageResource(ChatGroupHelper.getChatGroupAvatarFromId(data.getId()));
|
|
|
}
|
|
|
- if (!TextUtils.isEmpty(data.getMemo())) {
|
|
|
+ if (!TextUtils.isEmpty(data.getMemberNum())) {
|
|
|
tv_class_num.setVisibility(View.VISIBLE);
|
|
|
- tv_class_num.setText(data.getMemo());
|
|
|
+ tv_class_num.setText(data.getMemberNum() + "/500");
|
|
|
} else {
|
|
|
tv_class_num.setVisibility(View.GONE);
|
|
|
}
|
|
@@ -226,10 +273,16 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<ActivityChatGroupS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void dissolveChatGroupSuccess(String targetId) {
|
|
|
+ ToastUtil.getInstance().showShort("解散成功");
|
|
|
+ JumpUtils.jumpMain(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
- if (resultCode==RESULT_OK){
|
|
|
- if (requestCode==REQUEST_GROUP_REMARKS_CODE){
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (requestCode == REQUEST_GROUP_REMARKS_CODE) {
|
|
|
tv_group_name_remarks.setText(data.getStringExtra("remarks"));
|
|
|
tv_group_name.setText(data.getStringExtra("remarks"));
|
|
|
}
|