From cc35227b56bc383ab15e40533d6e3424d127f75b Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 23 Jul 2022 16:31:33 +0800 Subject: [PATCH] 11111 --- .../yunbao/common/bean/ImUserInfoModel.java | 141 ++++++++++++++++++ .../manager/imrongcloud/MessageIMManager.java | 87 ++++++++++- common/src/main/res/values/strings.xml | 1 + config.gradle | 4 +- live/src/main/AndroidManifest.xml | 11 +- .../activity/PDLiveConversationActivity.java | 45 ++++-- .../java/com/yunbao/live/bean/ImUserBean.java | 109 +++++++++----- .../dialog/MessageLongClickPopuwindow.java | 26 ++++ .../live/dialog/PDLiveMessageListAdapter.java | 17 ++- .../live/event/InputPanelViewHolderEvent.java | 9 ++ .../WindowSoftModeAdjustResizeExecutor.java | 48 ++++++ .../live/views/InputPanelViewHolder.java | 42 ++++-- .../res/layout/rc_conversationlist_item.xml | 5 +- .../res/layout/view_message_long_click.xml | 67 +++++++++ .../res/mipmap-xhdpi/icon_message_copy.png | Bin 0 -> 470 bytes .../res/mipmap-xhdpi/icon_message_quote.png | Bin 0 -> 1453 bytes .../mipmap-xhdpi/icon_messagelist_read.png | Bin 0 -> 2495 bytes .../mipmap-xhdpi/icon_messagelist_unread.png | Bin 0 -> 3312 bytes .../yunbao/main/activity/MainActivity.java | 14 +- .../PDLiveConversationListActivity.java | 17 ++- .../main/adapter/SystemMessageAdapter.java | 36 ++++- .../ConversationIMListManager.java | 2 +- .../PDLiveCustomConversationProvider.java | 17 +-- .../res/layout/activity_conversation_list.xml | 6 +- main/src/main/res/layout/view_homemain.xml | 6 +- .../res/layout/view_system_message_item.xml | 6 +- 26 files changed, 603 insertions(+), 113 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java create mode 100644 live/src/main/java/com/yunbao/live/dialog/MessageLongClickPopuwindow.java create mode 100644 live/src/main/java/com/yunbao/live/event/InputPanelViewHolderEvent.java create mode 100644 live/src/main/java/com/yunbao/live/utils/WindowSoftModeAdjustResizeExecutor.java create mode 100644 live/src/main/res/layout/view_message_long_click.xml create mode 100644 live/src/main/res/mipmap-xhdpi/icon_message_copy.png create mode 100644 live/src/main/res/mipmap-xhdpi/icon_message_quote.png create mode 100644 live/src/main/res/mipmap-xhdpi/icon_messagelist_read.png create mode 100644 live/src/main/res/mipmap-xhdpi/icon_messagelist_unread.png diff --git a/common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java b/common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java new file mode 100644 index 000000000..daf6510d2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java @@ -0,0 +1,141 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +/** + * r融雲發送的系統消息通知 + */ +public class ImUserInfoModel extends BaseModel { + @SerializedName("title") + String title;// + @SerializedName("image") + String image;//头像 + @SerializedName("content") + String content;//最新一条内容 + @SerializedName("addtime") + String addtime;//最后时间 + @SerializedName("num") + String num;//未读消息数 + @SerializedName("link") + String link;//跳转连接 + @SerializedName("type") + String type;// + @SerializedName("userId") + String userId;//单聊的id + @SerializedName("remarks") + String remarks;//备注的信息 + @SerializedName("is_admin") + String isAdmin; + @SerializedName("isDelet") + String isDelet; + @SerializedName("_method_") + String method="";//融雲消息類型 + + public String getTitle() { + return title; + } + + public ImUserInfoModel setTitle(String title) { + this.title = title; + return this; + } + + public String getImage() { + return image; + } + + public ImUserInfoModel setImage(String image) { + this.image = image; + return this; + } + + public String getContent() { + return content; + } + + public ImUserInfoModel setContent(String content) { + this.content = content; + return this; + } + + public String getAddtime() { + return addtime; + } + + public ImUserInfoModel setAddtime(String addtime) { + this.addtime = addtime; + return this; + } + + public String getNum() { + return num; + } + + public ImUserInfoModel setNum(String num) { + this.num = num; + return this; + } + + public String getLink() { + return link; + } + + public ImUserInfoModel setLink(String link) { + this.link = link; + return this; + } + + public String getType() { + return type; + } + + public ImUserInfoModel setType(String type) { + this.type = type; + return this; + } + + public String getUserId() { + return userId; + } + + public ImUserInfoModel setUserId(String userId) { + this.userId = userId; + return this; + } + + public String getRemarks() { + return remarks; + } + + public ImUserInfoModel setRemarks(String remarks) { + this.remarks = remarks; + return this; + } + + public String getIsAdmin() { + return isAdmin; + } + + public ImUserInfoModel setIsAdmin(String isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public String getIsDelet() { + return isDelet; + } + + public ImUserInfoModel setIsDelet(String isDelet) { + this.isDelet = isDelet; + return this; + } + + public String getMethod() { + return method; + } + + public ImUserInfoModel setMethod(String method) { + this.method = method; + return this; + } +} 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 dd1f125b9..1c2484c15 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 @@ -3,21 +3,30 @@ package com.yunbao.common.manager.imrongcloud; import android.content.Context; import android.os.Handler; import android.text.TextUtils; +import android.view.View; import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; import org.greenrobot.eventbus.EventBus; import java.util.Arrays; import java.util.List; +import io.rong.imkit.IMCenter; +import io.rong.imkit.config.ConversationClickListener; import io.rong.imkit.manager.UnReadMessageManager; import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.Message; +import io.rong.imlib.model.UserInfo; +import io.rong.message.TextMessage; /** * 消息的监听管理 @@ -85,7 +94,7 @@ public class MessageIMManager { List listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class); if (listUserBean != null && listUserBean.size() >= 2) { //目前就三条消息,需求判断前两条消息是否有未读消息 - for (int i = 0; i < listUserBean.size() - 2; i++) { + for (int i = 0; i < listUserBean.size(); i++) { //消息对象 IMLoginModel userBean = listUserBean.get(i); //未读消息数 @@ -94,7 +103,7 @@ public class MessageIMManager { try { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { systemNumber = Integer.parseInt(number); - }else { + } else { systemNumber = 0; } } catch (NumberFormatException e) { @@ -109,6 +118,30 @@ public class MessageIMManager { }); } + /** + * 融雲發送的系統消息 + * + * @param message + */ + public void getSystemForRongcloud(Message message) { + ImUserInfoModel model = null; + if ((message.getConversationType() == Conversation.ConversationType.SYSTEM) && (message.getContent() instanceof TextMessage)) { + TextMessage content = (TextMessage) message.getContent(); + String json = content.getContent(); + model = new Gson().fromJson(json, ImUserInfoModel.class); + } + if (message.getConversationType() == Conversation.ConversationType.SYSTEM && model != null && TextUtils.equals(model.getMethod(), "LivePK_UnreadCount")) { + //发送通知 + EventBus.getDefault().post(model); + try { + systemNumber = systemNumber + 1; + unreadMessagesHandler.post(essagesRunnable); + } catch (NumberFormatException e) { + e.printStackTrace(); + } + } + } + /** * 获取系统消息(有未读数展示红点) */ @@ -127,7 +160,7 @@ public class MessageIMManager { List listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class); if (listUserBean != null && listUserBean.size() >= 2) { //目前就三条消息,需求判断前两条消息是否有未读消息 - for (int i = 0; i < listUserBean.size() - 2; i++) { + for (int i = 0; i < listUserBean.size(); i++) { //消息对象 IMLoginModel userBean = listUserBean.get(i); //未读消息数 @@ -136,7 +169,7 @@ public class MessageIMManager { try { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { systemNumber = Integer.parseInt(number); - }else { + } else { systemNumber = 0; } } catch (NumberFormatException e) { @@ -164,4 +197,50 @@ public class MessageIMManager { EventBus.getDefault().post(new MessageIMEvent().setNumber(number)); }; + /** + * 设置会话界面操作监听器 + */ + public void addConversationClickListener() { + IMCenter.setConversationClickListener(listener); + } + + /** + * 会话界面操作监听器 + */ + private ConversationClickListener listener = new ConversationClickListener() { + @Override + public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String s) { + return false; + } + + @Override + public boolean onUserPortraitLongClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String s) { + return false; + } + + @Override + public boolean onMessageClick(Context context, View view, Message message) { + return false; + } + + /** + * 长按消息时。 + */ + @Override + public boolean onMessageLongClick(Context context, View view, Message message) { + + ToastUtil.show(message.getContent().toString()); + return true; + } + + @Override + public boolean onMessageLinkClick(Context context, String s, Message message) { + return false; + } + + @Override + public boolean onReadReceiptStateClick(Context context, Message message) { + return false; + } + }; } diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 11b0d5d05..da56ec69f 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -827,4 +827,5 @@ 前往「個人中心」-「我的包裹」中,即可使用熱度卡。 熱度卡生效多久? 對指定主播使用熱度卡後,將會立即生效,效果時長為24小時,不管主播是否在線,熱度時長都將會持續減少 + 引用 diff --git a/config.gradle b/config.gradle index eddca7244..53e2161f5 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/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index 4c61ad7ce..263ecc166 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -76,21 +76,20 @@ + + - + android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/> - + android:theme="@style/DialogActivity"/> diff --git a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java index fbe802527..eaf92435d 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java @@ -23,9 +23,12 @@ import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.ImageEntity; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.live.R; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.MenuPopuwWindow; +import com.yunbao.live.event.InputPanelViewHolderEvent; +import com.yunbao.live.utils.WindowSoftModeAdjustResizeExecutor; import com.yunbao.live.views.InputPanelViewHolder; import com.yunbao.live.views.PDLiveConversationFragment; @@ -65,9 +68,12 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl super.main(); EventBus.getDefault().register(this); mContext = this; -// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); initView(); initData(); + WindowSoftModeAdjustResizeExecutor.assistActivity(this); + //设置会话界面操作监听器 + MessageIMManager.get(this).addConversationClickListener(); } /** @@ -79,20 +85,26 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl inputPanel.setTargetId(targetId); //获取用户信息 UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId); - titleView.setText(userInfo.getName()); - if (!TextUtils.isEmpty(userInfo.getExtra())) { - SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class); - //新手指导员 - if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) { - isAdmin = true; - imgMore.setVisibility(View.GONE); - } else {//非指导员 - isAdmin = false; - imgMore.setVisibility(View.VISIBLE); + if (null!=userInfo){ + titleView.setText(userInfo.getName()); + if (!TextUtils.isEmpty(userInfo.getExtra())) { + SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class); + //新手指导员 + if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) { + isAdmin = true; + imgMore.setVisibility(View.GONE); + } else {//非指导员 + isAdmin = false; + imgMore.setVisibility(View.VISIBLE); + } + Log.e("PDLiveConversation", userInfo.getExtra()); } - Log.e("PDLiveConversation", userInfo.getExtra()); + }else { + titleView.setText("系統消息"); + inputPanel.setVisibility(View.GONE); } + } /** @@ -204,4 +216,13 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl titleView.setText(event); } } + + //消息中心 + @Subscribe(threadMode = ThreadMode.MAIN) + public void onInputPanelViewHolderEvent(InputPanelViewHolderEvent event) { + ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + inputPanel.hidePluginList(); + } + + } diff --git a/live/src/main/java/com/yunbao/live/bean/ImUserBean.java b/live/src/main/java/com/yunbao/live/bean/ImUserBean.java index 7b5e56890..4877313c1 100644 --- a/live/src/main/java/com/yunbao/live/bean/ImUserBean.java +++ b/live/src/main/java/com/yunbao/live/bean/ImUserBean.java @@ -1,11 +1,8 @@ package com.yunbao.live.bean; -import android.os.Parcel; -import android.os.Parcelable; import android.text.TextUtils; -import com.alibaba.fastjson.annotation.JSONField; -import com.yunbao.common.bean.UserBean; +import com.yunbao.common.bean.BaseModel; import java.text.SimpleDateFormat; import java.util.Date; @@ -15,7 +12,8 @@ import java.util.Date; * IM 聊天用户 实体类 */ -public class ImUserBean { +public class ImUserBean extends BaseModel { + String title;// String image;//头像 @@ -28,100 +26,121 @@ public class ImUserBean { String remarks;//备注的信息 String is_admin; String isDelet; - - public String getIsDelet() { - return isDelet; - } - - public void setIsDelet(String isDelet) { - this.isDelet = isDelet; - } - - public String getIs_admin() { - return is_admin; - } - - public void setIs_admin(String is_admin) { - this.is_admin = is_admin; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } + String _method_ = "";//融雲消息類型 public String getTitle() { return title; } - public void setTitle(String title) { + public ImUserBean setTitle(String title) { this.title = title; + return this; } public String getImage() { return image; } - public void setImage(String image) { + public ImUserBean setImage(String image) { this.image = image; + return this; } public String getContent() { return content; } - public void setContent(String content) { + public ImUserBean setContent(String content) { this.content = content; + return this; } public String getAddtime() { return addtime; } - public void setAddtime(String addtime) { + public ImUserBean setAddtime(String addtime) { this.addtime = addtime; + return this; } public String getNum() { return num; } - public void setNum(String num) { + public ImUserBean setNum(String num) { this.num = num; + return this; } public String getLink() { return link; } - public void setLink(String link) { + public ImUserBean setLink(String link) { this.link = link; + return this; } public String getType() { return type; } - public void setType(String type) { + public ImUserBean setType(String type) { this.type = type; + return this; } public String getUserId() { return userId; } - public void setUserId(String userId) { + public ImUserBean setUserId(String userId) { this.userId = userId; + return this; + } + + public String getRemarks() { + return remarks; + } + + public ImUserBean setRemarks(String remarks) { + this.remarks = remarks; + return this; + } + + public String getIs_admin() { + return is_admin; + } + + public ImUserBean setIs_admin(String is_admin) { + this.is_admin = is_admin; + return this; + } + + public String getIsDelet() { + return isDelet; + } + + public ImUserBean setIsDelet(String isDelet) { + this.isDelet = isDelet; + return this; + } + + public String get_method_() { + return _method_; + } + + public ImUserBean set_method_(String _method_) { + this._method_ = _method_; + return this; } /** * 会话列表展示时间 */ public String getLastDate() { - if (!TextUtils.isEmpty(addtime)&&!TextUtils.equals(addtime,"0")) { + if (!TextUtils.isEmpty(addtime) && !TextUtils.equals(addtime, "0")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date currenTimeZone; if (TextUtils.equals(type, "-1")) { @@ -135,4 +154,18 @@ public class ImUserBean { } } + + public String addNumber(int index) { + String number; + if (TextUtils.isEmpty(num)) { + number = String.valueOf(index); + } else { + try { + number = String.valueOf(Integer.parseInt(num) + index); + } catch (NumberFormatException e) { + number = String.valueOf(index); + } + } + return number; + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/MessageLongClickPopuwindow.java b/live/src/main/java/com/yunbao/live/dialog/MessageLongClickPopuwindow.java new file mode 100644 index 000000000..6a8d0c685 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/MessageLongClickPopuwindow.java @@ -0,0 +1,26 @@ +package com.yunbao.live.dialog; + +import android.app.Activity; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.PopupWindow; + +import com.yunbao.live.R; + +/** + * 消息長按彈窗 + */ +public class MessageLongClickPopuwindow { + private Activity mContext; + private View popupView; + private PopupWindow popupWindow; + + public MessageLongClickPopuwindow(Activity context) { + this.mContext = context; + popupView = LayoutInflater.from(mContext).inflate(R.layout.view_message_long_click, null); + initView(); + } + + private void initView() { + } +} 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 b2585f07b..e6bf05489 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -1,11 +1,15 @@ package com.yunbao.live.dialog; +import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import androidx.annotation.NonNull; import com.yunbao.live.R; +import com.yunbao.live.event.InputPanelViewHolderEvent; + +import org.greenrobot.eventbus.EventBus; import io.rong.imkit.conversation.MessageListAdapter; import io.rong.imkit.model.UiMessage; @@ -28,15 +32,22 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus(); ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt); ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new); - if (readReceipt!=null&&readReceiptNew!=null){ + if (readReceipt != null && readReceiptNew != null) { if (readReceipt.getVisibility() == View.VISIBLE) { readReceipt.setVisibility(View.GONE); readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read); } else { - if (messageDirection.equals(Message.MessageDirection.SEND)&&sentStatus.equals(Message.SentStatus.SENT)) + if (messageDirection.equals(Message.MessageDirection.SEND) && sentStatus.equals(Message.SentStatus.SENT)) readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread); } } - + holder.getConvertView().setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + //消費掉軟件盤和插件頁面 + EventBus.getDefault().post(new InputPanelViewHolderEvent()); + return true; + } + }); } } diff --git a/live/src/main/java/com/yunbao/live/event/InputPanelViewHolderEvent.java b/live/src/main/java/com/yunbao/live/event/InputPanelViewHolderEvent.java new file mode 100644 index 000000000..6e2a87c59 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/event/InputPanelViewHolderEvent.java @@ -0,0 +1,9 @@ +package com.yunbao.live.event; + +import com.yunbao.common.bean.BaseModel; + +/** + * 點擊聊天列表的消費 + */ +public class InputPanelViewHolderEvent extends BaseModel { +} diff --git a/live/src/main/java/com/yunbao/live/utils/WindowSoftModeAdjustResizeExecutor.java b/live/src/main/java/com/yunbao/live/utils/WindowSoftModeAdjustResizeExecutor.java new file mode 100644 index 000000000..4136bdeb9 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/utils/WindowSoftModeAdjustResizeExecutor.java @@ -0,0 +1,48 @@ +package com.yunbao.live.utils; + +import android.app.Activity; +import android.graphics.Rect; +import android.os.Build; +import android.view.View; +import android.widget.FrameLayout; + +public class WindowSoftModeAdjustResizeExecutor { + // For more information, see https://code.google.com/p/android/issues/detail?id=5497 + // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. + // CREDIT TO Joseph Johnson (http://stackoverflow.com/users/341631/joseph-johnson) for publishing the original Android solution on stackoverflow.com + public static void assistActivity(Activity activity) { + new WindowSoftModeAdjustResizeExecutor(activity); + } + + private View mChildOfContent; + private int usableHeightPrevious; + private FrameLayout.LayoutParams frameLayoutParams; + + private WindowSoftModeAdjustResizeExecutor(Activity activity) { + FrameLayout content = activity.findViewById(android.R.id.content); + mChildOfContent = content.getChildAt(0); + mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(() -> WindowSoftModeAdjustResizeExecutor.this.possiblyResizeChildOfContent()); + frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); + } + + private void possiblyResizeChildOfContent() { + int usableHeightNow = computeUsableHeight(); + if (usableHeightNow != usableHeightPrevious) { + int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight(); + int heightDifference = usableHeightSansKeyboard - usableHeightNow; + frameLayoutParams.height = usableHeightSansKeyboard - heightDifference; + mChildOfContent.requestLayout(); + usableHeightPrevious = usableHeightNow; + } + } + + private int computeUsableHeight() { + Rect r = new Rect(); + mChildOfContent.getWindowVisibleDisplayFrame(r); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + return (r.bottom - r.top); + } + return r.bottom; + } + +} diff --git a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java index b054f9bb4..10c5036bb 100644 --- a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java @@ -78,21 +78,23 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi inputPanelView.findViewById(R.id.lt_photo_button).setOnClickListener(this); inputPanelView.findViewById(R.id.lt_choospic_button).setOnClickListener(this); inputPanelView.findViewById(R.id.lt_video_button).setOnClickListener(this); - editBtn.setOnFocusChangeListener(focusChangeListener); +// editBtn.setOnFocusChangeListener(focusChangeListener); } - //输入框焦点监听事件 - View.OnFocusChangeListener focusChangeListener = new OnFocusChangeListener() { - @Override - public void onFocusChange(View v, boolean hasFocus) { - if (!hasFocus) { - //失去焦点 - InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED); - imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘 - } - } - }; +// //输入框焦点监听事件 +// View.OnFocusChangeListener focusChangeListener = new OnFocusChangeListener() { +// @Override +// public void onFocusChange(View v, boolean hasFocus) { +// if (!hasFocus&& pluginList.getVisibility()==GONE) { +// //失去焦点 +// InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); +// imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED); +// imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘 +// } else { +// pluginList.setVisibility(GONE); +// } +// } +// }; @Override public void onClick(View v) { @@ -106,6 +108,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi } else if (id == R.id.edit_btn) { if (pluginList.getVisibility() == VISIBLE) { pluginList.setVisibility(GONE); + editBtn.setFocusable(true); } } else if (id == R.id.lt_photo_button) { if (messageCallback != null) { @@ -129,11 +132,11 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi if (pluginList.getVisibility() == VISIBLE) { pluginList.setVisibility(GONE); } else { + pluginList.setVisibility(VISIBLE); + //失去焦点 InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED); - imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘 - pluginList.setVisibility(VISIBLE); } } @@ -205,7 +208,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi }; /** - * 发送媒体消息 + * 发送媒体消息 隱藏 * * @param imagePath */ @@ -303,4 +306,11 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi messageCallback = callback; } + /** + * 隱藏插件列表 + */ + public void hidePluginList() { + pluginList.setVisibility(GONE); + } + } diff --git a/live/src/main/res/layout/rc_conversationlist_item.xml b/live/src/main/res/layout/rc_conversationlist_item.xml index 8a781ed44..462eac0b1 100644 --- a/live/src/main/res/layout/rc_conversationlist_item.xml +++ b/live/src/main/res/layout/rc_conversationlist_item.xml @@ -74,13 +74,14 @@ android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" + android:gravity="center_vertical" app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl" app:layout_constraintTop_toBottomOf="@+id/rc_conversation_title"> diff --git a/live/src/main/res/layout/view_message_long_click.xml b/live/src/main/res/layout/view_message_long_click.xml new file mode 100644 index 000000000..8f8a5c0c7 --- /dev/null +++ b/live/src/main/res/layout/view_message_long_click.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xhdpi/icon_message_copy.png b/live/src/main/res/mipmap-xhdpi/icon_message_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a3891be1da39d4b7a48ca028490f58797121fa06 GIT binary patch literal 470 zcmV;{0V)28P)Px$kV!;ARA@u(nlVzuFbqZizXzA#AWO*=sCH+#0aUaM+tF;p34kNe(9ysRIENU| zkX~BNp|ugA^`3HJdylL={*XjI*zrA$OC|_ zMmCli0SL{X04`GyR)8>D=4S#R3u5g6Nr)BzW+7Sun1pBvU=*S?fB^AG@~X=mEdn6U zT7Ljig=r?`sncn!vs6hBAg3_Z006Kfxi2+7^dABw3sWV4V9SQ&YbnH<0J3eLTm!!! zQnQLGdcXnT9>@*?TSs35gWZ#DIu+9H0r!9+Y^L_mUWtv9sS@`^?2A|xI42Px)XGugsRA@u(nQ4e+)fI)mg=j!QO@u@nL{Sq#W7HT3YU6;KG(7d^Gtc&Vz!ShPi=Hzi{dKGWZ0`>wwl|oG^UYk_*8|6u-#1J8{n!AMxQ+Ac&W7`4 z7fuJ7RexSm4!+eg>mg+OMPU2ca=rjaEw?PGu&TS``!%EEh)6fhHFd%HrT!$=#s zNYdF;to%v9Rn@m|fI}tS+cm!T4%q$!a7|0`;gasQovqH6e+uj^DI9;2*!~A_a(Nl2 zwvqI13v9~o71g^hfx{%-Kh=))0$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zqpV*(<*uP&RO@=E(AixE{~pTsAa^y5aXGk$sZ(eK2L50Ux}BU@_&@`%lw+v8l=zcz zD|AXh94bTT+lEmRIPEoL$dD;&Se-Co!oLKihXAdCc(DYUo?6RjcvQ>m5@{^%)*yd9 zdX{11V*a%8QI}%0VsF{{gG=o0Ul06#4)F002ov JPDHLkV1kipz1jc( literal 0 HcmV?d00001 diff --git a/live/src/main/res/mipmap-xhdpi/icon_messagelist_unread.png b/live/src/main/res/mipmap-xhdpi/icon_messagelist_unread.png new file mode 100644 index 0000000000000000000000000000000000000000..012b901b956f6e6428d3e25a0035fb05fa98514f GIT binary patch literal 3312 zcmVPx#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91exL&Y1ONa40RR91FaQ7m0LNAFZU6ubT1iAfRCodHoC|PO#TkJAy$LTN zQWUgR2Qb!Ym4cE7*#1(r?jJOwb1&) z4%)F*vB}N5VnLM3!#XnJ+aQ6w?)KZ0du~o{&bc|~+;fuv*~!h>-T$$>|G)e1?!SAE z$VeEGz=#A69|Aw7f%`OHh7{!7#4mWENeh(rqX(GzWZ`&^m5yAs*f`}>k44nVC!QArT`FZlK#U0OfM(j2>Jhwc` zVfmANa2@g4vpu*t%&pT$#uCz379AoTX1Y^yITr8*6_Z`%wfd;^mYpzBK3g|K)sR0c z9p;rTsnNG5q-Sx5(swpjDBrYRJcH)VvrPIQU;`f_k>hdrYp?0lar%ie*c=61vr4Xwzv%6rYp`d-+*x>z+y%P^R<|6Qt;0 zvs8BLk4y#R5Egm?mcu#?3F|~Ri!v?KgZ%b)2(I(~fyL=9YK)9`{#fi<{&g0s4?FX% zxRQTbT$DWT0{d0}60*-38S&Z6upb9Zaz|5%YI6eEt0&l<7-vvdOFFCu_Yi>&)7_i~ z!#9wVy9gtSPiiMIMqU{gljD;~Uyu2-<)da_n8OcgMDa#E3o(7*7Q3VU(Wd-KMLd@iYQSgP= z&Vi0FqbP^EFF|2TTzP3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KsACPC=KXAejsh3Z|i54gxiQ?I&O+~O(&XN(p4z_HI zSYXvRIRS$Z$A7=BEUq{6g2WRDt@jfkT2AA#^7sL(fR&&<4-JUtfmAiKx)XnC3opph%wu5u)cJN)ebpu&H$nG%0^ z?9p;Mrq|qY8HfJc}tA2eU&N+TEZiI$Ghl;;&X`cFNsil@E{=y40Y__TG%E?_4*;l^8rzx?EM zGv>q@syNre?hIIVoLz!1mo5H+s`i9DE9Mm}m%u=1K$)vfDwDrvT39AOVb+M*ziv*g z%yZpq&*a;T(l1)HN;FoXo|`x8`JmF%SQ%@C`kh~rPN|LX+KAP?iBGCtgTj~b zn{4>g8MZo=Zj~A0U!;l;QNAk)qvUx;$y)}95dZ6n6mceIcyl5qk6CO{oEQ5sN@m(- zwQ!uYT35y5x|(_}q~1^G#pG`s5%2M$50al;+*Q*7?&3!MQfL?A^}Id^4=-FgP)~sQ uRF1iPbp*cj*hQuOXVZ>6hgJe%boYP4Ku^JgdeD*p0000 0) { + if (event.getNumber() > 99) { + v_table_redpoint.setText("99+"); + } else { + v_table_redpoint.setText(event.getNumber() + ""); + } v_table_redpoint.setVisibility(View.VISIBLE); - v_table_redpoint.setText(event.getNumber() + ""); + } else { v_table_redpoint.setVisibility(View.GONE); v_table_redpoint.setText(""); diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java index 7e67796f9..b515ac572 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.UpdateTablePointMe; @@ -51,6 +52,7 @@ public class PDLiveConversationListActivity extends AbsActivity { private long mLastClickBackTime;//上次点击back键的时间 private TextView redPoint; private View redpointMe; + private SystemMessageAdapter messageAdapter; @Override protected int getLayoutId() { @@ -143,7 +145,7 @@ public class PDLiveConversationListActivity extends AbsActivity { //初始化系统消息界面 View rootView = LayoutInflater.from(mContext).inflate(R.layout.view_system_message, null, true); RecyclerView systemMessageList = rootView.findViewById(R.id.system_message_list); - SystemMessageAdapter messageAdapter = new SystemMessageAdapter(mContext); + messageAdapter = new SystemMessageAdapter(mContext); messageAdapter.addDataAll(listUserBean); systemMessageList.setHasFixedSize(false); systemMessageList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, true)); @@ -201,8 +203,13 @@ public class PDLiveConversationListActivity extends AbsActivity { public void onMessageIMEvent(MessageIMEvent event) { if (redPoint == null) return; if (event.getNumber() > 0) { + if (event.getNumber() > 99) { + redPoint.setText(String.valueOf("99+")); + } else { + redPoint.setText(String.valueOf(event.getNumber())); + } redPoint.setVisibility(View.VISIBLE); - redPoint.setText(String.valueOf(event.getNumber())); + } else { redPoint.setVisibility(View.GONE); redPoint.setText(""); @@ -219,4 +226,10 @@ public class PDLiveConversationListActivity extends AbsActivity { redpointMe.setVisibility(View.GONE); } } + + //更新系統消息 + @Subscribe(threadMode = ThreadMode.MAIN) + public void onImUserInfoModel(ImUserInfoModel model) { + messageAdapter.upDataMessage(model); + } } 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 cb61b2266..4dbf42d3f 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SystemMessageAdapter.java @@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSON; import com.facebook.appevents.AppEventsLogger; import com.google.firebase.analytics.FirebaseAnalytics; import com.yunbao.common.activity.WebViewActivity; +import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.live.activity.SystemMessageActivity; @@ -55,7 +56,7 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { SystemMessageViewHolder messageViewHolder = (SystemMessageViewHolder) holder; ImgLoader.displayWithError(mContext, model.getImage(), messageViewHolder.avatarImage, com.yunbao.live.R.mipmap.chat_head_mo); if (position == 2) { - messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getLink()) ? mContext.getResources().getString(R.string.chat_like) : model.getLink()); + messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getContent()) ? mContext.getResources().getString(R.string.chat_like) : model.getContent()); } else { if (position == 1) { messageViewHolder.userMsg.setText(TextUtils.isEmpty(model.getContent()) ? mContext.getResources().getString(R.string.chat_action_no) : model.getContent()); @@ -68,8 +69,15 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { String number = model.getNum(); if (!TextUtils.isEmpty(number) && !TextUtils.equals(number, "0")) { + int index = Integer.parseInt(number); + if (index > 99) { + + messageViewHolder.redPoint.setText("99+"); + } else { + messageViewHolder.redPoint.setText(number); + } messageViewHolder.redPoint.setVisibility(View.VISIBLE); - messageViewHolder.redPoint.setText(number); + } else { messageViewHolder.redPoint.setVisibility(View.GONE); } @@ -79,7 +87,7 @@ public class SystemMessageAdapter 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); } @@ -145,6 +153,28 @@ public class SystemMessageAdapter extends RecyclerView.Adapter { listUserBean.clear(); listUserBean.addAll(mlistUserBean); notifyDataSetChanged(); + } + /** + * 更新系統數據 + */ + public void upDataMessage(ImUserInfoModel model) { + for (ImUserBean imUserBean : listUserBean) { + if (TextUtils.equals(imUserBean.getType(), model.getType())) { + imUserBean.setContent(model.getContent()) + .setIsDelet(model.getIsDelet()) + .setRemarks(model.getRemarks()) + .setIs_admin(model.getIsAdmin()) + .set_method_(model.getMethod()) + .setAddtime(model.getAddtime()) + .setImage(model.getImage()) + .setLink(model.getLink()) + .setNum(imUserBean.addNumber(1)) + .setTitle(model.getTitle()) + .setType(model.getType()) + .setUserId(model.getUserId()); + } + } + notifyDataSetChanged(); } } diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index 36d5c7d98..8f2f869cc 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -124,7 +124,7 @@ public class ConversationIMListManager { CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { + if (code == 0 && info.length > 0&&!TextUtils.equals("__system__",userId)) { JSONObject obj = JSON.parseObject(info[0]); SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class); String userNiceName = ""; diff --git a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java index 829a01ded..74d3ec39d 100644 --- a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java +++ b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java @@ -1,8 +1,6 @@ package com.yunbao.main.utils; import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -10,12 +8,10 @@ import java.util.List; import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.provider.BaseConversationProvider; -import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.widget.adapter.IViewProviderListener; import io.rong.imkit.widget.adapter.ViewHolder; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Message; -import io.rong.imlib.model.UserInfo; /** * pdlive自定义会话模板 @@ -31,7 +27,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { //根据业务需要,自定义处理 - Log.e("PDLiveCustomConversat","------------------------------------------"+viewType); + Log.e("PDLiveCustomConversat", "------------------------------------------" + viewType); return super.onCreateViewHolder(parent, viewType); } @@ -41,14 +37,17 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { //根据业务需要,自定义处理 super.bindViewHolder(holder, uiConversation, position, list, listener); - if ( list.size()>0){ + + if (list.size() > 0) { Message.ReceivedStatus receivedStatus = list.get(position).mCore.getReceivedStatus(); ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new); if (receivedStatus.isRead()) { - readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_unread); - }else { - readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_read); + readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_read); + } else { + readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_unread); } } + + } } diff --git a/main/src/main/res/layout/activity_conversation_list.xml b/main/src/main/res/layout/activity_conversation_list.xml index 6696e64ed..110a24518 100644 --- a/main/src/main/res/layout/activity_conversation_list.xml +++ b/main/src/main/res/layout/activity_conversation_list.xml @@ -129,10 +129,10 @@ diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index 554e7409d..9609f669e 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -107,12 +107,12 @@ diff --git a/main/src/main/res/layout/view_system_message_item.xml b/main/src/main/res/layout/view_system_message_item.xml index 0d14049b3..dfc6855ff 100644 --- a/main/src/main/res/layout/view_system_message_item.xml +++ b/main/src/main/res/layout/view_system_message_item.xml @@ -54,8 +54,8 @@