From 9a7054ce765b280dc724b7e2bcaba04585d2e12a Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 25 Mar 2024 16:38:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E4=B8=80=E7=9B=B4=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E8=8D=89=E7=A8=BF=E7=9A=84=E9=97=AE=E9=A2=98]=20fix=20[?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E9=80=9A=E7=9F=A5=E6=94=B9=E4=B8=BA=E5=8F=AF?= =?UTF-8?q?=E7=82=B9=E5=87=BB]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../dialog/MessageSayHiNotifyDialog.java | 3 +- .../live/activity/LiveRyAnchorActivity.java | 2 +- .../views/PDLiveConversationFragment.java | 64 ++++++++++++++++++- .../activity/PDLiveConversationActivity.java | 2 +- 5 files changed, 68 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7212cbfef..92ec8d5af 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { classpath 'com.android.tools.build:gradle:4.0.2' //一键压缩png工具 classpath 'com.chenenyu:img-optimizer:1.3.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' classpath "com.alibaba:arouter-register:1.0.2" 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 3967d1273..f0530862d 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageSayHiNotifyDialog.java @@ -60,7 +60,8 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow { @Override public void buildDialog(XPopup.Builder builder) { - + builder.isClickThrough(true); + builder.isTouchThrough(true); } @Override diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 52545097d..6a4961c73 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -233,7 +233,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl //丢包率 long lossRate = statusBean.packetLostRate; //带宽 - String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth; + //String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth; // Log.e("网速和内存", "获取视频:" + resolution + " 丢包率:" + lossRate + " 带宽:" + googAvailableSendBandwidth); } } 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 0a42a1e67..f83e318f4 100644 --- a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java @@ -2,6 +2,10 @@ package com.yunbao.live.views; import android.graphics.Color; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.text.Editable; +import android.text.TextWatcher; import android.view.MotionEvent; import android.view.View; @@ -13,16 +17,23 @@ import com.yunbao.common.event.PDChatInputModeEvent; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.live.R; import com.yunbao.live.dialog.PDLiveMessageListAdapter; +import com.yunbao.live.event.InputPanelViewHolderEvent; import org.greenrobot.eventbus.EventBus; +import java.lang.reflect.Field; import java.util.List; 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; +import io.rong.imkit.conversation.extension.component.inputpanel.InputPanel; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; /** * 聊天详情页面 @@ -30,6 +41,7 @@ import io.rong.imkit.conversation.extension.RongExtensionViewModel; public class PDLiveConversationFragment extends ConversationFragment { PDLiveMessageListAdapter adapter; private String targetId = ""; + private String editString = null; public PDLiveConversationFragment(String targetId) { this.targetId = targetId; @@ -42,6 +54,36 @@ public class PDLiveConversationFragment extends ConversationFragment { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.parseColor("#00000000")); + //TODO 下面片段是尝试修复模拟器emoji无法唤起的bug。后续版本解决该问题: + //TODO 模拟器聊天框无法切换emoji表情,复现步骤: 1.点开语音 2.点+ 直到弹出插件栏 3.点emoji + /* View emoji = mRongExtension.getInputPanel().getRootView().findViewById(R.id.input_panel_emoji_btn); + emoji.setOnClickListener(click -> { + mRongExtension.getInputPanel().getEditText().clearFocus(); + if (mRongExtensionViewModel.getInputModeLiveData().getValue() != null && ((InputMode) mRongExtensionViewModel.getInputModeLiveData().getValue()).equals(InputMode.EmoticonMode)) { + mRongExtension.getInputPanel().getEditText().requestFocus(); + mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.TextInput); + } else { + ToastUtil.showDebug("切换到恶魔及"); + try { + Field mBoardContainerField = mRongExtension.getClass().getDeclaredField("mBoardContainer"); + mBoardContainerField.setAccessible(true); + View mBoardContainer = (View) mBoardContainerField.get(mRongExtension); + assert mBoardContainer != null; + if (mBoardContainer.getVisibility() == View.VISIBLE) { + mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode); + } else { + mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.PluginMode); + new Handler(Looper.getMainLooper()) + .postDelayed(() -> mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode), 100L); + } + } catch (Exception e) { + e.printStackTrace(); + } + //EventBus.getDefault().post(new InputPanelViewHolderEvent()); + + } + }); +*/ mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer() { @Override @@ -60,6 +102,22 @@ public class PDLiveConversationFragment extends ConversationFragment { EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput)); } }); + mRongExtension.getInputPanel().getEditText().addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + editString = editable.toString(); + } + }); } @Override @@ -70,7 +128,7 @@ public class PDLiveConversationFragment extends ConversationFragment { .getUserLiveStatus(ids, new HttpCallback>() { @Override public void onSuccess(List data) { - if(data.isEmpty()){ + if (data.isEmpty()) { adapter.setLeftLive(false); adapter.setRightLive(false); adapter.notifyDataSetChanged(); @@ -98,4 +156,8 @@ public class PDLiveConversationFragment extends ConversationFragment { public RongExtensionViewModel getRongExtensionViewModel() { return mRongExtensionViewModel; } + + public String getEditString() { + return editString; + } } 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 f578df7c7..ae558163b 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java @@ -473,7 +473,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl protected void onDestroy() { super.onDestroy(); //获取输入框信息存进输入框 - String content = inputPanel.getPresetInformation(); + String content = conversationFragment.getEditString(); if (!TextUtils.isEmpty(content)) { IMCenter.getInstance().saveTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, content, null); }