From dbebb942e35b1889d4c2fa92b3515909ba9ce238 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 8 Apr 2024 16:34:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=86=85=E5=AE=B9=E4=BC=9A=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 +- .../dialog/MessageLongClickPopuwindow.java | 13 ++++ .../views/PDLiveConversationFragment.java | 64 ++++++++++--------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f90b64087..88b48481f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ - + 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 f0063489f..4eeadc1b2 100644 --- a/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/MessageLongClickPopuwindow.java @@ -120,7 +120,20 @@ public class MessageLongClickPopuwindow implements View.OnClickListener { IMCenter.getInstance().deleteMessages(message.getConversationType(), message.getTargetId(), new int[]{message.getMessageId()}, new RongIMClient.ResultCallback() { @Override public void onSuccess(Boolean aBoolean) { + if(aBoolean){ + IMCenter.getInstance().deleteRemoteMessages(message.getConversationType(), message.getTargetId(), new Message[]{message}, new RongIMClient.OperationCallback() { + @Override + public void onSuccess() { + + } + + @Override + public void onError(RongIMClient.ErrorCode errorCode) { + + } + }); + } } @Override 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 04ea7dc89..e94d12142 100644 --- a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java @@ -7,8 +7,11 @@ import android.os.Looper; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; +import android.util.Log; import android.view.MotionEvent; import android.view.View; +import android.view.ViewGroup; +import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -34,6 +37,7 @@ 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.imkit.utils.RongUtils; import io.rong.imkit.widget.refresh.api.RefreshLayout; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; @@ -77,39 +81,41 @@ public class PDLiveConversationFragment extends ConversationFragment { }); 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("切换到恶魔及"); + + mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer() { + RelativeLayout mBoardContainer; + public void onChanged(InputMode inputMode) { + //TODO 以下是修复在雷电模拟器中,点表情无法显示bug的代码。移除注释即可修复 + /*int saveKeyboardHeight = RongUtils.getSaveKeyBoardHeight(getContext(), getContext().getResources().getConfiguration().orientation); + boolean isShow=false; + int lph=-1; + int pix=-1; 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) { + Field field = mRongExtension.getClass().getDeclaredField("mBoardContainer"); + field.setAccessible(true); + mBoardContainer = (RelativeLayout) field.get(mRongExtension); + ViewGroup.LayoutParams layoutParams = mBoardContainer.getLayoutParams(); + lph=layoutParams.height; + pix=getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height); + isShow = saveKeyboardHeight <= 0 && layoutParams.height != getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height); + + layoutParams.height=0; + mBoardContainer.setLayoutParams(layoutParams); + }catch (Exception e){ e.printStackTrace(); } - //EventBus.getDefault().post(new InputPanelViewHolderEvent()); - - } - }); + *//* Log.i("表情", "onChanged: 安全键高度:"+saveKeyboardHeight+" 判断通过:"+isShow+" 布局height = "+lph+" pix = "+pix); + new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { + @Override + public void run() { + try { + Log.i("表情", "onChanged: "+inputMode+"|"+mBoardContainer.getVisibility()+"|"+mBoardContainer.getHeight()); + }catch (Exception e){ + e.printStackTrace(); + } + } + },300L);*//* */ - mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer() { - @Override - public void onChanged(InputMode inputMode) { } }); mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() {