feat:完成飘窗优先级控制
This commit is contained in:
@@ -668,6 +668,13 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
*/
|
||||
private void showRoomFragment(boolean isRoomMin) {
|
||||
mCurrentFragment = (HomePartyFragment) mAdapter.getItem(1);
|
||||
mCurrentFragment.getPlayNotifyState().observe(getLifecycleOwner(), aBoolean -> {
|
||||
if (!aBoolean) {
|
||||
if (isValid()) {
|
||||
showGiftDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
tryEnabledViewPagerInput();
|
||||
viewpager.setCurrentItem(1, false);
|
||||
if (isRoomMin) {
|
||||
@@ -1201,17 +1208,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
return;
|
||||
giftList.add(data);
|
||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
giftDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showGiftDialog();
|
||||
if (mCurrentFragment != null && mCurrentFragment.isShowingPlayNotify()) {
|
||||
return;
|
||||
}
|
||||
showGiftDialog();
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
@@ -1308,10 +1308,23 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowingGiftNotify() {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void showGiftDialog() {
|
||||
if (!isValid()) return;
|
||||
if (giftList == null) return;
|
||||
if (giftList.size() == 0) return;
|
||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||
if (data == null) return;
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
giftDialog = generateAllServiceGiftDialog(this, data);
|
||||
giftDialog.setOnDismissListener(dialog -> {
|
||||
giftList.pollFirst();
|
||||
|
@@ -18,6 +18,8 @@ import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
@@ -114,6 +116,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
private String FOLLOW_ROOM_TYPE = "";
|
||||
private SelectGameAdapter gameAdapter;
|
||||
|
||||
public final MutableLiveData<Boolean> playNotifyStateLiveData = new MutableLiveData<Boolean>(false);
|
||||
|
||||
public static HomePartyFragment newInstance() {
|
||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||
@@ -214,10 +217,11 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
gameMainBinding.llRoomInfo.setOnClickListener(this);
|
||||
gameMainBinding.ivBack.setOnClickListener(this);
|
||||
|
||||
mRoomEffectView.setPlayNotifyStateListener(playNotifyStateLiveData);
|
||||
mRoomEffectView.setOnPlayAnimCallback(new Function0<Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke() {
|
||||
return getIsAnim();
|
||||
return isShowingGiftNotify();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -360,18 +364,22 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean getIsAnim() {
|
||||
if (giftView != null) {
|
||||
return giftView.getIsPlayAnim();
|
||||
private boolean isShowingGiftNotify() {
|
||||
if ((getActivity() instanceof AVRoomActivity)) {
|
||||
return ((AVRoomActivity) getActivity()).isShowingGiftNotify();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取玩法飘屏是否展示
|
||||
*/
|
||||
private boolean getIsPlayAnim() {
|
||||
return mRoomEffectView.getIsPlayAnim();
|
||||
public LiveData<Boolean> getPlayNotifyState(){
|
||||
return playNotifyStateLiveData;
|
||||
}
|
||||
|
||||
public boolean isShowingPlayNotify(){
|
||||
if(playNotifyStateLiveData.getValue()==null) {
|
||||
return false;
|
||||
}
|
||||
return playNotifyStateLiveData.getValue();
|
||||
}
|
||||
|
||||
private void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
|
||||
|
@@ -19,8 +19,12 @@ import android.view.animation.AnimationUtils
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.chuhai.utils.UiUtils
|
||||
import com.chuhai.utils.ktx.setPadding2
|
||||
import com.coorchice.library.SuperTextView
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
@@ -31,6 +35,7 @@ import com.yizhuan.erban.R
|
||||
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.base.TitleBar
|
||||
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
|
||||
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
@@ -40,7 +45,6 @@ import com.yizhuan.erban.ui.utils.loadAnim
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
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
|
||||
@@ -134,14 +138,22 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
private val drawGiftPlayHelper: DrawGiftPlayHelper by lazy { DrawGiftPlayHelper(context as Activity) }
|
||||
|
||||
private var isPlayAnim = false
|
||||
private var playNotifyStateLiveData: MutableLiveData<Boolean>? = null
|
||||
|
||||
private var onPlayAnimCallback: (() -> Boolean)? = null
|
||||
fun setPlayNotifyStateListener(stateLiveData: MutableLiveData<Boolean>) {
|
||||
this.playNotifyStateLiveData = stateLiveData
|
||||
}
|
||||
|
||||
fun setOnPlayAnimCallback(onPlayAnimCallback: (() -> Boolean)) {
|
||||
this.onPlayAnimCallback = onPlayAnimCallback
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private fun isShowingGiftNotify(): Boolean {
|
||||
return onPlayAnimCallback?.invoke() ?: false
|
||||
}
|
||||
|
||||
private fun loopCarAnim() {
|
||||
if (context.isDestroyed()) return
|
||||
isSvgaPlaying = false
|
||||
@@ -265,6 +277,11 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
loopCarAnim()
|
||||
}
|
||||
})
|
||||
var statusBarHeight = TitleBar.getStatusBarHeight()
|
||||
if (statusBarHeight == 0) {
|
||||
statusBarHeight = UiUtils.dip2px(25f)
|
||||
}
|
||||
binding.clNotify.setPadding2(top = binding.clNotify.paddingTop + statusBarHeight)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,29 +305,12 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
if (binding.flLuckyBagNotify.childCount != 0) {
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
when (messagesPlay[0].event) {
|
||||
RoomEvent.BOX_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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showBoxNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -319,50 +319,16 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
RoomEvent.BOX_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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showTarotNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -371,25 +337,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showTarotNotifyBySVGA(messagesPlay.removeAt(0))
|
||||
}
|
||||
}
|
||||
@@ -398,17 +347,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
if (!(mContext as AVRoomActivity).isTopActivity) {
|
||||
return@subscribe
|
||||
}
|
||||
|
||||
isPlayAnim = true
|
||||
val isPlay = onPlayAnimCallback?.invoke() ?: false
|
||||
margin(
|
||||
binding.clNotify,
|
||||
0,
|
||||
UIUtil.dip2px(context, if (isPlay) 180.0 else 60.0),
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
val msg = messagesPlay.removeAt(0)
|
||||
val attachment = msg.chatRoomMessage.attachment as NotifyH5Attachment
|
||||
val bean = attachment.bean ?: return@subscribe
|
||||
@@ -421,39 +361,24 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> {//福袋
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckyBagNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {//星级厨房
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckySeaNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {//星级厨房
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showLuckySeaNotifyBySVGA(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -464,13 +389,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
RoomEvent.FAIRY_CONVERT_L2,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {//夺宝
|
||||
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)
|
||||
}
|
||||
playNotifyStateLiveData?.value = true
|
||||
resetPlayNotifyMargin()
|
||||
showFairyNotify(
|
||||
messagesPlay.removeAt(0)
|
||||
)
|
||||
@@ -497,8 +417,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
@@ -524,8 +444,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -644,6 +564,19 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
) + "…"
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置玩法飘窗间距
|
||||
*/
|
||||
private fun resetPlayNotifyMargin() {
|
||||
var top = 0
|
||||
if (isShowingGiftNotify()) {
|
||||
// 有礼物飘窗展示时,需要在它下面展示
|
||||
// 间距 = 礼物飘窗高度(375:69) + 10DP间距
|
||||
top = (width / 375f * 69).toInt() + UiUtils.dip2px(10f)
|
||||
}
|
||||
margin(binding.clNotify, 0, top, 0, 0)
|
||||
}
|
||||
|
||||
private fun margin(v: View, l: Int, t: Int, r: Int, b: Int) {
|
||||
if (v.layoutParams is MarginLayoutParams) {
|
||||
val params = v.layoutParams as MarginLayoutParams
|
||||
@@ -713,8 +646,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flLuckyBagNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flLuckyBagNotify.removeView(roomView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -760,8 +693,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
textView.startAnimation(animationPlay)
|
||||
binding.flPlayNotify.postDelayed(
|
||||
{
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
},
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
@@ -808,8 +741,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -853,7 +786,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
|
||||
private fun showNotifyH5(data: NotifyH5Info) {
|
||||
val textView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_notify_h5, null) as TextView
|
||||
.inflate(R.layout.layout_notify_h5, null) as TextView
|
||||
textView.text = data.content
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flPlayNotify.addView(textView)
|
||||
@@ -866,8 +799,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -881,8 +814,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -942,8 +875,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -985,8 +918,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
binding.flPlayNotify.postDelayed({
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(textView)
|
||||
isPlayAnim = false
|
||||
}, CLOSE_TIME.toLong())
|
||||
}
|
||||
|
||||
@@ -1008,8 +941,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flPlayNotify.post {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1080,8 +1013,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
animationPlay = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify_close)
|
||||
animationPlay!!.setAnimationListener(object : SimpleAnimationListener() {
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
playNotifyStateLiveData?.value = false
|
||||
binding.flPlayNotify.removeView(svgaImageView)
|
||||
isPlayAnim = false
|
||||
}
|
||||
})
|
||||
binding.flPlayNotify.startAnimation(animationPlay)
|
||||
@@ -1936,10 +1869,6 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}, SHOW_TIME.toLong())
|
||||
}
|
||||
|
||||
fun getIsPlayAnim(): Boolean {
|
||||
return isPlayAnim
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
playDisposable?.dispose()
|
||||
@@ -1953,7 +1882,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
disposableRoomPK?.dispose()
|
||||
disposableSingleRoomPK?.dispose()
|
||||
disposableGiftCompound?.dispose()
|
||||
isPlayAnim = false
|
||||
playNotifyStateLiveData?.value = false
|
||||
}
|
||||
|
||||
}
|
@@ -992,17 +992,10 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
if (data == null || data.getGiftUrl() == null) return;
|
||||
giftList.add(data);
|
||||
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
AllServiceGiftProtocol.DataBean dataBean = giftList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
giftDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showGiftDialog();
|
||||
if (isShowingPlayNotify()) {
|
||||
return;
|
||||
}
|
||||
showGiftDialog();
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
@@ -1187,8 +1180,11 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
|
||||
private void showPlayEffectDialog() {
|
||||
if (playEffectList.size() == 0) return;
|
||||
playEffectDialog = new AllPlayEffectDialog(this, playEffectList.peekFirst());
|
||||
PlayEffectInfo info = playEffectList.peekFirst();
|
||||
if (info == null) return;
|
||||
playEffectDialog = new AllPlayEffectDialog(this, info, isShowingGiftNotify());
|
||||
playEffectDialog.setOnDismissListener(dialog -> {
|
||||
tryShowGiftDialog();
|
||||
playEffectList.pollFirst();
|
||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
@@ -1206,12 +1202,20 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void tryShowGiftDialog() {
|
||||
showGiftDialog();
|
||||
}
|
||||
|
||||
private void showGiftDialog() {
|
||||
if (giftList == null) return;
|
||||
if (giftList.size() == 0) return;
|
||||
AllServiceGiftProtocol.DataBean data = giftList.peekFirst();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
if (!data.isHomeShow()) {
|
||||
return;
|
||||
}
|
||||
@@ -1234,6 +1238,20 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isShowingGiftNotify() {
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isShowingPlayNotify() {
|
||||
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private AllServiceGiftLevelDialog generateAllServiceGiftDialog(@NonNull Context context, @NonNull AllServiceGiftProtocol.DataBean dataBean) {
|
||||
return new AllServiceGiftLevelDialog(context, dataBean);
|
||||
}
|
||||
|
@@ -66,10 +66,12 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
private DialogAllPlayEffectBinding binding;
|
||||
|
||||
private CompositeDisposable disposable = null;
|
||||
private boolean belowGiftNotify;
|
||||
|
||||
public AllPlayEffectDialog(Context context, @NonNull PlayEffectInfo playEffectInfo) {
|
||||
public AllPlayEffectDialog(Context context, @NonNull PlayEffectInfo playEffectInfo, boolean belowGiftNotify) {
|
||||
super(context, R.style.FullScreenDialog);
|
||||
this.playEffectInfo = playEffectInfo;
|
||||
this.belowGiftNotify = belowGiftNotify;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,6 +96,9 @@ public class AllPlayEffectDialog extends BaseDialog {
|
||||
window.setAttributes(windowParams);
|
||||
window.setWindowAnimations(R.style.anim_left);
|
||||
}
|
||||
if (belowGiftNotify) {
|
||||
binding.vGiftNotifyPlaceholder.setVisibility(View.VISIBLE);
|
||||
}
|
||||
switch (playEffectInfo.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
|
||||
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
|
||||
|
@@ -3,16 +3,27 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/cl_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<!--这个只是占位用:两种飘窗共存情况下,玩法飘窗需要在礼物飘窗下面-->
|
||||
<View
|
||||
android:id="@+id/v_gift_notify_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintDimensionRatio="h,375:69"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_svga_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintDimensionRatio="75:11"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/v_gift_notify_placeholder"
|
||||
app:layout_goneMarginTop="0dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -13,13 +13,13 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:background="@drawable/all_service_gift_bg_1"
|
||||
app:layout_constraintDimensionRatio="h,375:69"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
@@ -42,7 +42,7 @@
|
||||
android:id="@+id/cl_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="60dp"
|
||||
android:paddingTop="20dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<FrameLayout
|
||||
@@ -56,7 +56,7 @@
|
||||
android:id="@+id/fl_lucky_bag_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintDimensionRatio="375:71" />
|
||||
|
||||
<FrameLayout
|
||||
|
Reference in New Issue
Block a user