修复 更新问题

修复 删除聊天内容会恢复问题
This commit is contained in:
zlzw 2024-04-08 16:34:14 +08:00
parent ed20df63eb
commit dbebb942e3
3 changed files with 49 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
> >
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission <uses-permission
android:name="android.permission.CALL_PHONE" android:name="android.permission.CALL_PHONE"
tools:node="remove" /> tools:node="remove" />

View File

@ -120,7 +120,20 @@ public class MessageLongClickPopuwindow implements View.OnClickListener {
IMCenter.getInstance().deleteMessages(message.getConversationType(), message.getTargetId(), new int[]{message.getMessageId()}, new RongIMClient.ResultCallback<Boolean>() { IMCenter.getInstance().deleteMessages(message.getConversationType(), message.getTargetId(), new int[]{message.getMessageId()}, new RongIMClient.ResultCallback<Boolean>() {
@Override @Override
public void onSuccess(Boolean aBoolean) { 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 @Override

View File

@ -7,8 +7,11 @@ import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; 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.InputMode;
import io.rong.imkit.conversation.extension.RongExtensionViewModel; import io.rong.imkit.conversation.extension.RongExtensionViewModel;
import io.rong.imkit.conversation.extension.component.inputpanel.InputPanel; 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.imkit.widget.refresh.api.RefreshLayout;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -77,39 +81,41 @@ public class PDLiveConversationFragment extends ConversationFragment {
}); });
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(Color.parseColor("#00000000")); view.setBackgroundColor(Color.parseColor("#00000000"));
//TODO 下面片段是尝试修复模拟器emoji无法唤起的bug后续版本解决该问题
//TODO 模拟器聊天框无法切换emoji表情复现步骤 1.点开语音 2.+ 直到弹出插件栏 3.点emoji mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
/* View emoji = mRongExtension.getInputPanel().getRootView().findViewById(R.id.input_panel_emoji_btn); RelativeLayout mBoardContainer;
emoji.setOnClickListener(click -> { public void onChanged(InputMode inputMode) {
mRongExtension.getInputPanel().getEditText().clearFocus(); //TODO 以下是修复在雷电模拟器中点表情无法显示bug的代码移除注释即可修复
if (mRongExtensionViewModel.getInputModeLiveData().getValue() != null && ((InputMode) mRongExtensionViewModel.getInputModeLiveData().getValue()).equals(InputMode.EmoticonMode)) { /*int saveKeyboardHeight = RongUtils.getSaveKeyBoardHeight(getContext(), getContext().getResources().getConfiguration().orientation);
mRongExtension.getInputPanel().getEditText().requestFocus(); boolean isShow=false;
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.TextInput); int lph=-1;
} else { int pix=-1;
ToastUtil.showDebug("切换到恶魔及");
try { try {
Field mBoardContainerField = mRongExtension.getClass().getDeclaredField("mBoardContainer"); Field field = mRongExtension.getClass().getDeclaredField("mBoardContainer");
mBoardContainerField.setAccessible(true); field.setAccessible(true);
View mBoardContainer = (View) mBoardContainerField.get(mRongExtension); mBoardContainer = (RelativeLayout) field.get(mRongExtension);
assert mBoardContainer != null; ViewGroup.LayoutParams layoutParams = mBoardContainer.getLayoutParams();
if (mBoardContainer.getVisibility() == View.VISIBLE) { lph=layoutParams.height;
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode); pix=getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height);
} else { isShow = saveKeyboardHeight <= 0 && layoutParams.height != getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height);
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.PluginMode);
new Handler(Looper.getMainLooper()) layoutParams.height=0;
.postDelayed(() -> mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode), 100L); mBoardContainer.setLayoutParams(layoutParams);
}
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
//EventBus.getDefault().post(new InputPanelViewHolderEvent()); *//* Log.i("表情", "onChanged: 安全键高度:"+saveKeyboardHeight+" 判断通过:"+isShow+" 布局height = "+lph+" pix = "+pix);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
}
});
*/
mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
@Override @Override
public void onChanged(InputMode inputMode) { public void run() {
try {
Log.i("表情", "onChanged: "+inputMode+"|"+mBoardContainer.getVisibility()+"|"+mBoardContainer.getHeight());
}catch (Exception e){
e.printStackTrace();
}
}
},300L);*//*
*/
} }
}); });
mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() { mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() {