房间 合并 寻爱 动态/静态 飘屏 队列
This commit is contained in:
@@ -41,6 +41,8 @@ import com.yizhuan.xchat_android_constants.XChatConstants
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.*
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent
|
||||
@@ -88,9 +90,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
private var boxDisposable: Disposable? = null
|
||||
private val messagesBox: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
|
||||
private var boxSVGADisposable: Disposable? = null
|
||||
private val messagesBoxSVGA: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
|
||||
private var animationLuckyGift: Animation? = null
|
||||
private var disposableLuckyGift: Disposable? = null
|
||||
private val messagesLuckyGift: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
@@ -153,7 +152,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotifyBySVGA(roomEvent.chatRoomMessage)
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.RADISH_NOTIFY,
|
||||
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
||||
@@ -317,9 +316,16 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
.takeWhile { messagesBox.size > 0 && !mContext.isDestroyed() }
|
||||
.subscribe {
|
||||
if (binding.flBoxNotify.childCount == 0) {
|
||||
showBoxNotify(
|
||||
messagesBox.removeAt(0)
|
||||
)
|
||||
val msg = messagesBox.removeAt(0)
|
||||
val attachment = msg.attachment
|
||||
if (attachment is CustomAttachment) {
|
||||
if (attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY) {
|
||||
showBoxNotify(msg)
|
||||
} else if(attachment.second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
showBoxNotifyBySVGA(msg)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -366,30 +372,6 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸運池飄屏 五級 SVGA背景的
|
||||
*
|
||||
* @param chatRoomMessage
|
||||
*/
|
||||
private fun addBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
binding.clNotify.visibility = VISIBLE
|
||||
}
|
||||
messagesBoxSVGA.add(chatRoomMessage)
|
||||
if (boxSVGADisposable == null || messagesBoxSVGA.size == 1) {
|
||||
boxSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.takeWhile { messagesBoxSVGA.size > 0 && !mContext.isDestroyed() }
|
||||
.subscribe {
|
||||
if (binding.flSvgaBoxNotify.childCount == 0) {
|
||||
showBoxNotifyBySVGA(
|
||||
messagesBoxSVGA.removeAt(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
|
||||
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
|
||||
val text = SpannableBuilder()
|
||||
@@ -423,15 +405,15 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
animationBox!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
binding.flSvgaBoxNotify.removeView(svgaImageView)
|
||||
binding.flBoxNotify.removeView(svgaImageView)
|
||||
}
|
||||
})
|
||||
binding.flSvgaBoxNotify.startAnimation(animationBox)
|
||||
binding.flBoxNotify.startAnimation(animationBox)
|
||||
}
|
||||
}
|
||||
animationBox = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flSvgaBoxNotify.addView(svgaImageView)
|
||||
binding.flSvgaBoxNotify.startAnimation(animationBox)
|
||||
binding.flBoxNotify.addView(svgaImageView)
|
||||
binding.flBoxNotify.startAnimation(animationBox)
|
||||
|
||||
shareParser().decodeFromAssets("svga/box_notify.svga", object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
|
@@ -94,13 +94,6 @@
|
||||
app:layout_constraintDimensionRatio="75:12"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_svga_box_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="75:11"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_dating_all_notify"
|
||||
android:layout_width="match_parent"
|
||||
|
Reference in New Issue
Block a user