From 51ab918327ed2eaf5b00ccb3a10a2bde88cdf975 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 1 Apr 2024 10:47:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E6=8D=A2=E8=AE=BE=E5=A4=87=E5=B7=B2?= =?UTF-8?q?=E8=AF=BB=E8=81=8A=E5=A4=A9=E4=BF=A1=E6=81=AF=E4=BE=9D=E6=97=A7?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=97=AE=E9=A2=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 13 +++- .../common/adapter/DebugDialogAdapter.java | 59 ++++++++++++++ .../com/yunbao/common/dialog/DebugDialog.java | 76 +++++++++++++++++++ .../dialog/MessageChatNotifyDialog.java | 14 +++- .../dialog/MessageSayHiNotifyDialog.java | 16 ++-- .../utils/MessageChatNotifyManager.java | 58 ++++++++++++-- common/src/main/res/layout/dialog_debug.xml | 11 +++ .../live/dialog/PDLiveMessageListAdapter.java | 19 +++++ .../yunbao/main/activity/EntryActivity.java | 2 + .../yunbao/main/activity/MainActivity.java | 18 +++++ .../activity/PDLiveConversationActivity.java | 5 +- .../MainMsgAddressBookListAdapter.java | 16 +++- .../main/views/MainMessageViewHolder.java | 4 +- 13 files changed, 287 insertions(+), 24 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java create mode 100644 common/src/main/java/com/yunbao/common/dialog/DebugDialog.java create mode 100644 common/src/main/res/layout/dialog_debug.xml diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 6042111..f37ac80 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -4,6 +4,7 @@ import static com.yunbao.live.socket.SocketClient.mSocketHandler; import android.app.Activity; import android.app.ActivityManager; +import android.app.LauncherActivity; import android.content.Context; import android.net.http.HttpResponseCache; import android.os.Build; @@ -38,6 +39,7 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.CrashSaveBean; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.event.SudGameSocketImEvent; import com.yunbao.common.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; @@ -69,6 +71,7 @@ import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MainHomeCommunityActivity; import com.yunbao.main.activity.MsgSettActivity; import com.yunbao.main.activity.PDLiveConversationActivity; +import com.yunbao.main.activity.RegisterActivity; import com.yunbao.video.activity.VideoPlayActivity; import org.greenrobot.eventbus.EventBus; @@ -106,6 +109,7 @@ public class AppContext extends CommonAppContext { @Override public void onActivityResumed(Activity activity) { Log.e("打招呼定时器", "onActivityResumed: " + activity); + MessageChatNotifyManager.getInstance().restart(activity); if (activity instanceof LiveActivity) { MessageSayHiNotifyManager.getInstance().stop(); return; @@ -254,6 +258,11 @@ public class AppContext extends CommonAppContext { //注册屏蔽push弹窗的类 MessageChatNotifyManager.getInstance().addShieldClass(CompleteUserInfoActivity.class); MessageChatNotifyManager.getInstance().addShieldClass(PDLiveConversationActivity.class); + MessageChatNotifyManager.getInstance().addShieldClass(LauncherActivity.class); + MessageChatNotifyManager.getInstance().addShieldClass(EntryActivity.class); + MessageChatNotifyManager.getInstance().addShieldClass(LoginActivity.class); + MessageChatNotifyManager.getInstance().addShieldClass(RegisterActivity.class); + RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() { @Override @@ -291,14 +300,16 @@ public class AppContext extends CommonAppContext { if (AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity) { return false; } + Log.i("聊天推送", message.getTargetId() + "是否已读:" + message.getReceivedStatus().isRead()); if (message.getReceivedStatus().isRead()) { return false; } - RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, message.getTargetId(), new RongIMClient.ResultCallback() { @Override public void onSuccess(Integer integer) { + DebugDialog.getInstance(AppManager.getActivity(MainActivity.class)).setParams("推送" + message.getTargetId(), "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer); if (integer > 0) { + Log.i("聊天推送", message.getTargetId() + "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer); MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity() , message.getTargetId(), content.getContent() diff --git a/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java new file mode 100644 index 0000000..ca04fe7 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java @@ -0,0 +1,59 @@ +package com.yunbao.common.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.view.TextureView; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class DebugDialogAdapter extends RecyclerView.Adapter { + TreeMap paramMap = new TreeMap<>(); + private Context mContext; + + public DebugDialogAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setParamMap(TreeMap paramMap) { + this.paramMap = paramMap; + notifyDataSetChanged(); + } + + @NonNull + @Override + public DebugViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new DebugViewHolder(new TextView(mContext)); + } + + @Override + public void onBindViewHolder(@NonNull DebugViewHolder holder, int position) { + List list = new ArrayList<>(paramMap.keySet()); + holder.setData(list.get(position), paramMap.get(list.get(position))); + } + + @Override + public int getItemCount() { + return paramMap.size(); + } + + public class DebugViewHolder extends RecyclerView.ViewHolder { + + public DebugViewHolder(@NonNull View itemView) { + super(itemView); + } + + public void setData(String tag, String msg) { + ((TextView) itemView).setText(tag + ":" + msg); + ((TextView) itemView).setTextColor(Color.BLACK); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java new file mode 100644 index 0000000..ea6f6ea --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java @@ -0,0 +1,76 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lzf.easyfloat.EasyFloat; +import com.lzf.easyfloat.enums.ShowPattern; +import com.lzf.easyfloat.interfaces.OnPermissionResult; +import com.lzf.easyfloat.permission.PermissionUtils; +import com.yunbao.common.CommonAppContext; +import com.yunbao.common.adapter.DebugDialogAdapter; +import com.yunbao.common.utils.ToastUtil; + +import java.util.TreeMap; + + +public class DebugDialog { + RecyclerView recyclerView; + TreeMap params; + DebugDialogAdapter adapter; + private static DebugDialog debugDialog; + Context mContext; + + public static DebugDialog getInstance(Activity mainActivity) { + if (debugDialog == null) { + debugDialog = new DebugDialog(mainActivity); + } + return debugDialog; + } + + public DebugDialog clear() { + params.clear(); + return this; + } + + public void setParams(String tag, String msg) { + params.put(tag, msg); + if (adapter != null) + adapter.setParamMap(params); + } + + private DebugDialog(Context mContext) { + this.mContext = mContext; + params = new TreeMap<>(); + if (PermissionUtils.checkPermission(mContext)) { + createView(); + } else { + PermissionUtils.requestPermission((Activity) mContext, new OnPermissionResult() { + @Override + public void permissionResult(boolean b) { + ToastUtil.show("悬浮权限" + b); + if (b) { + createView(); + } + } + }); + } + } + + protected void createView() { + recyclerView = new RecyclerView(mContext); + adapter = new DebugDialogAdapter(mContext); + recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + recyclerView.setAdapter(adapter); + recyclerView.setBackgroundColor(Color.WHITE); + EasyFloat.with(mContext) + .setTag("debug") + .setShowPattern(ShowPattern.ALL_TIME) + .setLayout(recyclerView) + .show(); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/MessageChatNotifyDialog.java b/common/src/main/java/com/yunbao/common/dialog/MessageChatNotifyDialog.java index 9265111..d596178 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageChatNotifyDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageChatNotifyDialog.java @@ -16,13 +16,12 @@ import com.yunbao.common.custom.RatioRoundImageView; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.StringUtil; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.ViewUtils; import io.rong.imkit.utils.RouteUtils; import io.rong.imlib.model.Conversation; public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow { + private static boolean dialogStatusShow =false; private MessageUserInfoBean liveBean; private DialogInterface.OnDismissListener onDismissListener; @@ -44,6 +43,10 @@ public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow { return this; } + public static boolean isDialogStatusShow() { + return dialogStatusShow; + } + @Override public void buildDialog(XPopup.Builder builder) { builder.positionByWindowCenter(true); @@ -67,6 +70,13 @@ public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow { @Override protected void onShow() { super.onShow(); + dialogStatusShow =true; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + dialogStatusShow =false; } @Override diff --git a/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java b/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java index dd88f56..f4532aa 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java @@ -86,7 +86,7 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { @Override protected void onCreate() { super.onCreate(); - if(userInfoBean.getId()==0){ + if (userInfoBean.getId() == 0) { dismiss(); return; } @@ -101,12 +101,12 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { anchorName = findViewById(R.id.anchorName); ImgLoader.display(mContext, userInfoBean.getUser().getAvatar(), avatar); anchorName.setText(userInfoBean.getUser().getUserNicename()); - // ((TextView) findViewById(R.id.description)).setText(userInfoBean.getUser().getSignature()); - ((TextView) findViewById(R.id.description)).setText(WordUtil.isNewZh()?"他就在你附近,來看看~":"He is near you, come and see~"); + // ((TextView) findViewById(R.id.description)).setText(userInfoBean.getUser().getSignature()); + ((TextView) findViewById(R.id.description)).setText(WordUtil.isNewZh() ? "他就在你附近,來看看~" : "He is near you, come and see~"); ViewUtils.findViewById(findViewById(R.id.age), R.id.tag, TextView.class).setText(String.format("%s%s%s", - WordUtil.getNewString(R.string.dialog_message_say_hi_age) - , userInfoBean.getInfo().getAge() - ,WordUtil.isNewZh()?"歲":"years old" + WordUtil.getNewString(R.string.dialog_message_say_hi_age) + , userInfoBean.getInfo().getAge() + , WordUtil.isNewZh() ? "歲" : "years old" ) ); showTag(); @@ -115,8 +115,8 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { private void showTag() { List tags = new ArrayList<>(); tags.add(userInfoBean.getInfo().getSex() == 1 ? WordUtil.getNewString(R.string.sex_male) : WordUtil.getNewString(R.string.sex_female)); - if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())) { - tags.add(userInfoBean.getInfo().getCareer()); + if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer(), userInfoBean.getInfo().getEnCareer())) { + tags.add(WordUtil.isNewZh() ? userInfoBean.getInfo().getCareer() : userInfoBean.getInfo().getEnCareer()); } if (!StringUtil.isEmpty(userInfoBean.getInfo().getHeight()) && !userInfoBean.getInfo().getHeight().equals("0")) { tags.add(userInfoBean.getInfo().getHeight()); diff --git a/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java b/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java index ec426cd..3c6a677 100644 --- a/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java +++ b/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java @@ -1,15 +1,22 @@ package com.yunbao.common.utils; +import android.app.Activity; import android.content.Context; +import android.util.Log; import com.yunbao.common.bean.MessageUserInfoBean; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.dialog.MessageChatNotifyDialog; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; + public class MessageChatNotifyManager { private static MessageChatNotifyManager instance; private List startListNotifyList = new ArrayList<>(); @@ -34,23 +41,51 @@ public class MessageChatNotifyManager { notifyLiveFlot(mContext); } else { startListNotifyList.add(userInfo); + if (!MessageChatNotifyDialog.isDialogStatusShow()) { + notifyLiveFlot(mContext); + } } } - private void notifyLiveFlot(Context mContext) { + public void restart(Context mContext) { + notifyLiveFlot(mContext); + } + + + private synchronized void notifyLiveFlot(Context mContext) { String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName(); if (clazzList.contains(simpleName)) { ToastUtil.showDebug("屏蔽类,不展示"); return; } + DebugDialog.getInstance((Activity) mContext).setParams("待推送通知数", startListNotifyList.size() + ""); if (startListNotifyList.iterator().hasNext()) { MessageUserInfoBean bean = startListNotifyList.iterator().next(); - new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> { - startListNotifyList.remove(bean); - if (startListNotifyList.iterator().hasNext()) { + RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, bean.getUser().getId() + "", new RongIMClient.ResultCallback() { + @Override + public void onSuccess(Integer integer) { + if (integer > 0) { + new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> { + startListNotifyList.remove(bean); + if (startListNotifyList.iterator().hasNext()) { + notifyLiveFlot(mContext); + } + }).showDialog(); + } else { + Iterator iterator = startListNotifyList.iterator(); + while (iterator.hasNext()) { + if (iterator.next().getUser().getId() == bean.getUser().getId()) { + iterator.remove(); + } + } + } + } + + @Override + public void onError(RongIMClient.ErrorCode e) { notifyLiveFlot(mContext); } - }).showDialog(); + }); } else { ToastUtil.showDebug("Not Message"); } @@ -71,4 +106,17 @@ public class MessageChatNotifyManager { } }); } + + public void clear() { + startListNotifyList.clear(); + } + + public void clear(long id) { + Iterator iterator = startListNotifyList.iterator(); + while (iterator.hasNext()) { + if (iterator.next().getUser().getId() == id) { + iterator.remove(); + } + } + } } diff --git a/common/src/main/res/layout/dialog_debug.xml b/common/src/main/res/layout/dialog_debug.xml new file mode 100644 index 0000000..93a32d3 --- /dev/null +++ b/common/src/main/res/layout/dialog_debug.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java index 2d0d704..ca4f58a 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.Color; import android.provider.Settings; import android.text.TextUtils; +import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; @@ -36,6 +37,7 @@ import io.rong.imkit.utils.language.LangUtils; import io.rong.imkit.utils.language.RongConfigurationManager; import io.rong.imkit.widget.adapter.IViewProviderListener; import io.rong.imkit.widget.adapter.ViewHolder; +import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Message; import io.rong.imlib.model.MessageContent; @@ -72,6 +74,23 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { holder.itemView.setBackgroundColor(Color.parseColor("#00000000")); ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new); + if(messageDirection==Message.MessageDirection.RECEIVE){ + RongIMClient.getInstance().syncConversationReadStatus(mDataList.get(position).getConversationType(), + mDataList.get(position).getTargetId(), + mDataList.get(position).getSentTime(), + new RongIMClient.OperationCallback() { + @Override + public void onSuccess() { + Log.i("聊天推送", "同步消息成功"); + } + + @Override + public void onError(RongIMClient.ErrorCode errorCode) { + Log.i("聊天推送", "同步消息失败:"+errorCode); + } + }); + } + if (readReceiptNew != null) { if (messageDirection == Message.MessageDirection.SEND) { readReceiptNew.setVisibility(View.VISIBLE); diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index d538171..2171f5a 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -84,6 +84,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.MessageChatNotifyManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.http.LiveHttpUtil; @@ -184,6 +185,7 @@ public class EntryActivity extends AppCompatActivity { activity = this; Contexts = this; setStatusBar(); + MessageChatNotifyManager.getInstance().clear(); lt_btn_facebook = findViewById(R.id.lt_btn_facebook); lt_btn_twitter = findViewById(R.id.lt_btn_twitter); btn_tip = findViewById(R.id.btn_tip); diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index f67411d..255f08c 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -17,6 +17,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.text.TextUtils; import android.util.Log; import android.view.Display; @@ -67,6 +68,7 @@ import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.UpdataListBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.custom.TabButtonGroup; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.dialog.HintDialog; import com.yunbao.common.dialog.InstructorOperationDialog; import com.yunbao.common.event.CompleteInformationEvent; @@ -150,9 +152,12 @@ import cn.rongcloud.rtc.api.RCRTCConfig; import cn.rongcloud.rtc.api.RCRTCEngine; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; +import io.rong.imkit.RongIM; import io.rong.imkit.config.RongConfigCenter; import io.rong.imkit.notification.NotificationConfig; +import io.rong.imlib.RongCoreClient; import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Message; import kotlin.Unit; @@ -225,6 +230,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene ActivityCompat.postponeEnterTransition(this); ConversationIMListManager.get(this); OpenAdManager.getInstance(); + new Handler(Looper.getMainLooper()) + .postDelayed(new Runnable() { + @Override + public void run() { + DebugDialog.getInstance(mContext).setParams("Debug", "悬浮层"); + } + }, 1000); UserInfoManager.updateMyInfo(this, null); //在请求一下这个接口给我后台版本号 CommonHttpUtil.getConfig(mContext, new CommonCallback() { @@ -266,6 +278,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene RCRTCConfig.Builder config = RCRTCConfig.Builder.create(); config.enableEncoderTexture(false);//新娱美颜 需要关闭这个 RCRTCEngine.getInstance().init(MainActivity.this, config.build()); + ConversationIMListManager.get(mContext).addUserInfoProvider(); + requestNotReadMessage(); //推送跳直播间 if (getIntent().getStringExtra("liveid") != null) { LiveHttpUtil.getLiveInfo(getIntent().getStringExtra("liveid") + "", new HttpCallback() { @@ -550,6 +564,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene showFirstLogin(); } + private void requestNotReadMessage() { + + } + private void showFirstLogin() { LiveNetManager.get(mContext).isFirstLogin(new com.yunbao.common.http.base.HttpCallback() { @Override diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java index 9a3416d..3efcd13 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java @@ -47,6 +47,7 @@ import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; +import com.yunbao.common.utils.MessageChatNotifyManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; @@ -108,6 +109,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl @Override protected void main() { super.main(); + targetId = getIntent().getStringExtra("targetId"); EventBus.getDefault().register(this); mContext = this; getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); @@ -116,13 +118,13 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl WindowSoftModeAdjustResizeExecutor.assistActivity(this); //设置会话界面操作监听器 MessageIMManager.get(this).addConversationClickListener(); + MessageChatNotifyManager.getInstance().clear(Long.parseLong(targetId)); } @Override protected void onResume() { super.onResume(); setUserCard(); - ConversationIMListManager.get(mContext).addUserInfoProvider(); } private void hideUserCard() { @@ -228,7 +230,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl private void initView() { try { // 添加会话界面 - targetId = getIntent().getStringExtra("targetId"); conversationFragment = new PDLiveConversationFragment(targetId); FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); diff --git a/main/src/main/java/com/yunbao/main/adapter/MainMsgAddressBookListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainMsgAddressBookListAdapter.java index 37e6ba6..42fb4d7 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainMsgAddressBookListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainMsgAddressBookListAdapter.java @@ -14,6 +14,7 @@ import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -23,8 +24,10 @@ import com.yunbao.main.fragment.MyAddressBookFragment; import java.util.ArrayList; import java.util.List; +import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.widget.adapter.BaseAdapter; import io.rong.imkit.widget.adapter.ViewHolder; +import io.rong.imlib.model.Conversation; public class MainMsgAddressBookListAdapter extends BaseAdapter { public static final int TYPE_SEARCH_TITLE = 500; @@ -85,10 +88,15 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter { - /* MessageChatUserBean userBean = (MessageChatUserBean) view.getTag(); - RouteUtils.routeToConversationActivity(view.getContext(), - Conversation.ConversationType.PRIVATE, - userBean.getId());*/ + AppManager.runDebugCode(new Runnable() { + @Override + public void run() { + MessageChatUserBean userBean = (MessageChatUserBean) view.getTag(); + RouteUtils.routeToConversationActivity(view.getContext(), + Conversation.ConversationType.PRIVATE, + userBean.getId()); + } + }); }); } diff --git a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java index 529ed2a..3eb16e9 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -136,8 +136,8 @@ public class MainMessageViewHolder extends AbsMainViewHolder { search = findViewById(R.id.search); contacts.setOnClickListener(view -> { //通讯录 - //RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK); - mContext.startActivity(new Intent(mContext, com.yunbao.main.activity.CompleteUserInfoActivity.class)); + RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK); + // mContext.startActivity(new Intent(mContext, com.yunbao.main.activity.CompleteUserInfoActivity.class)); // mContext.startActivity(new Intent(mContext, MessageHiConfigRecordActivity.class)); }); search.addTextChangedListener(new TextWatcher() {