[Modify]修復消息列表bug

This commit is contained in:
wushaocheng
2023-02-28 01:58:33 +08:00
parent 766a599458
commit 9e3ae17849

View File

@@ -72,6 +72,7 @@ import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.module_hall.im.HallAttachment; import com.yizhuan.xchat_android_core.module_hall.im.HallAttachment;
import com.yizhuan.xchat_android_core.module_hall.im.HallImMsgInfo; import com.yizhuan.xchat_android_core.module_hall.im.HallImMsgInfo;
import com.yizhuan.xchat_android_core.room.event.MessageSizeEvent; import com.yizhuan.xchat_android_core.room.event.MessageSizeEvent;
import com.yizhuan.xchat_android_core.utils.Logger;
import com.yizhuan.xchat_android_library.utils.ResUtil; import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil; import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
@@ -529,7 +530,7 @@ public class MessageListPanelEx {
if (message.getAttachment() instanceof HallAttachment) { if (message.getAttachment() instanceof HallAttachment) {
HallAttachment attachment = (HallAttachment) message.getAttachment(); HallAttachment attachment = (HallAttachment) message.getAttachment();
HallImMsgInfo info = attachment.getHallImMsgInfo(); HallImMsgInfo info = attachment.getHallImMsgInfo();
if (info != null && info.getUrl() != null) { if (info != null && info.getUrl() != null && info.getUrl().contains("recordId")) {
Uri uri = Uri.parse(info.getUrl()); Uri uri = Uri.parse(info.getUrl());
String record = uri.getQueryParameter("recordId"); String record = uri.getQueryParameter("recordId");
if (recordId.equals(record)) { if (recordId.equals(record)) {
@@ -947,9 +948,10 @@ public class MessageListPanelEx {
if (firstLoad) { if (firstLoad) {
doScrollToBottom(); doScrollToBottom();
sendReceipt(); // 发送已读回执 sendReceipt(); // 发送已读回执
if (!TextUtils.isEmpty(recordId) && !isShowAnim) { }
doScrollToPosition();
} if (!TextUtils.isEmpty(recordId) && !isShowAnim) {
doScrollToPosition();
} }
firstLoad = false; firstLoad = false;
@@ -961,8 +963,12 @@ public class MessageListPanelEx {
@Override @Override
public void run() { public void run() {
int index = getApplyItemIndex(recordId); int index = getApplyItemIndex(recordId);
if(index == -1){
messageListView.scrollToPosition(0);
return;
}
if (index >= 0 && index < items.size()) { if (index >= 0 && index < items.size()) {
messageListView.scrollToPosition(index); messageListView.scrollToPosition(adapter.getHeaderLayoutCount()+index);
messageListView.post(() -> { messageListView.post(() -> {
RecyclerView.LayoutManager layoutManager = messageListView.getLayoutManager(); RecyclerView.LayoutManager layoutManager = messageListView.getLayoutManager();
if (layoutManager != null) { if (layoutManager != null) {