From bf805afdb5d9afdf0b0d7b42c7e5dce5ac32df48 Mon Sep 17 00:00:00 2001 From: wushaocheng <15876365887@163.com> Date: Tue, 11 Jul 2023 16:51:38 +0800 Subject: [PATCH] =?UTF-8?q?[Modify]=E6=88=BF=E9=97=B4=E5=85=AC=E5=B1=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erban/avroom/activity/AVRoomActivity.java | 4 + .../avroom/fragment/HomePartyFragment.java | 2 + .../erban/avroom/widget/GiftEffectView.java | 13 +- .../erban/avroom/widget/GiftV2View.java | 125 +----------------- .../erban/avroom/widget/RoomEffectBoxView.kt | 56 ++++---- .../erban/avroom/widget/RoomEffectView.kt | 93 +++++++------ .../erban/ui/widget/GiftAvatarAdapter.java | 20 ++- .../yizhuan/erban/ui/widget/GiftDialog.java | 26 +--- .../main/res/layout/layout_gift_effect.xml | 62 ++++----- .../layout/layout_single_room_rank_notify.xml | 8 +- .../gift/bean/GiftEffectInfo.java | 1 + .../manager/AvRoomDataManager.java | 4 - .../room/giftvalue/bean/IndexGiftValue.java | 2 - 13 files changed, 144 insertions(+), 272 deletions(-) diff --git a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java index 63da54f0d..b78f7a623 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java @@ -1227,6 +1227,10 @@ public class AVRoomActivity extends BaseMvpActivity { giftList.pollFirst(); diff --git a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java index aae71ea53..107aa47b0 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/fragment/HomePartyFragment.java @@ -62,8 +62,10 @@ import com.yizhuan.xchat_android_core.share.ShareModel; import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil; import com.yizhuan.xchat_android_core.user.UserModel; import com.yizhuan.xchat_android_core.user.bean.UserInfo; +import com.yizhuan.xchat_android_core.utils.LogUtils; import com.yizhuan.xchat_android_core.utils.Logger; import com.yizhuan.xchat_android_library.utils.JavaUtil; +import com.yizhuan.xchat_android_library.utils.LogUtil; import com.yizhuan.xchat_android_library.utils.ResUtil; import com.yizhuan.xchat_android_library.utils.SingleToastUtil; diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftEffectView.java b/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftEffectView.java index 8e448d775..43782773f 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftEffectView.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftEffectView.java @@ -74,7 +74,6 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback { private boolean isAnim; private boolean isHideCarEffect; - public GiftEffectView(Context context) { super(context); init(); @@ -164,11 +163,11 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback { final Point center = new Point(); center.x = ResolutionUtils.getScreenWidth(getContext()) / 2; - ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", -UIUtil.dip2px(getContext(), 400), center.x - container.getWidth() / 2).setDuration(500); + ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", -UIUtil.dip2px(getContext(), 400), center.x - container.getWidth() / 2).setDuration(1250); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.start(); - ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 0.0F, 1.0F).setDuration(500); + ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 0.0F, 1.0F).setDuration(1250); objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator1.start(); if (totalCoin < 4999) { @@ -179,7 +178,7 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback { imgBg.setImageResource(R.drawable.icon_gift_effect_bg_3); } } - effectHandler.sendEmptyMessageDelayed(0, 6000); + effectHandler.sendEmptyMessageDelayed(0, 4000); if (giftInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(giftInfo.getViewUrl())) { drawVAPEffect(giftInfo.getViewUrl()); } else if (giftInfo.isHasVggPic() && !StringUtil.isEmpty(giftInfo.getVggUrl())) { @@ -209,7 +208,7 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback { svgaImageView.setImageDrawable(drawable); svgaImageView.startAnimation(); svgaBg.setVisibility(VISIBLE); - ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(svgaBg, "alpha", 0.0F, 2.0F).setDuration(800); + ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(svgaBg, "alpha", 0.0F, 2.0F).setDuration(1250); objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator1.start(); } @@ -230,11 +229,11 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback { } private void deleteAnim() { - ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", container.getX(), ResolutionUtils.getScreenWidth(getContext())).setDuration(500); + ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", container.getX(), ResolutionUtils.getScreenWidth(getContext())).setDuration(1250); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.start(); - ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 1.0F, 0.0F).setDuration(500); + ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(container, "alpha", 1.0F, 0.0F).setDuration(1250); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftV2View.java b/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftV2View.java index 74c468f06..8733114f2 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftV2View.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/GiftV2View.java @@ -9,9 +9,7 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.content.Context; import android.graphics.Path; -import android.graphics.PathMeasure; import android.graphics.Point; -import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.TextUtils; @@ -36,7 +34,6 @@ import com.yizhuan.erban.R; import com.yizhuan.erban.common.svga.SimpleSvgaParseCompletion; import com.yizhuan.erban.ui.utils.ImageLoadUtils; import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil; -import com.yizhuan.xchat_android_core.auth.AuthModel; import com.yizhuan.xchat_android_core.fansteam.FansTeamMsgInfo; import com.yizhuan.xchat_android_core.gift.GiftModel; import com.yizhuan.xchat_android_core.gift.bean.GiftEffectInfo; @@ -53,9 +50,6 @@ import com.yizhuan.xchat_android_core.magic.bean.MagicInfo; import com.yizhuan.xchat_android_core.magic.bean.MagicReceivedInfo; import com.yizhuan.xchat_android_core.magic.bean.MultiMagicReceivedInfo; import com.yizhuan.xchat_android_core.manager.AvRoomDataManager; -import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; -import com.yizhuan.xchat_android_core.manager.RoomEvent; -import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterAttackInfo; import com.yizhuan.xchat_android_core.room.bean.RoomInfo; import com.yizhuan.xchat_android_library.utils.ResUtil; import com.yizhuan.xchat_android_library.utils.ResolutionUtils; @@ -65,9 +59,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; -import java.util.Hashtable; import java.util.List; -import java.util.Objects; import java.util.Random; import javax.annotation.Nullable; @@ -98,8 +90,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect private Keyframe[] keyScale; private Keyframe[] keyTrans; private SvgaObjectPool mMagicViewPool; - private volatile Hashtable currentAnimationMap = new Hashtable<>(); - public GiftV2View(Context context) { this(context, null); @@ -435,11 +425,8 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect } public void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) { - - if (giftMultiReceiverInfo != null) { setVisibility(VISIBLE); -// List giftReceiveInfos = new ArrayList<>(); GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo(); giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid()); giftReceiveInfo.setTargetNick(giftMultiReceiverInfo.getUser().getNick()); @@ -452,7 +439,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect //礼物值 giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos()); giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime()); -// giftReceiveInfos.add(giftReceiveInfo); drawLuckyGift(giftReceiveInfo, GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY, giftMultiReceiverInfo.isShowAnimation(), giftMultiReceiverInfo.getLuckyGiftSvgaUrl()); } } @@ -471,13 +457,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect return magicInfo.getPathAnim(); } -// private boolean isCenter(MonsterAttackReceiveInfo monsterAttackReceiveInfo) { -// int magicId = Integer.parseInt(monsterAttackReceiveInfo.getMagicId()); -// MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicId); -// if (magicInfo == null) return monsterAttackReceiveInfo.getPosition() == MagicInfo.POS_CENTER; -// return magicInfo.getPosition() == MagicInfo.POS_CENTER; -// } - private String getValidExplodeAnimationUrl(int magicId, String url) { if (!TextUtils.isEmpty(url)) return url; MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicId); @@ -497,13 +476,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect drawMagicAnimation(magicReceivedInfos); } - public void onReceiveMonsterAttackMsg(MonsterAttackInfo monsterAttackReceiveInfo, View monsterView) { - drawMonsterMagicView(monsterAttackReceiveInfo, monsterView); -// List monsterAttackReceiveInfos = new ArrayList<>(); -// monsterAttackReceiveInfos.add(monsterAttackReceiveInfo); -// drawMonsterAttackAnimation(monsterAttackReceiveInfos, monsterView); - } - public void onReceiveMultiMagicMsg(MultiMagicReceivedInfo multiMagicReceivedInfo) { if (multiMagicReceivedInfo != null) { setVisibility(VISIBLE); @@ -575,73 +547,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect } } - /** - * 打怪兽时使用的动画效果 - * - * @param monsterAttackReceiveInfo - * @param monsterView - */ - private void drawMonsterMagicView(MonsterAttackInfo monsterAttackReceiveInfo, View monsterView) { - Point senderPoint = null; - if (Objects.equals(Long.valueOf(monsterAttackReceiveInfo.getUid()), AuthModel.get().getCurrentUid())) { - senderPoint = new Point(mScreenWidth - giftWidth, mScreenHeight - UIUtil.dip2px(context, 50)); - } else { - senderPoint = new Point(new Random().nextInt(mScreenWidth), mScreenHeight); - } - SVGAImageView imageView = mMagicViewPool.borrowGiftObject(senderPoint); - imageView.setVisibility(GONE); - ImageLoadUtils.loadImage(context, monsterAttackReceiveInfo.getMagicIcon(), imageView); - int[] location = new int[2]; - monsterView.getLocationInWindow(location); - int x = (location[0] + monsterView.getWidth() / 2) - giftWidth / 2; - int y = (location[1] + monsterView.getHeight() / 2) - giftHeight / 2; - Point receivePoint = new Point(x, y); - - Path path = getBezierCurvePath(senderPoint, receivePoint, false); - ValueAnimator pathAnimator; - // 当前版本小于21,需要 - if (Build.VERSION_CODES.LOLLIPOP > Build.VERSION.SDK_INT) { - pathAnimator = ObjectAnimator.ofFloat(0.0f, 1.0f); - pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - float[] point = new float[2]; - - @Override - public void onAnimationUpdate(ValueAnimator animation) { - float val = animation.getAnimatedFraction(); - PathMeasure pathMeasure = new PathMeasure(path, false); - pathMeasure.getPosTan(pathMeasure.getLength() * val, point, null); - imageView.setTranslationX(point[0]); - imageView.setTranslationY(point[1]); - } - }); - } else { - pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path); - } - pathAnimator.addListener(new AnimatorListenerAdapter() { - - @Override - public void onAnimationStart(Animator animation) { - imageView.setVisibility(VISIBLE); - } - - @Override - public void onAnimationEnd(Animator animation) { - mMagicViewPool.returnObject(imageView); - currentAnimationMap.remove(monsterAttackReceiveInfo.getSequence()); - IMNetEaseManager.get().getChatRoomEventObservable().onNext(new RoomEvent() - .setEvent(RoomEvent.MONSTER_HUNTING_ANIMATION_FINISHED) - .setMonsterAttackReceiveInfo(monsterAttackReceiveInfo)); - } - }); - pathAnimator.setDuration(1000); - currentAnimationMap.put(monsterAttackReceiveInfo.getSequence(), monsterAttackReceiveInfo); - if (currentAnimationMap.size() >= 10) { - postDelayed(pathAnimator::start, 500); - } else { - pathAnimator.start(); - } - } - private void drawMagicView(Point senderPoint, Point receivePoint, MagicReceivedInfo magicReceivedInfo) { if (!AvRoomDataManager.get().mIsNeedGiftEffect || AvRoomDataManager.get().isSelfGamePlaying()) { @@ -675,24 +580,8 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect Path path = getBezierCurvePath(senderPoint, receivePoint, isCenter(magicReceivedInfo)); ValueAnimator pathAnimator; // 当前版本小于21,需要 - if (Build.VERSION_CODES.LOLLIPOP > Build.VERSION.SDK_INT) { - pathAnimator = ObjectAnimator.ofFloat(0.0f, 1.0f); - pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - float[] point = new float[2]; - - @Override - public void onAnimationUpdate(ValueAnimator animation) { - float val = animation.getAnimatedFraction(); - PathMeasure pathMeasure = new PathMeasure(path, false); - pathMeasure.getPosTan(pathMeasure.getLength() * val, point, null); - imageView.setTranslationX(point[0]); - imageView.setTranslationY(point[1]); - } - }); - } else { - pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path); - } - pathAnimator.setDuration(1000); + pathAnimator = ObjectAnimator.ofFloat(imageView, View.TRANSLATION_X, View.TRANSLATION_Y, path); + pathAnimator.setDuration(1250); pathAnimator.start(); } @@ -754,7 +643,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect PropertyValuesHolder p2 = PropertyValuesHolder.ofKeyframe("scaleX", keyScale); PropertyValuesHolder p3 = PropertyValuesHolder.ofKeyframe("scaleY", keyScale); ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView, p2, p3, p1, p0); - objectAnimator.setDuration(3200); + objectAnimator.setDuration(4000); objectAnimator.start(); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override @@ -898,10 +787,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect if (mImageView == null) return; mImageView.stopAnimation(true); giftV2View.mMagicViewPool.returnObject(mImageView); -// ViewParent parent = this.mImageView.getParent(); -// if (parent != null && parent instanceof ViewGroup) { -// ((ViewGroup) parent).removeView(mImageView); -// } } @Override @@ -911,10 +796,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect if (mImageView == null) return; mImageView.stopAnimation(true); giftV2View.mMagicViewPool.returnObject(mImageView); -// ViewParent parent = this.mImageView.getParent(); -// if (parent != null && parent instanceof ViewGroup) { -// ((ViewGroup) parent).removeViewInLayout(mImageView); -// } } @Override diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectBoxView.kt b/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectBoxView.kt index 0cc7f37d3..5773c8937 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectBoxView.kt +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectBoxView.kt @@ -72,7 +72,7 @@ class RoomEffectBoxView @JvmOverloads constructor( private val mCarEffectList: MutableList by lazy { ArrayList() } //頂部飄屏總展示時間 - private val SHOW_TIME = 3500 + private val SHOW_TIME = 4000 //頂部飄屏周期 private val PERIOD = 1000 @@ -227,9 +227,11 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesDatingAll.size > 0 } .subscribe { - showDatingAllNotify( - messagesDatingAll.removeAt(0) - ) + if (binding.flDatingAllNotify.childCount == 0) { + showDatingAllNotify( + messagesDatingAll.removeAt(0) + ) + } } } } @@ -307,9 +309,11 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLuckyGift.size > 0 } .subscribe { - showLuckyBagNotify( - messagesLuckyGift.removeAt(0) - ) + if (binding.flLuckyGiftNotify.childCount == 0) { + showLuckyBagNotify( + messagesLuckyGift.removeAt(0) + ) + } } } } @@ -416,9 +420,11 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesBox.size > 0 } .subscribe { + if (binding.flBoxNotify.childCount == 0) { showBoxNotify( messagesBox.removeAt(0) ) + } } } } @@ -473,9 +479,11 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesBoxSVGA.size > 0 } .subscribe { + if (binding.flSvgaBoxNotify.childCount == 0) { showBoxNotifyBySVGA( messagesBoxSVGA.removeAt(0) ) + } } } } @@ -557,7 +565,9 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRadish.size > 0 } .subscribe { - showRadishNotify(messagesRadish.removeAt(0)) + if (binding.flRadishNotify.childCount == 0) { + showRadishNotify(messagesRadish.removeAt(0)) + } } } } @@ -635,7 +645,9 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRadishSVGA.size > 0 } .subscribe { - showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0)) + if (binding.flSvgaRadishNotify.childCount == 0) { + showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0)) + } } } } @@ -721,9 +733,9 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesGiftCompound.size > 0 } .subscribe { - showGiftCompoundNotify( - messagesGiftCompound.removeAt(0) - ) + if (binding.flGiftCompoundNotify.childCount == 0) { + showGiftCompoundNotify(messagesGiftCompound.removeAt(0)) + } } } } @@ -797,9 +809,7 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesMemberIn.size > 0 } .subscribe { - showMemberInNotify( - messagesMemberIn.removeAt(0) - ) + showMemberInNotify(messagesMemberIn.removeAt(0)) } } } @@ -931,9 +941,7 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLevelUp.size > 0 } .subscribe { - showLevelUpNotify( - messagesLevelUp.removeAt(0) - ) + showLevelUpNotify(messagesLevelUp.removeAt(0)) } } } @@ -1232,9 +1240,9 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRoomPK.size > 0 } .subscribe { - showRoomPKNotify( - messagesRoomPK.removeAt(0) - ) + if(binding.flRoomPkNotify.childCount == 0) { + showRoomPKNotify(messagesRoomPK.removeAt(0)) + } } } } @@ -1278,9 +1286,9 @@ class RoomEffectBoxView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesSingleRoomPK.size > 0 } .subscribe { - showSingleRoomPKNotify( - messagesSingleRoomPK.removeAt(0) - ) + if(binding.flSingleRoomPkNotify.childCount == 0) { + showSingleRoomPKNotify(messagesSingleRoomPK.removeAt(0)) + } } } } diff --git a/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectView.kt b/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectView.kt index 42238aa16..a39b89e67 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectView.kt +++ b/app/src/main/java/com/yizhuan/erban/avroom/widget/RoomEffectView.kt @@ -51,6 +51,7 @@ import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil import com.yizhuan.xchat_android_core.user.UserModel import com.yizhuan.xchat_android_core.user.bean.UserInfo +import com.yizhuan.xchat_android_core.utils.Logger import com.yizhuan.xchat_android_core.utils.subAndReplaceDot import com.yizhuan.xchat_android_library.utils.ListUtils import com.yizhuan.xchat_android_library.utils.ResUtil @@ -75,7 +76,7 @@ class RoomEffectView @JvmOverloads constructor( private val mCarEffectList: MutableList by lazy { ArrayList() } //頂部飄屏總展示時間 - private val SHOW_TIME = 3500 + private val SHOW_TIME = 4000 //頂部飄屏周期 private val PERIOD = 1000 @@ -263,9 +264,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { fairyMessages.size > 0 } .subscribe { - showFairyNotify( - fairyMessages.removeAt(0) - ) + if (binding.flFairyNotify.childCount == 0) { + showFairyNotify( + fairyMessages.removeAt(0) + ) + } } } } @@ -362,9 +365,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesDatingAll.size > 0 } .subscribe { - showDatingAllNotify( - messagesDatingAll.removeAt(0) - ) + if (binding.flDatingAllNotify.childCount == 0) { + showDatingAllNotify( + messagesDatingAll.removeAt(0) + ) + } } } } @@ -442,9 +447,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLuckyGift.size > 0 } .subscribe { - showLuckyBagNotify( - messagesLuckyGift.removeAt(0) - ) + if (binding.flLuckyGiftNotify.childCount == 0) { + showLuckyBagNotify( + messagesLuckyGift.removeAt(0) + ) + } } } } @@ -551,9 +558,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLuckySea.size > 0 } .subscribe { - showLuckySeaNotify( - messagesLuckySea.removeAt(0) - ) + if (binding.flLuckySeaNotify.childCount == 0) { + showLuckySeaNotify( + messagesLuckySea.removeAt(0) + ) + } } } } @@ -618,9 +627,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLuckySeaSVGA.size > 0 } .subscribe { - showLuckySeaNotifyBySVGA( - messagesLuckySeaSVGA.removeAt(0) - ) + if (binding.flSvgaLuckySeaNotify.childCount == 0) { + showLuckySeaNotifyBySVGA( + messagesLuckySeaSVGA.removeAt(0) + ) + } } } } @@ -724,9 +735,11 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesBox.size > 0 } .subscribe { - showBoxNotify( - messagesBox.removeAt(0) - ) + if (binding.flBoxNotify.childCount == 0) { + showBoxNotify( + messagesBox.removeAt(0) + ) + } } } } @@ -782,9 +795,11 @@ class RoomEffectView @JvmOverloads constructor( .takeWhile { messagesBoxSVGA.size > 0 } .subscribe { if ((mContext as AVRoomActivity).isTopActivity) { - showBoxNotifyBySVGA( - messagesBoxSVGA.removeAt(0) - ) + if (binding.flSvgaBoxNotify.childCount == 0) { + showBoxNotifyBySVGA( + messagesBoxSVGA.removeAt(0) + ) + } } } } @@ -867,7 +882,9 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRadish.size > 0 } .subscribe { - showRadishNotify(messagesRadish.removeAt(0)) + if (binding.flRadishNotify.childCount == 0) { + showRadishNotify(messagesRadish.removeAt(0)) + } } } } @@ -945,7 +962,9 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRadishSVGA.size > 0 } .subscribe { - showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0)) + if (binding.flSvgaRadishNotify.childCount == 0) { + showRadishNotifyBySVGA(messagesRadishSVGA.removeAt(0)) + } } } } @@ -1031,9 +1050,9 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesGiftCompound.size > 0 } .subscribe { - showGiftCompoundNotify( - messagesGiftCompound.removeAt(0) - ) + if (binding.flGiftCompoundNotify.childCount == 0) { + showGiftCompoundNotify(messagesGiftCompound.removeAt(0)) + } } } } @@ -1107,9 +1126,7 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesMemberIn.size > 0 } .subscribe { - showMemberInNotify( - messagesMemberIn.removeAt(0) - ) + showMemberInNotify(messagesMemberIn.removeAt(0)) } } } @@ -1241,9 +1258,7 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesLevelUp.size > 0 } .subscribe { - showLevelUpNotify( - messagesLevelUp.removeAt(0) - ) + showLevelUpNotify(messagesLevelUp.removeAt(0)) } } } @@ -1542,9 +1557,9 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesRoomPK.size > 0 } .subscribe { - showRoomPKNotify( - messagesRoomPK.removeAt(0) - ) + if(binding.flRoomPkNotify.childCount == 0) { + showRoomPKNotify(messagesRoomPK.removeAt(0)) + } } } } @@ -1588,9 +1603,9 @@ class RoomEffectView @JvmOverloads constructor( .observeOn(AndroidSchedulers.mainThread()) .takeWhile { messagesSingleRoomPK.size > 0 } .subscribe { - showSingleRoomPKNotify( - messagesSingleRoomPK.removeAt(0) - ) + if(binding.flSingleRoomPkNotify.childCount == 0) { + showSingleRoomPKNotify(messagesSingleRoomPK.removeAt(0)) + } } } } diff --git a/app/src/main/java/com/yizhuan/erban/ui/widget/GiftAvatarAdapter.java b/app/src/main/java/com/yizhuan/erban/ui/widget/GiftAvatarAdapter.java index 0225ab706..caf0ba3b3 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/widget/GiftAvatarAdapter.java +++ b/app/src/main/java/com/yizhuan/erban/ui/widget/GiftAvatarAdapter.java @@ -59,13 +59,17 @@ public class GiftAvatarAdapter extends RecyclerView.Adapter getSelectedMember() { - List selectedMembers = new ArrayList<>(); - for (MicMemberInfo micMemberInfo : micMemberInfos) { - if (micMemberInfo.isSelected()) { - selectedMembers.add(micMemberInfo); + if (selectType == SELECT_TYPE_WHOLE_MIC) { + return micMemberInfos; + } else { + List selectedMembers = new ArrayList<>(); + for (MicMemberInfo micMemberInfo : micMemberInfos) { + if (micMemberInfo.isSelected()) { + selectedMembers.add(micMemberInfo); + } } + return selectedMembers; } - return selectedMembers; } @Override @@ -103,12 +107,6 @@ public class GiftAvatarAdapter extends RecyclerView.Adapter> beanTransformVm(Context context, @@ -286,7 +279,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene TextUtils.isEmpty(mChatRoomMember.getNick()) || TextUtils.isEmpty(mChatRoomMember.getAvatar())) continue; // 排除自己 -// if (AvRoomDataManager.get().isOwner(mChatRoomMember.getAccount())) continue; + if (AvRoomDataManager.get().isOwner(mChatRoomMember.getAccount())) continue; // 设置默认人员 if (String.valueOf(account).equals(mChatRoomMember.getAccount())) { micMemberInfo.setSelected(true); @@ -324,23 +317,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene micMemberInfos.add(0, micMemberInfo); } - //如果沒上麥就添加自己 - if (micMemberInfos.size() > 0) { - MicMemberInfo micMemberInfo = new MicMemberInfo(); - UserInfo userInfo = UserModel.get().getCacheLoginUserInfo(); - if (userInfo != null && !AvRoomDataManager.get().checkIsOnMicByAccount(String.valueOf(userInfo.getUid()))) { - micMemberInfo.setInPkMode(AvRoomDataManager.get().isOpenPKMode()); - micMemberInfo.setTeamId(PkModel.get().getTeamIdInPKMemberList(String.valueOf(AvRoomDataManager.get().getRoomUid()))); - micMemberInfo.setNick(userInfo.getNick()); - micMemberInfo.setAvatar(userInfo.getAvatar()); - micMemberInfo.setMicPosition(AvRoomDataManager.POSITION_USER_NO_MIC); - micMemberInfo.setAccount(String.valueOf(userInfo.getUid())); - //添加性别信息 - micMemberInfo.setGender(userInfo.getGender()); - micMemberInfos.add(micMemberInfo); - } - } - return micMemberInfos; } diff --git a/app/src/main/res/layout/layout_gift_effect.xml b/app/src/main/res/layout/layout_gift_effect.xml index 605132c8e..c737162fe 100644 --- a/app/src/main/res/layout/layout_gift_effect.xml +++ b/app/src/main/res/layout/layout_gift_effect.xml @@ -1,26 +1,26 @@ + android:layout_height="match_parent"> + android:visibility="invisible" + tools:visibility="visible"> - - @@ -39,37 +39,36 @@ android:layout_width="40dp" android:layout_height="40dp" /> - + android:textSize="@dimen/sp_10" /> - + android:textSize="@dimen/sp_12" /> @@ -78,17 +77,16 @@ android:layout_width="40dp" android:layout_height="40dp" /> - + android:textSize="@dimen/sp_10" /> @@ -96,9 +94,9 @@ android:id="@+id/gift_light_container" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_toRightOf="@id/receiver_container"> + android:layout_toEndOf="@id/receiver_container"> - - + android:textSize="@dimen/sp_10" /> - @@ -151,8 +147,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black_transparent_50" - android:visibility="gone" - /> + android:visibility="gone" /> + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/layout_single_room_rank_notify.xml b/app/src/main/res/layout/layout_single_room_rank_notify.xml index 33204b436..874884e03 100644 --- a/app/src/main/res/layout/layout_single_room_rank_notify.xml +++ b/app/src/main/res/layout/layout_single_room_rank_notify.xml @@ -16,7 +16,7 @@ android:includeFontPadding="false" android:text="@string/layout_layout_single_room_rank_notify_01" android:textColor="@color/white" - android:textSize="13dp" /> + android:textSize="@dimen/sp_13" /> + android:textSize="13sp" /> \ No newline at end of file diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/gift/bean/GiftEffectInfo.java b/core/src/main/java/com/yizhuan/xchat_android_core/gift/bean/GiftEffectInfo.java index 503a1f887..ad0d322b4 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/gift/bean/GiftEffectInfo.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/gift/bean/GiftEffectInfo.java @@ -23,6 +23,7 @@ public class GiftEffectInfo implements Serializable { private int giftId; private int giftNum; private GiftInfo gift; + private String levelNum; private int giftReceiveType;//送礼物的类型,单人,多人,全麦 } diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/manager/AvRoomDataManager.java b/core/src/main/java/com/yizhuan/xchat_android_core/manager/AvRoomDataManager.java index 8967f5d24..1536a75b5 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/manager/AvRoomDataManager.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/manager/AvRoomDataManager.java @@ -76,10 +76,6 @@ public final class AvRoomDataManager { * 大头麦位的位置 */ public static final int POSITION_BOSS_MIC = -1; - /** - * 用戶不在麥上 - */ - public static final int POSITION_USER_NO_MIC = -2; /** * VIP麦位的位置 */ diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/room/giftvalue/bean/IndexGiftValue.java b/core/src/main/java/com/yizhuan/xchat_android_core/room/giftvalue/bean/IndexGiftValue.java index dc6d9d901..0a69a8f21 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/room/giftvalue/bean/IndexGiftValue.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/room/giftvalue/bean/IndexGiftValue.java @@ -15,6 +15,4 @@ public class IndexGiftValue implements Serializable { private long giftValue; - // - }