[Modify]修復公會消息bug
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.yizhuan.erban.ui.im;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
@@ -10,7 +12,9 @@ import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -120,6 +124,8 @@ public class MessageListPanelEx {
|
||||
// 待转发消息
|
||||
private IMMessage forwardMessage;
|
||||
private CountDownTimer countDownTimer;
|
||||
private boolean isShowAnim = false;
|
||||
|
||||
private OnItemClickListener listener = new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(IRecyclerView adapter, View view, int position) {
|
||||
@@ -855,10 +861,10 @@ public class MessageListPanelEx {
|
||||
}
|
||||
}
|
||||
|
||||
private int getLoadMsgCount(){
|
||||
if(TextUtils.isEmpty(recordId)){
|
||||
private int getLoadMsgCount() {
|
||||
if (TextUtils.isEmpty(recordId)) {
|
||||
return NimUIKitImpl.getOptions().messageCountLoadOnce;
|
||||
}else {
|
||||
} else {
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
@@ -940,7 +946,7 @@ public class MessageListPanelEx {
|
||||
if (firstLoad) {
|
||||
doScrollToBottom();
|
||||
sendReceipt(); // 发送已读回执
|
||||
if (!TextUtils.isEmpty(recordId)) {
|
||||
if (!TextUtils.isEmpty(recordId) && !isShowAnim) {
|
||||
doScrollToPosition();
|
||||
}
|
||||
}
|
||||
@@ -956,6 +962,28 @@ public class MessageListPanelEx {
|
||||
int index = getApplyItemIndex(recordId);
|
||||
if (index >= 0 && index < items.size()) {
|
||||
messageListView.scrollToPosition(index);
|
||||
messageListView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||
// 默认选中第一个
|
||||
RecyclerView.LayoutManager layoutManager = messageListView.getLayoutManager();
|
||||
if (layoutManager != null) {
|
||||
View view = layoutManager.findViewByPosition(index);
|
||||
RelativeLayout relativeLayout = (RelativeLayout) view; //获取布局中任意控件对象
|
||||
FrameLayout frameLayout = null;
|
||||
if (relativeLayout != null) {
|
||||
frameLayout = relativeLayout.findViewById(R.id.message_item_content);
|
||||
}
|
||||
if (frameLayout != null) {
|
||||
//透明度起始为1,结束时为0
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(frameLayout, "alpha", 0f, 1f);
|
||||
animator.setDuration(1500);//时间1s
|
||||
animator.setRepeatCount(1);
|
||||
animator.setRepeatMode(ValueAnimator.RESTART);
|
||||
animator.start();
|
||||
|
||||
isShowAnim = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
Reference in New Issue
Block a user