修复福袋房间飘屏不展示的问题

This commit is contained in:
huangjian
2021-02-27 18:37:51 +08:00
parent 9bf9321ec9
commit 05251bf784
3 changed files with 18 additions and 2 deletions

View File

@@ -31,7 +31,9 @@ import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.netease.nimlib.sdk.msg.model.BroadcastMessage;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
@@ -71,7 +73,9 @@ import com.yizhuan.xchat_android_core.DemoCache;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
@@ -129,6 +133,8 @@ import io.reactivex.disposables.Disposable;
import static android.view.View.VISIBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY;
/**
@@ -1303,7 +1309,16 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
}
}
break;
case CUSTOM_MSG_LUCKY_GIFT:
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY) {
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class));
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
IMNetEaseManager.get().noticeServiceLuckyBagNotice(message);
}
break;
default:
break;
}
}

View File

@@ -250,7 +250,7 @@ public class RoomEffectView extends FrameLayout {
animationDatingAll = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify);
binding.flDatingAllNotify.addView(textView);
textView.startAnimation(animationDatingAll);
binding.flDatingAllNotify.postDelayed(() -> binding.flDatingAllNotify.removeView(textView), SHOW_TIME);
binding.flDatingAllNotify.postDelayed(() -> binding.flDatingAllNotify.removeView(textView), 4500);
}
private String getShortString(String text, int max) {
@@ -296,6 +296,7 @@ public class RoomEffectView extends FrameLayout {
.append("开出了", new ForegroundColorSpan(Color.WHITE))
.append(noticeInfo.getGiftName(), new ForegroundColorSpan(getResources().getColor(R.color.notice_gift)));
textView.setText(text.build());
binding.flLuckyGiftNotify.addView(textView);
animationLuckyGift = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify);
textView.startAnimation(animationLuckyGift);
binding.flLuckyGiftNotify.postDelayed(() -> binding.flLuckyGiftNotify.removeView(textView), SHOW_TIME);

View File

@@ -3292,7 +3292,7 @@ public final class IMNetEaseManager {
.setChatRoomMessage(msg));
}
private void noticeServiceLuckyBagNotice(ChatRoomMessage msg) {
public void noticeServiceLuckyBagNotice(ChatRoomMessage msg) {
getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE)