[Modify]房间公屏优化

This commit is contained in:
wushaocheng
2023-07-11 16:51:38 +08:00
parent a1221fa5a5
commit bf805afdb5
13 changed files with 144 additions and 272 deletions

View File

@@ -1227,6 +1227,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
private void showGiftDialog() {
if (giftList.size() == 0) return;
if (String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo != null ? AvRoomDataManager.get().mCurrentRoomInfo.getUid() : 0)
.equals(String.valueOf(giftList.peekFirst() != null ? giftList.peekFirst().getRoomUid() : 0))) {
return;
}
giftDialog = generateAllServiceGiftDialog(this, giftList.peekFirst());
giftDialog.setOnDismissListener(dialog -> {
giftList.pollFirst();

View File

@@ -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;

View File

@@ -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

View File

@@ -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<Integer, MonsterAttackInfo> 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<GiftReceiveInfo> 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<MonsterAttackInfo> 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

View File

@@ -72,7 +72,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
private val mCarEffectList: MutableList<CarInfo?> 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))
}
}
}
}

View File

@@ -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<CarInfo?> 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))
}
}
}
}

View File

@@ -59,13 +59,17 @@ public class GiftAvatarAdapter extends RecyclerView.Adapter<GiftAvatarAdapter.Vi
}
public List<MicMemberInfo> getSelectedMember() {
List<MicMemberInfo> selectedMembers = new ArrayList<>();
for (MicMemberInfo micMemberInfo : micMemberInfos) {
if (micMemberInfo.isSelected()) {
selectedMembers.add(micMemberInfo);
if (selectType == SELECT_TYPE_WHOLE_MIC) {
return micMemberInfos;
} else {
List<MicMemberInfo> 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<GiftAvatarAdapter.Vi
holder.micNumber.setText(String.valueOf(micMemberInfo.getMicPosition() + 1));
}
if(micMemberInfo.getMicPosition() == AvRoomDataManager.POSITION_USER_NO_MIC){
holder.micNumber.setVisibility(View.GONE);
}else {
holder.micNumber.setVisibility(View.VISIBLE);
}
if (micMemberInfo.isInPkMode()) {
int boardColor = context.getResources().getColor(R.color.color_FFFFFF);
int solidColor = context.getResources().getColor(R.color.appColor);

View File

@@ -106,7 +106,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
@@ -220,12 +219,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
this.isInRoom = isInRoom;
//判断用户在不在麦上
this.userOnMic = AvRoomDataManager.get().checkIsOnMicByAccount(String.valueOf(uid));
if (micMemberInfos.size() == 0 && isInRoom && OtherUid == 0) {
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (userInfo != null) {
this.uid = userInfo.getUid();
}
}
}
private List<List<GiftInfoVm>> 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;
}

View File

@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/container"
android:layout_width="375dp"
android:layout_height="164dp"
android:layout_marginTop="60dp"
tools:visibility="visible"
android:visibility="invisible">
android:visibility="invisible"
tools:visibility="visible">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_bg"
android:layout_width="376dp"
android:layout_height="164dp"
android:scaleType="center"
android:src="@drawable/icon_gift_effect_bg_1" />
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="50dp"
android:layout_height="123dp"
android:src="@drawable/icon_light_bg"
@@ -30,7 +30,7 @@
android:id="@+id/benefactor_container"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
android:gravity="center_vertical"
android:orientation="vertical">
@@ -39,37 +39,36 @@
android:layout_width="40dp"
android:layout_height="40dp" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/benefactor_nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/benefactor_avatar"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="10dp" />
android:textSize="@dimen/sp_10" />
</LinearLayout>
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/give_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="17dp"
android:layout_toRightOf="@id/benefactor_container"
android:layout_marginStart="17dp"
android:layout_toEndOf="@id/benefactor_container"
android:text="@string/layout_layout_gift_effect_01"
android:textColor="#FEFEFE"
android:textSize="12dp" />
android:textSize="@dimen/sp_12" />
<LinearLayout
android:id="@+id/receiver_container"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginLeft="17dp"
android:layout_toRightOf="@id/give_text"
android:layout_marginStart="17dp"
android:layout_toEndOf="@id/give_text"
android:gravity="center_vertical"
android:orientation="vertical">
@@ -78,17 +77,16 @@
android:layout_width="40dp"
android:layout_height="40dp" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/receiver_nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/receiver_avatar"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="10dp" />
android:textSize="@dimen/sp_10" />
</LinearLayout>
@@ -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">
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/gift_light_bg"
android:layout_width="97.5dp"
android:layout_height="97.5dp"
@@ -117,32 +115,30 @@
android:id="@+id/gift_img"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerInParent="true"
android:src="@mipmap/app_logo" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:maxLines="1"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="10dp" />
android:textSize="@dimen/sp_10" />
</LinearLayout>
</RelativeLayout>
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/gift_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="30dp"
android:layout_marginEnd="30dp"
android:textColor="#FFF600"
android:textSize="26dp"
android:textSize="26sp"
android:textStyle="bold" />
</RelativeLayout>
@@ -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" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga_imageview"
@@ -164,7 +159,6 @@
<com.tencent.qgame.animplayer.AnimView
android:id="@+id/vap_anim_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="match_parent" />
</merge>

View File

@@ -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" />
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/iv_avatar"
@@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="#FFFFFC4C"
android:textSize="13dp"
android:textSize="@dimen/sp_13"
tools:text="@string/layout_layout_single_room_rank_notify_02" />
<TextView
@@ -42,7 +42,7 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/white"
android:textSize="13dp"
android:textSize="@dimen/sp_13"
tools:text="@string/layout_layout_single_room_rank_notify_03" />
<TextView
@@ -53,6 +53,6 @@
android:includeFontPadding="false"
android:text="TOP1"
android:textColor="#FFFFFC4C"
android:textSize="13dp" />
android:textSize="13sp" />
</LinearLayout>

View File

@@ -23,6 +23,7 @@ public class GiftEffectInfo implements Serializable {
private int giftId;
private int giftNum;
private GiftInfo gift;
private String levelNum;
private int giftReceiveType;//送礼物的类型,单人,多人,全麦
}

View File

@@ -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麦位的位置
*/

View File

@@ -15,6 +15,4 @@ public class IndexGiftValue implements Serializable {
private long giftValue;
//
}