diff --git a/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java b/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java index 13815eca6..8a4e7593f 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java @@ -17,7 +17,11 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ToastUtil; +import java.util.List; + import io.rong.imkit.IMCenter; +import io.rong.imkit.MessageItemLongClickAction; +import io.rong.imkit.MessageItemLongClickActionManager; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Message; import io.rong.message.RecallNotificationMessage; @@ -106,6 +110,8 @@ public class MessageLongClickPopuwindow implements View.OnClickListener { withdrawMethod(); popupWindow.dismiss(); } else if (id == R.id.quote_linear) {//引用 + List messageItemLongClickActionList = MessageItemLongClickActionManager.getInstance().getMessageItemLongClickActions(); + Log.e("", messageItemLongClickActionList.size() + ""); } } diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java index ad2489646..8b5bcd2f4 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java @@ -16,7 +16,6 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.RouteUtil; -import com.yunbao.common.utils.ToastUtil; import org.greenrobot.eventbus.EventBus; @@ -82,6 +81,13 @@ public class MessageIMManager { } + public MessageIMManager setSystemNumber(int systemNumber) { + this.systemNumber = systemNumber; + //发送通知 + unreadMessagesHandler.post(essagesRunnable); + return this; + } + /** * 获取系统消息(有未读数展示红点) */ @@ -159,28 +165,6 @@ public class MessageIMManager { if (callback != null) { callback.onSuccess(code, msg, info); } - if (code == 0) { - List listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class); - if (listUserBean != null && listUserBean.size() >= 2) { - //目前就三条消息,需求判断前两条消息是否有未读消息 - for (int i = 0; i < listUserBean.size(); i++) { - //消息对象 - IMLoginModel userBean = listUserBean.get(i); - //未读消息数 - String number = userBean.getNum(); - //未读消息不为空并且大于0 - try { - if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { - systemNumber = Integer.parseInt(number) + systemNumber; - } - } catch (NumberFormatException e) { - systemNumber = systemNumber + 0; - } - } - //发送通知 - unreadMessagesHandler.post(essagesRunnable); - } - } } }); } @@ -211,7 +195,7 @@ public class MessageIMManager { private ConversationClickListener listener = new ConversationClickListener() { @Override public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String targetId) { - if (!TextUtils.isEmpty(userInfo.getExtra())){ + if (!TextUtils.isEmpty(userInfo.getExtra())) { IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); long userId = IMLoginManager.get(context).getUserInfo().getId(); if (!TextUtils.equals(model.getIsAdmin(), "1") && userId != model.getId()) { @@ -239,9 +223,9 @@ public class MessageIMManager { */ @Override public boolean onMessageLongClick(Context context, View view, Message message) { -// new MessageLongClickPopuwindow((Activity) context) -// .setMessage(message) -// .show(view); + new MessageLongClickPopuwindow((Activity) context) + .setMessage(message) + .show(view); return true; } diff --git a/config.gradle b/config.gradle index 9b81eafd5..a7df60c69 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java b/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java index bd35935ad..c7e5d83e3 100644 --- a/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java @@ -79,7 +79,7 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter { MessageIMManager.get(mContext).getSystemMessages(new MessageIMManager.SystemMessagesHttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if (code==0){ + if (code == 0) { List listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); addSystemMessagesView(listUserBean); } @@ -146,5 +146,20 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter { listUserBean.addAll(mlistUserBean); notifyDataSetChanged(); + int systemNumber = 0; + for (ImUserBean bean : listUserBean) { + //未读消息数 + String number = bean.getNum(); + //未读消息不为空并且大于0 + try { + if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { + systemNumber = Integer.parseInt(number) + systemNumber; + } + } catch (NumberFormatException e) { + systemNumber = systemNumber + 0; + } + } + MessageIMManager.get(mContext).setSystemNumber(systemNumber); + } } 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 5bbcc4f76..6ac1b1e38 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -3,6 +3,7 @@ package com.yunbao.live.dialog; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; +import android.widget.TextView; import androidx.annotation.NonNull; @@ -30,6 +31,10 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { super.onBindViewHolder(holder, position); Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection(); ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt); + TextView rcEdit = holder.getConvertView().findViewById(R.id.rc_edit); + if (rcEdit!=null){ + rcEdit.setVisibility(View.GONE); + } ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new); if (readReceiptNew!=null){ if (messageDirection==Message.MessageDirection.SEND){ diff --git a/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java b/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java index 4dbf42d3f..ab0974698 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java @@ -3,6 +3,7 @@ package com.yunbao.main.adapter; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.os.Handler; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -37,6 +38,8 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { private List listUserBean = new ArrayList<>(); protected Activity mContext; protected LayoutInflater mInflater; + private Handler netHandler = new Handler(); + private int mPosition = -1; public SystemMessageAdapter(Activity mContext) { this.mContext = mContext; @@ -83,16 +86,8 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { } //系统消息的跳转 messageViewHolder.setViewHolderOnClickListener((view, model1) -> { - //获取一下系统通知 - MessageIMManager.get(mContext).getSystemMessages(new MessageIMManager.SystemMessagesHttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - List listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); - addSystemMessagesView(listUserBean); - } - } - }); + mPosition = position; + netHandler.post(updataRunable); if (model1.getContent().equals("在線客服")) { FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null); AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service"); @@ -151,8 +146,26 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { //倒序展示 Collections.reverse(mlistUserBean); listUserBean.clear(); + if (mPosition > 0) { + mlistUserBean.get(mPosition).setNum(""); + } listUserBean.addAll(mlistUserBean); notifyDataSetChanged(); + mPosition = -1; + int systemNumber = 0; + for (ImUserBean bean : listUserBean) { + //未读消息数 + String number = bean.getNum(); + //未读消息不为空并且大于0 + try { + if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { + systemNumber = Integer.parseInt(number) + systemNumber; + } + } catch (NumberFormatException e) { + systemNumber = systemNumber + 0; + } + } + MessageIMManager.get(mContext).setSystemNumber(systemNumber); } /** @@ -177,4 +190,20 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { } notifyDataSetChanged(); } + + private Runnable updataRunable = new Runnable() { + @Override + public void run() { + //获取一下系统通知 + MessageIMManager.get(mContext).getSystemMessages(new MessageIMManager.SystemMessagesHttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + List listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); + addSystemMessagesView(listUserBean); + } + } + }); + } + }; }