正在查看: 新暖心缘 v8.1.1 应用的 ImGroupActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 ImGroupActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.luanxingyuan.app.activity;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.bean.MessageBean;
import com.luanxingyuan.app.util.TimeUtil;
import com.luanxingyuan.app.view.recycle.a;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.tencent.imsdk.TIMConversation;
import com.tencent.imsdk.TIMConversationType;
import com.tencent.imsdk.TIMGroupManager;
import com.tencent.imsdk.TIMManager;
import com.tencent.imsdk.TIMMessage;
import com.tencent.imsdk.TIMMessageListener;
import com.tencent.imsdk.TIMValueCallBack;
import com.tencent.imsdk.conversation.ConversationManager;
import com.tencent.imsdk.ext.group.TIMGroupDetailInfoResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class ImGroupActivity extends BaseActivity implements TIMMessageListener {
private com.luanxingyuan.app.view.recycle.a adapter;
Handler handler = new Handler(Looper.getMainLooper());
Runnable messageRun = new e();
@BindView
RecyclerView recyclerView;
@BindView
SmartRefreshLayout smartRefreshLayout;
class a implements s7.d {
a() {
}
@Override
public void d(m7.i iVar) {
ImGroupActivity.this.updateConversation();
}
}
class b extends com.luanxingyuan.app.view.recycle.a {
class a implements View.OnClickListener {
final com.luanxingyuan.app.view.recycle.f f6319a;
a(com.luanxingyuan.app.view.recycle.f fVar) {
this.f6319a = fVar;
}
@Override
public void onClick(View view) {
MessageBean messageBean = (MessageBean) b.this.e().get(this.f6319a.f());
o6.g.M(((BaseActivity) ImGroupActivity.this).mContext, messageBean.nickName, messageBean.t_id);
}
}
b(a.b... bVarArr) {
super(bVarArr);
}
@Override
public void d(com.luanxingyuan.app.view.recycle.f fVar, Object obj) {
MessageBean messageBean = (MessageBean) obj;
com.bumptech.glide.b.x(((BaseActivity) ImGroupActivity.this).mContext).p(messageBean.headImg).i(2131231303).p0(new d3.k()).G0((ImageView) fVar.getView(2131296783));
((TextView) fVar.getView(2131297340)).setText(messageBean.nickName);
((TextView) fVar.getView(2131297332)).setText(TimeUtil.getTimeStr(messageBean.t_create_time));
((TextView) fVar.getView(2131296563)).setText(messageBean.lastMessage);
TextView textView = (TextView) fVar.getView(2131297141);
long j8 = messageBean.unReadCount;
if (j8 <= 0) {
textView.setVisibility(8);
return;
}
if (j8 <= 99) {
textView.setText(String.valueOf(j8));
textView.setBackgroundResource(2131231555);
} else {
textView.setText(2131821070);
textView.setBackgroundResource(2131231556);
}
textView.setVisibility(0);
}
@Override
public int getItemViewType(int i8) {
return 2131493202;
}
@Override
public void k(com.luanxingyuan.app.view.recycle.f fVar) {
fVar.getView(2131296270).setOnClickListener(new a(fVar));
}
}
class c implements q6.a<Object> {
c() {
}
@Override
public void execute(Object obj) {
if (ImGroupActivity.this.isFinishing()) {
return;
}
ImGroupActivity.this.updateConversation();
}
}
class d implements TIMValueCallBack<List<TIMGroupDetailInfoResult>> {
final Map f6322a;
final List f6323b;
d(Map map, List list) {
this.f6322a = map;
this.f6323b = list;
}
@Override
public void onSuccess(List<TIMGroupDetailInfoResult> list) {
if (ImGroupActivity.this.isFinishing()) {
return;
}
for (TIMGroupDetailInfoResult tIMGroupDetailInfoResult : list) {
MessageBean messageBean = (MessageBean) this.f6322a.get(tIMGroupDetailInfoResult.getGroupId());
if (messageBean != null) {
messageBean.nickName = tIMGroupDetailInfoResult.getGroupName();
messageBean.headImg = tIMGroupDetailInfoResult.getFaceUrl();
}
}
ImGroupActivity.this.adapter.i(this.f6323b);
}
@Override
public void onError(int i8, String str) {
}
}
class e implements Runnable {
e() {
}
@Override
public void run() {
if (ImGroupActivity.this.isFinishing()) {
return;
}
ImGroupActivity.this.updateConversation();
}
}
public void updateConversation() {
List<TIMConversation> conversationList = ConversationManager.getInstance().getConversationList();
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
HashMap hashMap = new HashMap();
for (TIMConversation tIMConversation : conversationList) {
if (tIMConversation.getType() == TIMConversationType.Group && o6.g.x(tIMConversation.getPeer())) {
arrayList2.add(tIMConversation.getPeer());
MessageBean messageBean = new MessageBean();
arrayList.add(messageBean);
hashMap.put(tIMConversation.getPeer(), messageBean);
messageBean.t_id = tIMConversation.getPeer();
messageBean.nickName = tIMConversation.getGroupName();
messageBean.unReadCount = tIMConversation.getUnreadMessageNum();
TIMMessage lastMsg = tIMConversation.getLastMsg();
if (lastMsg != null) {
messageBean.lastMessage = com.luanxingyuan.app.im.c.j(lastMsg);
messageBean.t_create_time = lastMsg.timestamp();
}
}
}
TIMGroupManager.getInstance().getGroupInfo(arrayList2, new d(hashMap, arrayList));
this.smartRefreshLayout.b(500);
}
@Override
protected View getContentView() {
return inflate(2131492954);
}
@Override
protected void onContentAdded() {
setTitle("群消息");
TIMManager.getInstance().addMessageListener(this);
this.smartRefreshLayout.f(false);
this.smartRefreshLayout.T(new a());
this.adapter = new b(new a.b[0]);
this.recyclerView.setLayoutManager(new LinearLayoutManager(this));
this.recyclerView.setAdapter(this.adapter);
o6.g.H(new c());
}
@Override
protected void onDestroy() {
TIMManager.getInstance().removeMessageListener(this);
super.onDestroy();
}
@Override
public boolean onNewMessages(List<TIMMessage> list) {
boolean z7;
Iterator<TIMMessage> it = list.iterator();
while (true) {
if (!it.hasNext()) {
z7 = false;
break;
}
if (it.next().getConversation().getType() == TIMConversationType.Group) {
z7 = true;
break;
}
}
if (z7) {
this.handler.removeCallbacks(this.messageRun);
this.handler.postDelayed(this.messageRun, 500L);
}
return false;
}
@Override
protected void onResume() {
super.onResume();
updateConversation();
}
}