[Modify]幸运塔罗新增公屏通知, 飘屏

This commit is contained in:
wzq
2023-09-15 18:31:57 +08:00
parent bfd619e8b5
commit 306e0a99a0
15 changed files with 266 additions and 39 deletions

View File

@@ -85,6 +85,7 @@
android:theme="@style/MyMaterialTheme"
tools:replace="android:name,android:allowBackup"
tools:targetApi="n">
<activity
android:name=".other.activity.SplashActivity"
android:exported="true"
@@ -1004,6 +1005,8 @@
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="Mob-Https" android:value="yes"/>
<provider
android:name="com.netease.nimlib.ipc.NIMContentProvider"
android:authorities="${applicationId}.ipc.provider"

Binary file not shown.

View File

@@ -97,6 +97,7 @@ import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FairyMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
@@ -105,6 +106,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
import com.yizhuan.xchat_android_core.initial.InitialModel;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
@@ -1243,6 +1246,20 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
}
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
TarotAttachment tarotAttachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT,
CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING);
tarotAttachment.setTarotMsgBean(tarotMsgBean);
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
String.valueOf(AvRoomDataManager.get().getRoomId()), tarotAttachment);
IMNetEaseManager.get().getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.TAROT_NOTIFY_SVGA)
.setChatRoomMessage(message));
}
break;
case CUSTOM_MSG_LUCKY_SEA://星级厨房
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);

View File

@@ -1310,15 +1310,25 @@ public class MessageView extends FrameLayout {
private void setTarotMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
TarotAttachment attachment = (TarotAttachment) chatRoomMessage.getAttachment();
if (attachment.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS) {
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
SpannableBuilder text = new SpannableBuilder(tvContent)
.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
SpannableBuilder text = new SpannableBuilder(tvContent);
switch (attachment.getSecond()) {
case CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS:
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(" " + tarotMsgBean.getDrawMsgText(), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
break;
case CustomAttachment.CUSTOM_MESS_TAROT_JUNIOR_PRIZE_WINNING:
case CustomAttachment.CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING:
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(ResUtil.getString(R.string.avroom_widget_messageview_0160), new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + ResUtil.getString(R.string.avroom_widget_messageview_027), new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
break;
}
}

View File

@@ -20,6 +20,7 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.text.HtmlCompat
import com.coorchice.library.SuperTextView
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
@@ -31,6 +32,7 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.bean.RoomPlayBean
import com.yizhuan.erban.avroom.helper.AnimHelper
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
import com.yizhuan.erban.databinding.LayoutNotifyTarotIntermediateBinding
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.ui.utils.isDestroyed
@@ -41,6 +43,7 @@ import com.yizhuan.erban.ui.widget.SimpleAnimListener
import com.yizhuan.erban.ui.widget.drawgift.DrawGiftPlayHelper
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
import com.yizhuan.erban.utils.MsgBuilder
import com.yizhuan.erban.utils.RegexUtil
import com.yizhuan.erban.utils.SpannableBuilder
import com.yizhuan.xchat_android_constants.XChatConstants
import com.yizhuan.xchat_android_core.auth.AuthModel
@@ -56,6 +59,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
import com.yizhuan.xchat_android_library.utils.ListUtils
import com.yizhuan.xchat_android_library.utils.ResUtil
import com.yizhuan.xchat_android_library.utils.StringUtils
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
@@ -164,18 +168,28 @@ class RoomEffectView @JvmOverloads constructor(
RoomEvent.BOX_NOTIFY -> {//寻爱
addPlayNotify(RoomEvent.BOX_NOTIFY, roomEvent.chatRoomMessage)
}
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱svga
addPlayNotify(RoomEvent.BOX_NOTIFY_SVGA, roomEvent.chatRoomMessage)
}
RoomEvent.TAROT_NOTIFY,
RoomEvent.TAROT_NOTIFY_SVGA -> {
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
}
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE ->//全服福袋
//廳內福袋
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {// 星级厨房房间飘屏通知
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
}
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {// 星级厨房全服飘屏通知
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
}
RoomEvent.FAIRY_DRAW_GIFT_L4,
RoomEvent.FAIRY_DRAW_GIFT_L5,
RoomEvent.FAIRY_CONVERT_L1,
@@ -183,17 +197,21 @@ class RoomEffectView @JvmOverloads constructor(
RoomEvent.FAIRY_CONVERT_L3 -> {
addPlayNotify(roomEvent.event, roomEvent.chatRoomMessage)
}
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
RoomEvent.RADISH_NOTIFY,
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
RoomEvent.ROOM_GIFT_COMPOUND -> addGiftCompoundNotify(roomEvent.chatRoomMessage)
RoomEvent.DATING_PUBLISH_RESULT -> showHandAnim((roomEvent.chatRoomMessage.attachment as DatingAttachment).datingNotifyInfo)
RoomEvent.RECEIVE_MEMBER_IN_NOTICE -> //進入房間
addMemberInNotify(roomEvent.chatRoomMessage)
RoomEvent.RECEIVE_EXPER_LEVEL_UP_NOTICE -> addLevelUpNotify(roomEvent.chatRoomMessage)
RoomEvent.ENTER_ROOM -> if (!SuperAdminUtil.isSuperAdmin()) {
playCarSvga(AuthModel.get().currentUid.toString(), null, true)
}
RoomEvent.CAR_MEMBER_IN -> if (roomEvent.mRoomCarMsgAttachment != null) {
playCarSvga(
null,
@@ -205,6 +223,7 @@ class RoomEffectView @JvmOverloads constructor(
false
)
}
RoomEvent.ROOM_PK_NOTIFY -> addRoomPKNotify(roomEvent.chatRoomMessage)
RoomEvent.SINGLE_ROOM_PK_NOTIFY -> addSingleRoomPKNotify(roomEvent.chatRoomMessage)
RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY -> showSingleRoomRankNotify(roomEvent.chatRoomMessage)
@@ -213,9 +232,11 @@ class RoomEffectView @JvmOverloads constructor(
isHideCarEffect = true
loopCarAnim()
}
RoomEvent.ROOM_CAR_EFFECT_SHOW -> {
isHideCarEffect = false
}
RoomEvent.DRAW_GIFT_EFFECT -> {
val drawGiftAttachment =
(roomEvent.chatRoomMessage?.attachment as? DrawGiftAttachment)
@@ -226,6 +247,7 @@ class RoomEffectView @JvmOverloads constructor(
false
)
}
else -> {}
}
}
@@ -284,6 +306,7 @@ class RoomEffectView @JvmOverloads constructor(
)
}
}
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱
if ((mContext as AVRoomActivity).isTopActivity) {
isPlayAnim = true
@@ -308,6 +331,59 @@ class RoomEffectView @JvmOverloads constructor(
showBoxNotifyBySVGA(messagesPlay.removeAt(0))
}
}
RoomEvent.TAROT_NOTIFY -> {
if ((mContext as AVRoomActivity).isTopActivity) {
isPlayAnim = true
val isPlay = onPlayAnimCallback?.invoke() ?: false
if (isPlay) {
margin(
binding.clNotify,
0,
UIUtil.dip2px(context, 180.0),
0,
0
)
} else {
margin(
binding.clNotify,
0,
UIUtil.dip2px(context, 60.0),
0,
0
)
}
showTarotNotify(
messagesPlay.removeAt(0)
)
}
}
RoomEvent.TAROT_NOTIFY_SVGA -> {
if ((mContext as AVRoomActivity).isTopActivity) {
isPlayAnim = true
val isPlay = onPlayAnimCallback?.invoke() ?: false
if (isPlay) {
margin(
binding.clNotify,
0,
UIUtil.dip2px(context, 180.0),
0,
0
)
} else {
margin(
binding.clNotify,
0,
UIUtil.dip2px(context, 60.0),
0,
0
)
}
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
}
}
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> {//福袋
isPlayAnim = true
val isPlay = onPlayAnimCallback?.invoke() ?: false
@@ -320,6 +396,7 @@ class RoomEffectView @JvmOverloads constructor(
messagesPlay.removeAt(0)
)
}
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
isPlayAnim = true
val isPlay = onPlayAnimCallback?.invoke() ?: false
@@ -332,6 +409,7 @@ class RoomEffectView @JvmOverloads constructor(
messagesPlay.removeAt(0)
)
}
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
isPlayAnim = true
val isPlay = onPlayAnimCallback?.invoke() ?: false
@@ -344,6 +422,7 @@ class RoomEffectView @JvmOverloads constructor(
messagesPlay.removeAt(0)
)
}
RoomEvent.FAIRY_DRAW_GIFT_L4,
RoomEvent.FAIRY_DRAW_GIFT_L5,
RoomEvent.FAIRY_CONVERT_L1,
@@ -389,6 +468,7 @@ class RoomEffectView @JvmOverloads constructor(
SHOW_TIME.toLong()
)
}
RoomEvent.FAIRY_DRAW_GIFT_L5,
RoomEvent.FAIRY_CONVERT_L3 -> {
showFairyNotifyBySVGA(roomPlayBean)
@@ -759,6 +839,33 @@ class RoomEffectView @JvmOverloads constructor(
)
}
private fun showTarotNotify(roomPlayBean: RoomPlayBean) {
val chatRoomMessage = roomPlayBean.chatRoomMessage
val attachment = chatRoomMessage.attachment as TarotAttachment
val textView =
LayoutInflater.from(mContext).inflate(R.layout.layout_notify_tarot_intermediate, null) as TextView
val string = mContext.getString(
R.string.avroom_widget_roomeffectview_026,
StringUtils.abbreviate(RegexUtil.getPrintableString(attachment.tarotMsgBean.nick), 8),
attachment.tarotMsgBean.drawGoldNum
)
textView.text = HtmlCompat.fromHtml(string, HtmlCompat.FROM_HTML_MODE_COMPACT)
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
binding.flPlayNotify.addView(textView)
textView.startAnimation(animationPlay)
binding.flPlayNotify.postDelayed(
{
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
textView.startAnimation(animationPlay)
},
SHOW_TIME.toLong()
)
binding.flPlayNotify.postDelayed({
binding.flPlayNotify.removeView(textView)
isPlayAnim = false
}, CLOSE_TIME.toLong())
}
private fun showBoxNotify(roomPlayBean: RoomPlayBean) {
val chatRoomMessage = roomPlayBean.chatRoomMessage
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
@@ -802,6 +909,58 @@ class RoomEffectView @JvmOverloads constructor(
}, CLOSE_TIME.toLong())
}
private fun showTarotNotifyBySVGA(roomPlayBean: RoomPlayBean) {
val chatRoomMessage = roomPlayBean.chatRoomMessage
val attachment = chatRoomMessage.attachment as TarotAttachment
val string = mContext.getString(
R.string.avroom_widget_roomeffectview_026,
StringUtils.abbreviate(RegexUtil.getPrintableString(attachment.tarotMsgBean.nick), 8),
attachment.tarotMsgBean.drawGoldNum
)
val text = HtmlCompat.fromHtml(string, HtmlCompat.FROM_HTML_MODE_COMPACT)
val svgaImageView = SVGAImageView(mContext)
svgaImageView.loops = 1
svgaImageView.clearsAfterStop = true
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
svgaImageView.layoutParams = params
svgaImageView.callback = object : SimpleSvgaCallback() {
override fun onFinished() {
binding.flPlayNotify.post {
binding.flPlayNotify.removeView(svgaImageView)
isPlayAnim = false
}
}
}
binding.flPlayNotify.addView(svgaImageView)
shareParser().decodeFromAssets("svga/svga_tarot_senior.svga", object : SVGAParser.ParseCompletion {
override fun onComplete(videoItem: SVGAVideoEntity) {
val dynamicEntity = SVGADynamicEntity()
val textPaint = TextPaint()
textPaint.color = Color.WHITE //字體顏色
textPaint.textSize = 22f
dynamicEntity.setDynamicText(
StaticLayout(
text,
0,
text.length,
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "taxt"
)
val drawable = SVGADrawable(videoItem, dynamicEntity)
svgaImageView.setImageDrawable(drawable)
svgaImageView.stepToFrame(0, true)
}
override fun onError() {}
}, null)
}
private fun showBoxNotifyBySVGA(roomPlayBean: RoomPlayBean) {
val chatRoomMessage = roomPlayBean.chatRoomMessage
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<com.coorchice.library.SuperTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_tarot_intermediate_notice"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingStart="@dimen/dp_50"
android:paddingEnd="0dp"
android:textColor="@color/white"
android:textSize="11sp"
tools:layout_height="wrap_content"
tools:text="@string/avroom_widget_roomeffectview_026" />

View File

@@ -1776,6 +1776,7 @@
<string name="avroom_widget_messageview_0157">歡迎TA</string>
<string name="avroom_widget_messageview_0158"> 駕著 </string>
<string name="avroom_widget_messageview_0159">進入了房間</string>
<string name="avroom_widget_messageview_0160">在幸運塔羅中運氣爆發,獲得</string>
<string name="avroom_widget_pkboardview_01">未開始</string>
<string name="avroom_widget_pkboardview_02">您已經在排麥了~</string>
<string name="avroom_widget_pkboardview_03">您已經在排麥了~</string>
@@ -1807,6 +1808,7 @@
<string name="avroom_widget_roomeffectview_023">的邀請,進入了房間</string>
<string name="avroom_widget_roomeffectview_024">svga解析失敗</string>
<string name="avroom_widget_roomeffectview_025">恭喜</string>
<string name="avroom_widget_roomeffectview_026">恭喜&lt;font color=&quot;#FFEE8F&quot;&gt;%s&lt;/font&gt;在幸運塔羅中運氣爆發,獲得&lt;font color=&quot;#FFEE8F&quot;&gt;%d&lt;/font&gt;钻石!</string>
<string name="avroom_widget_roomranknavigatoradapter_01">貢獻榜</string>
<string name="avroom_widget_roomranknavigatoradapter_02">魅力榜</string>
<string name="erban_base_baseactivity_01">請稍後...</string>