diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index d9ccd9be5..6ce26060e 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -44,6 +44,8 @@ import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; +import com.yunbao.common.message.content.MessageChatTipsContent; +import com.yunbao.common.provider.MessageChatTipsItemProvider; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.GoogleUtils; @@ -189,11 +191,13 @@ public class AppContext extends CommonAppContext { ArrayList> myMessages = new ArrayList<>(); myMessages.add(RecommendLiveRoom.class); myMessages.add(InstructorSendReward.class); + myMessages.add(MessageChatTipsContent.class); RongIMClient.registerMessageType(myMessages); // 注册自定义消息模板 RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext())); RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext())); + RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatTipsItemProvider(getApplicationContext())); RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() { @Override diff --git a/app/tmp/full-r8-config.txt b/app/tmp/full-r8-config.txt index a63e5e796..9866c35d6 100644 --- a/app/tmp/full-r8-config.txt +++ b/app/tmp/full-r8-config.txt @@ -488,7 +488,7 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -keep class com.yunbao.live.activity.LiveTRTCAnchorActivity { (); } -keep class com.yunbao.live.activity.MedalQuestionWebViewActivity { (); } -keep class com.yunbao.live.activity.PDLIiveChatActivity { (); } --keep class com.yunbao.live.activity.PDLiveConversationActivity { (); } +-keep class com.yunbao.main.activity.PDLiveConversationActivity { (); } -keep class com.yunbao.live.activity.RoomManageActivity { (); } -keep class com.yunbao.live.activity.RoomManageDetailActivity { (); } -keep class com.yunbao.live.activity.SudGameActivity { (); } diff --git a/common/src/main/java/com/yunbao/common/event/PDChatInputModeEvent.java b/common/src/main/java/com/yunbao/common/event/PDChatInputModeEvent.java new file mode 100644 index 000000000..506201cbe --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/PDChatInputModeEvent.java @@ -0,0 +1,17 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +import io.rong.imkit.conversation.extension.InputMode; + +public class PDChatInputModeEvent extends BaseModel { + InputMode inputMode; + + public PDChatInputModeEvent(InputMode inputMode) { + this.inputMode = inputMode; + } + + public InputMode getInputMode() { + return inputMode; + } +} diff --git a/common/src/main/java/com/yunbao/common/interfaces/OnSendMessageListener.java b/common/src/main/java/com/yunbao/common/interfaces/OnSendMessageListener.java new file mode 100644 index 000000000..d0c903f5e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/interfaces/OnSendMessageListener.java @@ -0,0 +1,18 @@ +package com.yunbao.common.interfaces; + + +public abstract class OnSendMessageListener { + public static final int STATUS_NOT_PRICE = 0;//金额不够 + public static final int STATUS_ERROR = 1;//接口错误 + + + public void onSuccess(String token, T bean) { + + } + + public void onError(int status, String msg) { + } + public void onError(int status, String msg, T bean){ + onError(status, msg); + } +} diff --git a/common/src/main/java/com/yunbao/common/message/content/MessageChatTipsContent.java b/common/src/main/java/com/yunbao/common/message/content/MessageChatTipsContent.java new file mode 100644 index 000000000..a880fc760 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/message/content/MessageChatTipsContent.java @@ -0,0 +1,149 @@ +package com.yunbao.common.message.content; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + + +import com.yunbao.common.interfaces.OnSendMessageListener; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.UnsupportedEncodingException; + +import io.rong.common.ParcelUtils; +import io.rong.imkit.IMCenter; +import io.rong.imlib.MessageTag; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.Message; +import io.rong.imlib.model.MessageContent; + +@MessageTag(value = "MessageChatTipsContent", flag = MessageTag.ISPERSISTED) +public class MessageChatTipsContent extends MessageContent implements Parcelable { + private String content; + + public static void sendMessage(Conversation.ConversationType type, String targetId, MessageChatTipsContent tipsContent, OnSendMessageListener listener) { + IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback() { + @Override + public void onSuccess(Message message) { + if (listener != null) { + listener.onSuccess(null, null); + } + } + + @Override + public void onError(RongIMClient.ErrorCode e) { + if (listener != null) { + listener.onError(e.code, e.msg); + } + + } + }); + } + + private MessageChatTipsContent() { + } + + public MessageChatTipsContent(byte[] data) { + if (data == null) { + return; + } + String jsonStr = null; + try { + jsonStr = new String(data, "UTF-8"); + } catch (UnsupportedEncodingException e) { + } + if (jsonStr == null) { + return; + } + + try { + JSONObject jsonObj = new JSONObject(jsonStr); + // 消息携带用户信息时, 自定义消息需添加下面代码 + if (jsonObj.has("user")) { + setUserInfo(parseJsonToUserInfo(jsonObj.getJSONObject("user"))); + } + // 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码 + if (jsonObj.has("mentionedInfo")) { + setMentionedInfo(parseJsonToMentionInfo(jsonObj.getJSONObject("mentionedInfo"))); + } + // 将所有自定义变量从收到的 json 解析并赋值 + if (jsonObj.has("content")) { + content = jsonObj.optString("content"); + } + } catch (JSONException e) { + } + } + + public MessageChatTipsContent setContent(String content) { + this.content = content; + return this; + } + + public String getContent() { + return content; + } + + protected MessageChatTipsContent(Parcel in) { + setExtra(ParcelUtils.readFromParcel(in)); + setContent(ParcelUtils.readFromParcel(in)); + } + + // 快速构建消息对象方法 + public static MessageChatTipsContent obtain(String content) { + MessageChatTipsContent msg = new MessageChatTipsContent(); + msg.content = content; + return msg; + } + + + public static final Creator CREATOR = new Creator() { + @Override + public MessageChatTipsContent createFromParcel(Parcel in) { + return new MessageChatTipsContent(in); + } + + @Override + public MessageChatTipsContent[] newArray(int size) { + return new MessageChatTipsContent[size]; + } + }; + + @Override + public byte[] encode() { + JSONObject jsonObj = new JSONObject(); + try { + // 消息携带用户信息时, 自定义消息需添加下面代码 + if (getJSONUserInfo() != null) { + jsonObj.putOpt("user", getJSONUserInfo()); + } + // 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码 + if (getJsonMentionInfo() != null) { + jsonObj.putOpt("mentionedInfo", getJsonMentionInfo()); + } + // 将所有自定义消息的内容,都序列化至 json 对象中 + jsonObj.put("content", this.content); + } catch (JSONException e) { + } + + try { + return jsonObj.toString().getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + } + return null; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + ParcelUtils.writeToParcel(dest, getExtra()); + ParcelUtils.writeToParcel(dest, content); + } +} diff --git a/common/src/main/java/com/yunbao/common/provider/MessageChatTipsItemProvider.java b/common/src/main/java/com/yunbao/common/provider/MessageChatTipsItemProvider.java new file mode 100644 index 000000000..5daffa3b1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/provider/MessageChatTipsItemProvider.java @@ -0,0 +1,54 @@ +package com.yunbao.common.provider; + +import android.content.Context; +import android.text.Spannable; +import android.view.ViewGroup; + + +import com.yunbao.common.R; +import com.yunbao.common.message.content.MessageChatTipsContent; + +import java.util.List; + +import io.rong.imkit.conversation.messgelist.provider.BaseMessageItemProvider; +import io.rong.imkit.model.UiMessage; +import io.rong.imkit.widget.adapter.IViewProviderListener; +import io.rong.imkit.widget.adapter.ViewHolder; +import io.rong.imlib.model.MessageContent; + +public class MessageChatTipsItemProvider extends BaseMessageItemProvider { + private Context mContext; + + public MessageChatTipsItemProvider(Context mContext) { + this.mContext = mContext; + mConfig.showPortrait = false; + mConfig.showSummaryWithName = false; + mConfig.showContentBubble = false; + mConfig.centerInHorizontal = true; + } + + @Override + protected ViewHolder onCreateMessageContentViewHolder(ViewGroup parent, int viewType) { + return ViewHolder.createViewHolder(mContext, parent, R.layout.view_message_chat_tip); + } + + @Override + protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, MessageChatTipsContent messageChatTipsContent, UiMessage uiMessage, int position, List list, IViewProviderListener listener) { + holder.setText(R.id.tips, messageChatTipsContent.getContent()); + } + + @Override + protected boolean onItemClick(ViewHolder holder, MessageChatTipsContent messageChatTipsContent, UiMessage uiMessage, int position, List list, IViewProviderListener listener) { + return false; + } + + @Override + protected boolean isMessageViewType(MessageContent messageContent) { + return messageContent instanceof MessageChatTipsContent; + } + + @Override + public Spannable getSummarySpannable(Context context, MessageChatTipsContent messageChatTipsContent) { + return null; + } +} diff --git a/common/src/main/res/drawable/bg_message_chat_tip.xml b/common/src/main/res/drawable/bg_message_chat_tip.xml new file mode 100644 index 000000000..11a91ca2a --- /dev/null +++ b/common/src/main/res/drawable/bg_message_chat_tip.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_message_chat_tip.xml b/common/src/main/res/layout/view_message_chat_tip.xml new file mode 100644 index 000000000..30535e6da --- /dev/null +++ b/common/src/main/res/layout/view_message_chat_tip.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/bg_msg_chat.png b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat.png new file mode 100644 index 000000000..77b648b23 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title.png b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title.png new file mode 100644 index 000000000..7e4215147 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_avater.png b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_avater.png new file mode 100644 index 000000000..8ac7fa876 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_avater.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_follow.png b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_follow.png new file mode 100644 index 000000000..7c90ef2c2 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_msg_chat_title_follow.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/ic_message_chat_input.png b/common/src/main/res/mipmap-xxhdpi/ic_message_chat_input.png new file mode 100644 index 000000000..2b52430be Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_message_chat_input.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index b98e1dc22..190740c2f 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1450,4 +1450,5 @@ Limited ride And limited avatar frame Are you sure to return? Sure + Say something diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 6ac031f2d..ea9013b03 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1448,4 +1448,5 @@ 是否確認返回? 確定 + 說點什麼 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 249b1f83a..a578f9c88 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1447,5 +1447,5 @@ 是否確認返回? 確定 - + 說點什麼 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 6b0c30b57..29344e891 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1444,5 +1444,5 @@ 是否確認返回? 確定 - + 說點什麼 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 015c07bf9..f33062607 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1454,5 +1454,5 @@ Limited ride And limited avatar frame Are you sure to return? Sure - + Say something diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index 1af89a691..43472492e 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -106,7 +106,7 @@ android:required="false" /> 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 6ac1b1e38..e598370cb 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -1,5 +1,6 @@ package com.yunbao.live.dialog; +import android.graphics.Color; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; @@ -7,6 +8,8 @@ import android.widget.TextView; import androidx.annotation.NonNull; +import com.yunbao.common.message.content.MessageChatTipsContent; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.event.InputPanelViewHolderEvent; @@ -17,6 +20,7 @@ import io.rong.imkit.model.UiMessage; import io.rong.imkit.widget.adapter.IViewProviderListener; import io.rong.imkit.widget.adapter.ViewHolder; import io.rong.imlib.model.Message; +import io.rong.imlib.model.MessageContent; /** * 会话页面更改已读未读 @@ -30,12 +34,16 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { public void onBindViewHolder(@NonNull ViewHolder holder, int position) { super.onBindViewHolder(holder, position); Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection(); + MessageContent content = mDataList.get(position).getMessage().getContent(); 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); } + holder.getConvertView().setBackgroundColor(Color.parseColor("#00000000")); + holder.itemView.setBackgroundColor(Color.parseColor("#00000000")); ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new); + if (readReceiptNew!=null){ if (messageDirection==Message.MessageDirection.SEND){ readReceiptNew.setVisibility(View.VISIBLE); @@ -50,6 +58,9 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { if (readReceipt!=null){ readReceipt.setVisibility(View.GONE); } + if(content instanceof MessageChatTipsContent){ + readReceiptNew.setVisibility(View.GONE); + } } holder.getConvertView().setOnTouchListener(new View.OnTouchListener() { diff --git a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java index 535041dca..90a0c3d0d 100644 --- a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java @@ -1,18 +1,59 @@ package com.yunbao.live.views; +import android.graphics.Color; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; + +import com.yunbao.common.event.PDChatInputModeEvent; import com.yunbao.live.dialog.PDLiveMessageListAdapter; +import org.greenrobot.eventbus.EventBus; + import io.rong.imkit.conversation.ConversationFragment; import io.rong.imkit.conversation.MessageListAdapter; +import io.rong.imkit.conversation.extension.InputMode; +import io.rong.imkit.conversation.extension.RongExtensionViewModel; /** * 聊天详情页面 */ public class PDLiveConversationFragment extends ConversationFragment { + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + view.setBackgroundColor(Color.parseColor("#00000000")); + + mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer() { + @Override + public void onChanged(InputMode inputMode) { + } + }); + mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput)); + } + }); + mRongExtension.getInputPanel().getEditText().setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View view, boolean b) { + EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput)); + } + }); + } + @Override protected MessageListAdapter onResolveAdapter() { return new PDLiveMessageListAdapter(this); } + public RongExtensionViewModel getRongExtensionViewModel() { + return mRongExtensionViewModel; + } } diff --git a/live/src/main/res/layout/activity_conversation.xml b/live/src/main/res/layout/activity_conversation.xml deleted file mode 100644 index 54f2625a2..000000000 --- a/live/src/main/res/layout/activity_conversation.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/live/src/main/res/layout/rc_extension_input_panel.xml b/live/src/main/res/layout/rc_extension_input_panel.xml index f884747f1..306a312e6 100644 --- a/live/src/main/res/layout/rc_extension_input_panel.xml +++ b/live/src/main/res/layout/rc_extension_input_panel.xml @@ -3,8 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:visibility="gone" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:visibility="visible"> + app:layout_constraintEnd_toStartOf="@+id/input_panel_add_or_send" + app:layout_constraintTop_toTopOf="parent" /> mSelectImages = new ArrayList<>(); private String targetId = ""; + private View card; + private View mContainer; @Override @@ -82,6 +97,68 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl MessageIMManager.get(this).addConversationClickListener(); } + private void hideUserCard() { + if (card.getTag() != null) return; + card.setTag("fold"); + Animation animation; + animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_chat_fold_card_hide); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + card.setVisibility(View.GONE); + ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams(); + params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID; + params.topMargin = DpUtil.dp2px(75); + mContainer.setLayoutParams(params); + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + card.startAnimation(animation); + } + + private void showUserCard() { + if (card.getTag() == null) return; + card.setTag(null); + Animation animation; + animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_chat_fold_card_show); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + card.setVisibility(View.VISIBLE); + ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams(); + params.topToBottom = R.id.include4; + params.topMargin = DpUtil.dp2px(-30); + params.topToTop = ConstraintLayout.LayoutParams.UNSET; + mContainer.setLayoutParams(params); + } + + @Override + public void onAnimationEnd(Animation animation) { + ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams(); + params.topToBottom = R.id.include4; + params.topMargin = DpUtil.dp2px(-30); + params.topToTop = ConstraintLayout.LayoutParams.UNSET; + mContainer.setLayoutParams(params); + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + card.startAnimation(animation); + } /** * 数据的设置 @@ -137,13 +214,27 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl imBack = findViewById(R.id.btn_back); imgMore.setOnClickListener(this); imBack.setOnClickListener(this); - + card = findViewById(R.id.userCard); + card.setBackgroundColor(Color.parseColor("#00000000")); + mContainer = findViewById(R.id.container); inputPanel.addMediaMessageCallback(new InputPanelViewHolder.MediaMessageCallback() { @Override public void choosePic(int intoIndex) { jumpPic(intoIndex); } }); + findViewById(R.id.btn_fold).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (card.getTag() == null) { + hideUserCard(); + } else { + showUserCard(); + } + + } + }); + } catch (Exception e) { e.printStackTrace(); } @@ -165,11 +256,11 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl //intoIndex 1=调用相机,2=照片选取,3=视频选取 public void jumpPic(int intoIndex) { - String permission1=Manifest.permission.READ_EXTERNAL_STORAGE; - String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE; + String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE; + String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - permission1=Manifest.permission.READ_MEDIA_IMAGES; - permission2=Manifest.permission.READ_MEDIA_VIDEO; + permission1 = Manifest.permission.READ_MEDIA_IMAGES; + permission2 = Manifest.permission.READ_MEDIA_VIDEO; } //选择图片 @@ -256,9 +347,15 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl //消息中心 @Subscribe(threadMode = ThreadMode.MAIN) public void onInputPanelViewHolderEvent(InputPanelViewHolderEvent event) { - ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + // ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); inputPanel.hidePluginList(); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onInputPanelViewChangeEvent(PDChatInputModeEvent event) { + if (event.getInputMode() != InputMode.NormalMode) { + hideUserCard(); + } + } } 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 a22078cdf..af8c43db1 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 @@ -7,7 +7,6 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -19,7 +18,6 @@ import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.google.gson.Gson; import com.lxj.xpopup.XPopup; -import com.lxj.xpopup.interfaces.OnSelectListener; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.VipModel; import com.yunbao.common.http.CommonHttpUtil; @@ -31,11 +29,10 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.activity.PDLIiveChatActivity; -import com.yunbao.live.activity.PDLiveConversationActivity; +import com.yunbao.main.activity.PDLiveConversationActivity; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.PDLIiveChatConversationFragment; import com.yunbao.main.activity.PDLiveConversationListActivity; -import com.yunbao.main.dialog.ConversationPopuwWindow; import com.yunbao.main.dialog.MsgChatClickDialog; import com.yunbao.main.utils.PDLiveCustomConversationProvider; import com.yunbao.main.utils.PDLiveMessageProcessor; @@ -61,6 +58,8 @@ import io.rong.imlib.model.Conversation; import io.rong.imlib.model.UserInfo; import io.rong.sight.SightExtensionModule; import com.yunbao.main.R; +import com.yunbao.main.views.MessageChatExtensionConfig; + /** * 会话列表管理 */ @@ -90,6 +89,8 @@ public class ConversationIMListManager { //会话列表监听事件 RongIM.setConversationListBehaviorListener(listener); + //注册聊天页面扩展面板 + RongExtensionManager.getInstance().setExtensionConfig(new MessageChatExtensionConfig()); } /** diff --git a/main/src/main/java/com/yunbao/main/views/MessageChatExtensionConfig.java b/main/src/main/java/com/yunbao/main/views/MessageChatExtensionConfig.java new file mode 100644 index 000000000..be6943da0 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/views/MessageChatExtensionConfig.java @@ -0,0 +1,28 @@ +package com.yunbao.main.views; + +import java.util.List; +import java.util.ListIterator; + +import io.rong.imkit.conversation.extension.DefaultExtensionConfig; +import io.rong.imkit.conversation.extension.component.plugin.FilePlugin; +import io.rong.imkit.conversation.extension.component.plugin.IPluginModule; +import io.rong.imlib.model.Conversation; + +public class MessageChatExtensionConfig extends DefaultExtensionConfig { + @Override + public List getPluginModules(Conversation.ConversationType conversationType, String targetId) { + List pluginModules = super.getPluginModules(conversationType,targetId); + ListIterator iterator = pluginModules.listIterator(); + + // 删除扩展项 + while (iterator.hasNext()) { + IPluginModule integer = iterator.next(); + // 以删除 FilePlugin 为例 + if (integer instanceof FilePlugin) { + iterator.remove(); + } + } + + return pluginModules; + } +} diff --git a/main/src/main/res/anim/anim_chat_fold_card_hide.xml b/main/src/main/res/anim/anim_chat_fold_card_hide.xml new file mode 100644 index 000000000..4a6ed1e5e --- /dev/null +++ b/main/src/main/res/anim/anim_chat_fold_card_hide.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/main/src/main/res/anim/anim_chat_fold_card_show.xml b/main/src/main/res/anim/anim_chat_fold_card_show.xml new file mode 100644 index 000000000..89c8f2875 --- /dev/null +++ b/main/src/main/res/anim/anim_chat_fold_card_show.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/main/src/main/res/layout/activity_conversation.xml b/main/src/main/res/layout/activity_conversation.xml new file mode 100644 index 000000000..0e3c3e86b --- /dev/null +++ b/main/src/main/res/layout/activity_conversation.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/rc_conversation_fragment.xml b/main/src/main/res/layout/rc_conversation_fragment.xml index 159e2f6ee..beb40d11a 100644 --- a/main/src/main/res/layout/rc_conversation_fragment.xml +++ b/main/src/main/res/layout/rc_conversation_fragment.xml @@ -11,7 +11,7 @@ android:id="@+id/rc_refresh" android:layout_width="0dp" android:layout_height="0dp" - app:layout_constraintBottom_toTopOf="@id/rc_extension" + app:layout_constraintBottom_toTopOf="@id/inputPanel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -81,16 +81,24 @@ app:layout_constraintTop_toTopOf="parent" tools:text="100条@消息" /> - + app:layout_constraintTop_toBottomOf="@id/rc_refresh" + android:layout_width="0dp" + android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +