fix: 修复bug, 调整升级弹窗不再弹出, 兼容旧版本连击横幅,礼物动画加快,
This commit is contained in:
@@ -97,7 +97,7 @@ public class GlobalHandleManager {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()) return;
|
||||
LevelUpDialog.start(activity, event.getLevelName(), true);
|
||||
// LevelUpDialog.start(activity, event.getLevelName(), true);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -105,7 +105,7 @@ public class GlobalHandleManager {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying()) return;
|
||||
LevelUpDialog.start(activity, event.getLevelName(), false);
|
||||
// LevelUpDialog.start(activity, event.getLevelName(), false);
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
|
@@ -698,10 +698,10 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
// 连击 特殊动画
|
||||
if (ComboUtil.INSTANCE.isChangePoint() && giftInfo.uid == AuthModel.get().getCurrentUid()){
|
||||
objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2c, p3c, p1c, p0c);
|
||||
time = 1000;
|
||||
time = 600;
|
||||
}else {
|
||||
objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2, p3, p1, p0);
|
||||
time = 4000;
|
||||
time = 2000;
|
||||
}
|
||||
|
||||
objectAnimator.setDuration(time);
|
||||
|
@@ -87,6 +87,8 @@ class GiftComboButtonView @JvmOverloads constructor(
|
||||
|
||||
mBinding.svga.stopAnimation()
|
||||
mBinding.svga.startAnimation()
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun onBtnUp(){
|
||||
@@ -148,6 +150,13 @@ class GiftComboButtonView @JvmOverloads constructor(
|
||||
comboNum += num
|
||||
comboCount++
|
||||
mBinding.tvNum.text = "x$comboCount"
|
||||
mBinding.tvNum.scaleX = 1.3f
|
||||
mBinding.tvNum.scaleY = 1.3f
|
||||
mBinding.tvNum.animate()
|
||||
.setDuration(100)
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.start()
|
||||
ComboUtil.comboCount = comboCount+1
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@ package com.chwl.app.ui.widget
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.PropertyValuesHolder
|
||||
import android.animation.ValueAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
@@ -16,9 +15,9 @@ import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import com.alibaba.fastjson.JSON
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||
import com.chwl.app.ui.utils.SoftPool
|
||||
@@ -61,26 +60,24 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
* 创建
|
||||
*/
|
||||
private fun getComboChildView(): View {
|
||||
return cacheView.acquire {
|
||||
val view = cacheView.acquire {
|
||||
inflater.inflate(R.layout.item_gift_combo_view, this, false)
|
||||
}.apply {
|
||||
createViewHolder(this)
|
||||
isVisible = true
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
/**
|
||||
* add data
|
||||
*/
|
||||
fun add(giftComboInfo: GiftComboInfo?) {
|
||||
LogUtils.d(" ComboView add --start")
|
||||
//没有绑定之前不能添加
|
||||
if (!isAttachedToWindow) {
|
||||
LogUtils.d(" ComboView add isAttachedToWindow --end")
|
||||
return
|
||||
}
|
||||
if (giftComboInfo == null) {
|
||||
LogUtils.d(" ComboView add giftComboInfo == null --end")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -88,7 +85,6 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
var addToWaiting = true
|
||||
for (comboInfo in showingList) {
|
||||
if(comboInfo.sentUserid == giftComboInfo.sentUserid && comboInfo.giftId == giftComboInfo.giftId){
|
||||
LogUtils.d(" ComboView add showingList "+giftComboInfo.sentUserid)
|
||||
comboInfo.giftNumber = giftComboInfo.giftNumber
|
||||
comboInfo.comboCount = giftComboInfo.comboCount
|
||||
comboInfo.receiverNumber = giftComboInfo.receiverNumber
|
||||
@@ -99,7 +95,6 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
|
||||
for (comboInfo in waitingList) {
|
||||
if(comboInfo.sentUserid == giftComboInfo.sentUserid && comboInfo.giftId == giftComboInfo.giftId){
|
||||
LogUtils.d(" ComboView add waitingList "+giftComboInfo.sentUserid)
|
||||
comboInfo.giftNumber = giftComboInfo.giftNumber
|
||||
comboInfo.comboCount = giftComboInfo.comboCount
|
||||
comboInfo.receiverNumber = giftComboInfo.receiverNumber
|
||||
@@ -112,22 +107,17 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
showNext()
|
||||
LogUtils.d(" ComboView add --end")
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数量
|
||||
*/
|
||||
private fun updateNum(giftComboInfo: GiftComboInfo) {
|
||||
LogUtils.d(" ComboView updateNum --start")
|
||||
val view = comboMap[giftComboInfo] ?: return
|
||||
|
||||
val viewHolder = getViewHolder(view)
|
||||
viewHolder?.refreshNum(giftComboInfo, true)
|
||||
handle.removeMessages(1, giftComboInfo)
|
||||
handle.sendMessageDelayed(Message.obtain(handle, 1, giftComboInfo), COMBO_STAY_TIME * 1000L)
|
||||
|
||||
LogUtils.d(" ComboView updateNum --end")
|
||||
}
|
||||
|
||||
|
||||
@@ -136,9 +126,7 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
* 显示下一个
|
||||
*/
|
||||
private fun showNext() {
|
||||
LogUtils.d(" ComboView showNext --start")
|
||||
if(waitingList.isEmpty()){
|
||||
LogUtils.d(" ComboView showNext isEmpty --end")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -157,10 +145,8 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
if(showingList.size > MAX_SHOWING){
|
||||
handle.removeMessages(1, showingList[0])
|
||||
viewOut(showingList.remove(), true)
|
||||
LogUtils.d(" ComboView showNext MAX_SHOWING --end")
|
||||
return
|
||||
}
|
||||
LogUtils.d(" ComboView showNext --end")
|
||||
}
|
||||
|
||||
|
||||
@@ -169,12 +155,10 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
* 移除动画
|
||||
*/
|
||||
private fun viewOut(giftComboInfo: GiftComboInfo?, isDirectRemove: Boolean) {
|
||||
LogUtils.d(" ComboView viewOut --start")
|
||||
giftComboInfo ?: return
|
||||
val comboView = comboMap.remove(giftComboInfo) ?: return
|
||||
LogUtils.d(" ComboView viewOut init runnable")
|
||||
|
||||
val runnable = {
|
||||
LogUtils.d(" ComboView viewOut init runnable -- start")
|
||||
val viewHolder = getViewHolder(comboView)
|
||||
viewHolder?.clear()
|
||||
if(!isDirectRemove){
|
||||
@@ -183,13 +167,11 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
removeView(comboView)
|
||||
cacheView.release(comboView)
|
||||
showNext()
|
||||
LogUtils.d(" ComboView viewOut init runnable -- end")
|
||||
}
|
||||
|
||||
if(isDirectRemove){
|
||||
comboView.isGone = true
|
||||
rootView.post(runnable)
|
||||
LogUtils.d(" ComboView viewOut -- isDirectRemove ")
|
||||
post(runnable)
|
||||
}else{
|
||||
val animOut = AnimationUtils.loadAnimation(context, R.anim.alpha_out)
|
||||
animOut.setAnimationListener(object : Animation.AnimationListener {
|
||||
@@ -197,17 +179,14 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
LogUtils.d(" ComboView viewOut -- onAnimationEnd ")
|
||||
rootView.post(runnable)
|
||||
post(runnable)
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation?) {
|
||||
}
|
||||
})
|
||||
comboView.startAnimation(animOut)
|
||||
LogUtils.d(" ComboView viewOut -- animOut ")
|
||||
}
|
||||
LogUtils.d(" ComboView viewOut --end")
|
||||
}
|
||||
|
||||
|
||||
@@ -216,36 +195,24 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
*/
|
||||
private fun viewAnimationIn(view: View) {
|
||||
view.alpha = 1f
|
||||
view.startAnimation(AnimationUtils.loadAnimation(context,if (UiUtils.isRtl(context)) R.anim.left_to_right else R.anim.right_to_left ))
|
||||
val animIn = AnimationUtils.loadAnimation(context,if (UiUtils.isRtl(context)) R.anim.left_to_right else R.anim.right_to_left )
|
||||
// animIn.fillAfter = true
|
||||
// animIn.isFillEnabled = true
|
||||
view.startAnimation(animIn)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if(isInEditMode) return
|
||||
|
||||
// RoomMsgManager.addCustomMsgListener(this)
|
||||
}
|
||||
|
||||
// override fun onRoomCustomMsg(attach: BaseAttach<*>) {
|
||||
// if(attach is NormalGiftAttach){
|
||||
// val receiveInfo = attach.data ?: return
|
||||
// val comboInfo = GiftComboInfo().apply {
|
||||
// senderUid = receiveInfo.uid
|
||||
// senderName = receiveInfo.nick
|
||||
// senderAvatar = receiveInfo.avatar
|
||||
// receiverName = receiveInfo.targetNicks?.getOrNull(0)
|
||||
// receiverCount = receiveInfo.receiverCount
|
||||
// giftCount = receiveInfo.giftComboCount
|
||||
// giftUrl = receiveInfo.gift?.giftUrl
|
||||
// }
|
||||
// add(comboInfo)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
fun onRoomCustomMsg(giftInfo: GiftMultiReceiverInfo?) {
|
||||
LogUtils.d(" GiftComboLayout onRoomCustomMsg " )
|
||||
if (giftInfo==null) return
|
||||
if (giftInfo.comboCount == 0) return
|
||||
val comboInfo = GiftComboInfo().apply {
|
||||
giftId = giftInfo.giftId
|
||||
sentUserid = giftInfo.uid
|
||||
@@ -258,8 +225,6 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
comboCount = giftInfo.comboCount
|
||||
isMulti = giftInfo.isMulti
|
||||
}
|
||||
LogUtils.d("礼物联机条幅 giftInfo = "+JSON.toJSONString(giftInfo))
|
||||
LogUtils.d("礼物联机条幅 comboInfo = "+JSON.toJSONString(comboInfo))
|
||||
add(comboInfo)
|
||||
}
|
||||
|
||||
@@ -278,7 +243,7 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private inner class ViewHolder(view: View) {
|
||||
var tvNumber: TextView = view.findViewById(R.id.giftComboNumber)
|
||||
var tvNumber: AppCompatTextView = view.findViewById(R.id.giftComboNumber)
|
||||
var ivGift: ImageView = view.findViewById(R.id.giftImg)
|
||||
var tvNick: TextView = view.findViewById(R.id.sentUserName)
|
||||
var tvReceiverNick: TextView = view.findViewById(R.id.receiverUserName)
|
||||
@@ -301,13 +266,12 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
tvReceiverNick.text = giftComboInfo.receiverUserName
|
||||
} else {
|
||||
if (giftComboInfo.isMulti) {
|
||||
tvReceiverNick.text =
|
||||
"${giftComboInfo.receiverNumber}" + ResUtil.getString(R.string.guys)
|
||||
tvReceiverNick.text = ResUtil.getString(R.string.Multiplayer)
|
||||
} else {
|
||||
tvReceiverNick.text = ResUtil.getString(R.string.All_mic)
|
||||
}
|
||||
}
|
||||
tvNumber.text = "x${giftComboInfo.giftNumber * giftComboInfo.receiverNumber * giftComboInfo.comboCount}"
|
||||
// tvNumber.text = "x${giftComboInfo.giftNumber * giftComboInfo.receiverNumber * giftComboInfo.comboCount}"
|
||||
ImageLoadUtils.loadImage(ivGift, giftComboInfo.giftImgUrl)
|
||||
ImageLoadUtils.loadImage(ivAvatar, giftComboInfo.sentAvatar)
|
||||
ivAvatar.tag = giftComboInfo
|
||||
@@ -332,14 +296,18 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
tvNumber.tag = num
|
||||
tvNumber.text = "x$num"
|
||||
if (isAnim) {
|
||||
LogUtils.d(" ComboView refreshNum -- isAnim ")
|
||||
tvNumber.animate().cancel()
|
||||
tvNumber.scaleX = 1.3f
|
||||
tvNumber.scaleY = 1.3f
|
||||
tvNumber.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.start()
|
||||
tvNumber.requestLayout()
|
||||
post {
|
||||
val scaleUp: ObjectAnimator = ObjectAnimator.ofPropertyValuesHolder(
|
||||
tvNumber,
|
||||
PropertyValuesHolder.ofFloat(SCALE_X, 1f, 1.3f, 1f),
|
||||
PropertyValuesHolder.ofFloat(SCALE_Y, 1f, 1.3f, 1f)
|
||||
)
|
||||
scaleUp.setDuration(100)
|
||||
scaleUp.start()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,6 +318,8 @@ class GiftComboLayout @JvmOverloads constructor(
|
||||
fun clear() {
|
||||
LogUtils.d(" ComboView clear -- clear ")
|
||||
tvNumber.animate().cancel()
|
||||
tvNumber.scaleX = 1f
|
||||
tvNumber.scaleY = 1f
|
||||
tvNumber.tag = 0
|
||||
ivAvatar.tag = null
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:duration="200"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0" />
|
||||
</set>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:duration="100"
|
||||
android:fromXDelta="-100%p"
|
||||
android:toXDelta="0"/>
|
||||
</set>
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:duration="100"
|
||||
android:fromXDelta="100%p"
|
||||
android:toXDelta="0"/>
|
||||
</set>
|
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -84,7 +84,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/barrier"/>
|
||||
|
||||
<TextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/giftComboNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -90,7 +90,7 @@
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:src="@drawable/ic_gift_diamond"
|
||||
android:src="@drawable/ic_coin_32"
|
||||
android:visibility="@{item.isFreeGift ? View.GONE : View.VISIBLE}" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@@ -5354,4 +5354,6 @@
|
||||
<string name="vip_center_8">لم يتم الحصول على VIP</string>
|
||||
<string name="vip_center_9">VIP %s فقط من خلال النشاط</string>
|
||||
<string name="All_mic">جميع الميكروفونات</string>
|
||||
<string name="changeRoomTips">هل أنت متأكد أنك تريد الذهاب إلى هذه الغرفة؟</string>
|
||||
<string name="Multiplayer">متعدد اللاعبين</string>
|
||||
</resources>
|
@@ -5295,5 +5295,7 @@
|
||||
<string name="vip_center_8">未取得 VIP</string>
|
||||
<string name="vip_center_9">VIP %s 僅透過活動獲得</string>
|
||||
<string name="All_mic">所有麥</string>
|
||||
<string name="changeRoomTips">你確定要去這個房間嗎?</string>
|
||||
<string name="Multiplayer">多人</string>
|
||||
|
||||
</resources>
|
@@ -5335,10 +5335,8 @@ You cannot join again within 24 hours after leaving</string>
|
||||
<string name="vip_center_9">VIP %s is only through activity</string>
|
||||
|
||||
<string name="All_mic">All mic</string>
|
||||
|
||||
<string name="guys">guys</string>
|
||||
<string name="All_room">All room</string>
|
||||
<string name="changeRoomTips">您确定要跳转房间吗?</string>
|
||||
<string name="Multiplayer">Multiplayer</string>
|
||||
<string name="changeRoomTips">Are you sure you want to go to this room?</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@@ -125,7 +125,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
private void addGiftMessage(CustomAttachment attachment) {
|
||||
giftQueue.add(attachment);
|
||||
if (giftQueue.size() == 1) {
|
||||
handler.sendEmptyMessageDelayed(0, 200);
|
||||
handler.sendEmptyMessageDelayed(0, 50);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user