diff --git a/app/src/main/assets/svga/kitchen_notify.svga b/app/src/main/assets/svga/kitchen_notify.svga new file mode 100644 index 000000000..8a2c4a484 Binary files /dev/null and b/app/src/main/assets/svga/kitchen_notify.svga differ diff --git a/app/src/main/java/com/mango/moshen/avroom/widget/MessageView.java b/app/src/main/java/com/mango/moshen/avroom/widget/MessageView.java index de31adfd8..7e6c814c3 100644 --- a/app/src/main/java/com/mango/moshen/avroom/widget/MessageView.java +++ b/app/src/main/java/com/mango/moshen/avroom/widget/MessageView.java @@ -1,6 +1,7 @@ package com.mango.moshen.avroom.widget; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GIFT_COMPOUND; +import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KITCHEN; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FANS_TEAM_JOIN; @@ -41,8 +42,10 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; +import com.mango.core.im.custom.bean.RoomKitchenAttachment; import com.mango.core.im.custom.bean.WishListAttachment; import com.mango.core.room.wishlist.WishListModel; +import com.mango.moshen.utils.MsgBuilder; import com.netease.nim.uikit.business.uinfo.UserInfoHelper; import com.netease.nim.uikit.common.ui.span.RadiusBackgroundSpan; import com.netease.nim.uikit.common.util.log.LogUtil; @@ -979,6 +982,8 @@ public class MessageView extends FrameLayout { if (second == CustomAttachment.CUSTOM_MSG_WISH_LIST_FINISH) { setWishListComplete(chatRoomMessage, tvContent); } + } else if (first == CUSTOM_MSG_KITCHEN) { + setKitchenMsg(chatRoomMessage, tvContent); } else { tvContent.setTextColor(Color.WHITE); tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip)); @@ -992,6 +997,17 @@ public class MessageView extends FrameLayout { } } + private void setKitchenMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) { + if (chatRoomMessage.getAttachment() instanceof RoomKitchenAttachment) { + RoomKitchenAttachment attachment = (RoomKitchenAttachment) chatRoomMessage.getAttachment(); + tvContent.setText(MsgBuilder.buildKitchenMsg(attachment, roomTipNickColor).build()); + + if (MsgBuilder.setUpKitchenClick(tvContent, attachment.getSkipUrl(), attachment.getNeedLevel())) { + tvContent.setOnClickListener(null); + } + } + } + @SuppressLint("CheckResult") private void setGiftCompoundMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) { if (chatRoomMessage.getAttachment() instanceof GiftCompoundAttachment) { @@ -1000,17 +1016,17 @@ public class MessageView extends FrameLayout { GiftCompoundMsgBean msgInfo = giftCompoundAttachment.getMsgBean(); SpannableBuilder text = new SpannableBuilder(tvContent); text.append( - msgInfo.getNick(), - new ForegroundColorSpan(roomTipNickColor), - new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(String.valueOf(msgInfo.getUid())).subscribe(clickConsumer); - } - } + msgInfo.getNick(), + new ForegroundColorSpan(roomTipNickColor), + new OriginalDrawStatusClickSpan() { + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(String.valueOf(msgInfo.getUid())).subscribe(clickConsumer); } - ) + } + } + ) .append(msgInfo.getMsg(), new ForegroundColorSpan(whiteColor)) .append(msgInfo.getGiftName(), new ForegroundColorSpan(roomTipNickColor)); tvContent.setText(text.build()); @@ -1143,15 +1159,15 @@ public class MessageView extends FrameLayout { case CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE: if (notifyInfo.getHasSelectUser()) { text.append(notifyInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor), - new OriginalDrawStatusClickSpan() { + new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer); - } - } - }) + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer); + } + } + }) .append(" 的心动对象是 ", new ForegroundColorSpan(whiteColor)) .append(notifyInfo.getTargetNickname(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() { @@ -1165,15 +1181,15 @@ public class MessageView extends FrameLayout { }); } else { text.append(notifyInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor), - new OriginalDrawStatusClickSpan() { + new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer); - } - } - }) + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer); + } + } + }) .append(" 未选择心动对象", new ForegroundColorSpan(whiteColor)); } break; @@ -1431,15 +1447,15 @@ public class MessageView extends FrameLayout { isHaveInTeam = true; text.append(value.getNick(), new ForegroundColorSpan(roomTipColor), - new OriginalDrawStatusClickSpan() { + new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(value.getUid()).subscribe(clickConsumer); - } - } - }) + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(value.getUid()).subscribe(clickConsumer); + } + } + }) .append("进入"); if (value.getGroupType() == PKTeamInfo.TEAM_RED) { text.append("红队", new ForegroundColorSpan(tvContent.getResources().getColor(R.color.color_FB3D74))) @@ -1464,7 +1480,7 @@ public class MessageView extends FrameLayout { RoomPkData roomPkData = attachment.getRoomPkData(); SpannableBuilder text = new SpannableBuilder(tvContent) .append(String.format(Locale.getDefault(), "管理员发起房间PK,本次PK时间为 %s 秒,获得", - roomPkData.getDuration()), + roomPkData.getDuration()), new ForegroundColorSpan(whiteColor)); switch (roomPkData.getVoteMode()) { case RoomPkData.VOTE_MODE_GIFT: @@ -1491,7 +1507,7 @@ public class MessageView extends FrameLayout { RoomPkData roomPkData = attachment.getRoomPkData(); SpannableBuilder text = new SpannableBuilder(textView) .append(String.format(Locale.getDefault(), - "PK开始啦!本次PK时间 %s 秒,快给喜欢的选手投票吧!", roomPkData.getDuration()), + "PK开始啦!本次PK时间 %s 秒,快给喜欢的选手投票吧!", roomPkData.getDuration()), new ForegroundColorSpan(greyColor)); textView.setText(text.build()); } @@ -1500,7 +1516,7 @@ public class MessageView extends FrameLayout { RoomPkData roomPkData = attachment.getRoomPkData(); SpannableBuilder text = new SpannableBuilder(tvContent) .append(String.format(Locale.getDefault(), "管理员重新开始房间PK,本次PK时间为 %s 秒,获得", - roomPkData.getDuration()), + roomPkData.getDuration()), new ForegroundColorSpan(whiteColor)); switch (roomPkData.getVoteMode()) { case RoomPkData.VOTE_MODE_GIFT: @@ -1534,8 +1550,8 @@ public class MessageView extends FrameLayout { text.append("平局!\n", new ForegroundColorSpan(whiteColor)); if (blueTeam != null && redTeam != null) { text.append(String.format(Locale.getDefault(), "PK值 %s : %s", - FormatUtils.formatPKValue(blueTeam.getScore()), - FormatUtils.formatPKValue(redTeam.getScore())), + FormatUtils.formatPKValue(blueTeam.getScore()), + FormatUtils.formatPKValue(redTeam.getScore())), new ForegroundColorSpan(whiteColor)); UserInfo redProtector = redTeam.getProtector(); @@ -1545,14 +1561,14 @@ public class MessageView extends FrameLayout { break; } text.append(String.format(Locale.getDefault(), "\n蓝队守护者:%s \n", blueProtector.getNick()), - new ForegroundColorSpan(whiteColor)) + new ForegroundColorSpan(whiteColor)) .append(String.format(Locale.getDefault(), "蓝队守护值:%s \n", - FormatUtils.formatPKValue(blueTeam.getProtecScore())), + FormatUtils.formatPKValue(blueTeam.getProtecScore())), new ForegroundColorSpan(whiteColor)) .append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()), new ForegroundColorSpan(whiteColor)) .append(String.format(Locale.getDefault(), "红队守护值:%s", - FormatUtils.formatPKValue(redTeam.getProtecScore())), + FormatUtils.formatPKValue(redTeam.getProtecScore())), new ForegroundColorSpan(whiteColor)); } break; @@ -1561,21 +1577,21 @@ public class MessageView extends FrameLayout { text.append("蓝队胜利!\n", new ForegroundColorSpan(whiteColor)); if (blueTeam != null && redTeam != null) { text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n", - FormatUtils.formatPKValue(blueTeam.getScore()), - FormatUtils.formatPKValue(redTeam.getScore())), + FormatUtils.formatPKValue(blueTeam.getScore()), + FormatUtils.formatPKValue(redTeam.getScore())), new ForegroundColorSpan(whiteColor)); UserInfo blueProtector = blueTeam.getProtector(); if (blueProtector == null) { text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s", - FormatUtils.formatPKValue(blueTeam.getScore())), + FormatUtils.formatPKValue(blueTeam.getScore())), new ForegroundColorSpan(whiteColor)); } else { text.append(String.format(Locale.getDefault(), "胜方守护者:%s \n", blueProtector.getNick()), - new ForegroundColorSpan(whiteColor)) + new ForegroundColorSpan(whiteColor)) .append(String.format(Locale.getDefault(), "胜方守护值:%s", - FormatUtils.formatPKValue(blueTeam.getProtecScore())), + FormatUtils.formatPKValue(blueTeam.getProtecScore())), new ForegroundColorSpan(whiteColor)); } } @@ -1585,20 +1601,20 @@ public class MessageView extends FrameLayout { text.append("红队胜利!\n", new ForegroundColorSpan(whiteColor)); if (blueTeam != null && redTeam != null) { text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n", - FormatUtils.formatPKValue(redTeam.getScore()), - FormatUtils.formatPKValue(blueTeam.getScore())), + FormatUtils.formatPKValue(redTeam.getScore()), + FormatUtils.formatPKValue(blueTeam.getScore())), new ForegroundColorSpan(whiteColor)); UserInfo redProtector = redTeam.getProtector(); if (redProtector == null) { text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s", - FormatUtils.formatPKValue(redTeam.getScore())), + FormatUtils.formatPKValue(redTeam.getScore())), new ForegroundColorSpan(whiteColor)); } else { text.append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()), - new ForegroundColorSpan(whiteColor)) + new ForegroundColorSpan(whiteColor)) .append(String.format(Locale.getDefault(), "红队守护值:%s", - FormatUtils.formatPKValue(redTeam.getProtecScore())), + FormatUtils.formatPKValue(redTeam.getProtecScore())), new ForegroundColorSpan(whiteColor)); } @@ -1975,11 +1991,11 @@ public class MessageView extends FrameLayout { String vipIcon = NobleUtil.getResource(UserInfo.VIP_ICON, chatRoomMessage); builder.append(vipIcon, expLevelHeight) .append(isOfficial ? ResourcesCompat.getDrawable(getResources(), - R.mipmap.ic_user_official_13dp, null) : null, + R.mipmap.ic_user_official_13dp, null) : null, badgeWidth, badgeHeight) .append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight) .append(AvRoomDataManager.get().isSuperAdmin(chatRoomMessage.getFromAccount()) ? ResourcesCompat.getDrawable(getResources(), - R.drawable.ic_room_super_admin, null) : null, + R.drawable.ic_room_super_admin, null) : null, SizeUtils.dp2px(tvContent.getContext(), 23), expLevelHeight); // 官方主播认证 @@ -2273,13 +2289,13 @@ public class MessageView extends FrameLayout { for (GiftReceiver targetUser : attachment.getGiftMultiReceiverInfo().getTargetUsers()) { text.append(targetUser.getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(targetUser.getUid() + "").subscribe(clickConsumer); - } - } - }) + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(targetUser.getUid() + "").subscribe(clickConsumer); + } + } + }) .append(","); } Editable msg = text.builder; @@ -2353,13 +2369,13 @@ public class MessageView extends FrameLayout { for (MagicReceiver targetUser : magicMultiReceiverInfo.getTargetUsers()) { text.append(targetUser.getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - if (clickConsumer != null) { - Single.just(targetUser.getUid() + "").subscribe(clickConsumer); - } - } - }) + @Override + public void onClick(@NonNull View widget) { + if (clickConsumer != null) { + Single.just(targetUser.getUid() + "").subscribe(clickConsumer); + } + } + }) .append(","); } Editable msg = text.builder; @@ -2556,14 +2572,14 @@ public class MessageView extends FrameLayout { mMessageAdapter.notifyItemChanged(position); long targetUid = JavaUtil.str2long(chatRoomMessage.getFromAccount()); Single.zip(AvRoomModel.get().getWelcomeConfig(targetUid), - UserModel.get().getUserInfo(targetUid), (roomWelcomeConfig, info) -> { - WelcomeInfo welcomeInfo = new WelcomeInfo(); - welcomeInfo.setContent(roomWelcomeConfig.getMsg()); - welcomeInfo.setTargetUid(targetUid); - welcomeInfo.setTargetNick(info.getNick()); - welcomeInfo.setFans(roomWelcomeConfig.isFans()); - return welcomeInfo; - }) + UserModel.get().getUserInfo(targetUid), (roomWelcomeConfig, info) -> { + WelcomeInfo welcomeInfo = new WelcomeInfo(); + welcomeInfo.setContent(roomWelcomeConfig.getMsg()); + welcomeInfo.setTargetUid(targetUid); + welcomeInfo.setTargetNick(info.getNick()); + welcomeInfo.setFans(roomWelcomeConfig.isFans()); + return welcomeInfo; + }) .observeOn(AndroidSchedulers.mainThread()) .flatMap((Function>) welcomeInfo -> { WelcomeAttachment attachment = new WelcomeAttachment(); @@ -2720,14 +2736,14 @@ public class MessageView extends FrameLayout { SpannableBuilder text = new SpannableBuilder(tvContent); addCommonTag(chatRoomMessage, text, tvContent); text.append(extension == null ? "我" : RegexUtil.getPrintableString(extension.getSenderNick()), - new ForegroundColorSpan(greyColor), - new OriginalDrawStatusClickSpan() { - @Override - public void onClick(@NonNull View widget) { - Single.just(String.valueOf(chatRoomMessage.getFromAccount())) - .doOnSuccess(clickConsumer).subscribe(); - } - }) + new ForegroundColorSpan(greyColor), + new OriginalDrawStatusClickSpan() { + @Override + public void onClick(@NonNull View widget) { + Single.just(String.valueOf(chatRoomMessage.getFromAccount())) + .doOnSuccess(clickConsumer).subscribe(); + } + }) .append(":" + welcomeInfo.getLastConent(), new ForegroundColorSpan(whiteColor)) .append(welcomeInfo.getTargetNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() { diff --git a/app/src/main/java/com/mango/moshen/avroom/widget/RoomEffectView.kt b/app/src/main/java/com/mango/moshen/avroom/widget/RoomEffectView.kt index 3b76a6116..9fde64ca8 100644 --- a/app/src/main/java/com/mango/moshen/avroom/widget/RoomEffectView.kt +++ b/app/src/main/java/com/mango/moshen/avroom/widget/RoomEffectView.kt @@ -52,6 +52,9 @@ import com.mango.core.super_admin.util.SuperAdminUtil import com.mango.core.user.UserModel import com.mango.core.user.bean.UserInfo import com.mango.core.utils.subAndReplaceDot +import com.mango.moshen.ui.webview.CommonWebViewActivity +import com.mango.moshen.utils.MsgBuilder +import com.mango.moshen.utils.UserUtils import com.mango.xchat_android_library.utils.ListUtils import io.reactivex.Observable import io.reactivex.ObservableEmitter @@ -116,12 +119,19 @@ class RoomEffectView @JvmOverloads constructor( private val messagesGiftCompound: MutableList by lazy { ArrayList() } private var animationRadish: Animation? = null - private val messagesRadish: MutableList by lazy { java.util.ArrayList() } + private val messagesRadish: MutableList by lazy { ArrayList() } private var radishDisposable: Disposable? = null - private val messagesRadishSVGA: MutableList by lazy { java.util.ArrayList() } + private val messagesRadishSVGA: MutableList by lazy { ArrayList() } private var radishSVGADisposable: Disposable? = null + private var kitchenAnimation: Animation? = null + private var kitchenDisposable: Disposable? = null + private val kitchenMessages: MutableList by lazy { ArrayList() } + + private var kitchenSVGADisposable: Disposable? = null + private val kitchenMessagesSVGA: MutableList by lazy { ArrayList() } + private var isSvgaPlaying = false private var isHideCarEffect = false @@ -216,6 +226,8 @@ class RoomEffectView @JvmOverloads constructor( binding.svgaWishList.startAnimation() } } + RoomEvent.KITCHEN_ROOM -> addKitchenNotify(roomEvent.chatRoomMessage) + RoomEvent.KITCHEN_ALL_ROOM -> addKitchenNotifyBySVGA(roomEvent.chatRoomMessage) else -> {} } } @@ -577,6 +589,117 @@ class RoomEffectView @JvmOverloads constructor( ) } + /** + * 幸运池飘屏 + * + * @param chatRoomMessage + */ + private fun addKitchenNotify(chatRoomMessage: ChatRoomMessage) { + if (binding.clNotify.visibility == GONE) { + binding.clNotify.visibility = VISIBLE + } + kitchenMessages.add(chatRoomMessage) + if (kitchenDisposable == null || kitchenMessages.size == 1) { + kitchenDisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .takeWhile { kitchenMessages.size > 0 } + .subscribe { + showKitchenNotify( + kitchenMessages.removeAt(0) + ) + } + } + } + + private fun showKitchenNotify(chatRoomMessage: ChatRoomMessage) { + val attachment = chatRoomMessage.attachment as RoomKitchenAttachment + val textView = + LayoutInflater.from(mContext).inflate(R.layout.layout_room_box_notify, null) as TextView + val text = MsgBuilder.buildKitchenMsg(attachment) + textView.text = text.build() + MsgBuilder.setUpKitchenClick(textView, attachment.skipUrl, attachment.needLevel) + kitchenAnimation = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify) + binding.flKitchenNotify.addView(textView) + textView.startAnimation(kitchenAnimation) + binding.flKitchenNotify.postDelayed( + { binding.flKitchenNotify.removeView(textView) }, + SHOW_TIME.toLong() + ) + } + + /** + * 幸运池飘屏 五级 SVGA背景的 + * + * @param chatRoomMessage + */ + private fun addKitchenNotifyBySVGA(chatRoomMessage: ChatRoomMessage) { + if (binding.clNotify.visibility == GONE) { + binding.clNotify.visibility = VISIBLE + } + kitchenMessagesSVGA.add(chatRoomMessage) + if (kitchenSVGADisposable == null || kitchenMessagesSVGA.size == 1) { + kitchenSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .takeWhile { kitchenMessagesSVGA.size > 0 } + .subscribe { + showKitchenNotifyBySVGA( + kitchenMessagesSVGA.removeAt(0) + ) + } + } + } + + private fun showKitchenNotifyBySVGA(chatRoomMessage: ChatRoomMessage) { + val attachment = chatRoomMessage.attachment as RoomKitchenAttachment + val text = MsgBuilder.buildKitchenMsg(attachment) + val svgaImageView = SVGAImageView(mContext) + svgaImageView.loops = 1 + svgaImageView.clearsAfterStop = true + val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) + svgaImageView.layoutParams = params + svgaImageView.callback = object : SimpleSvgaCallback() { + override fun onFinished() { + binding.flKitchenSvgaNotify.post { + binding.flKitchenSvgaNotify.removeView( + svgaImageView + ) + } + } + } + MsgBuilder.setUpKitchenClick(svgaImageView, attachment.skipUrl, attachment.needLevel) + binding.flKitchenSvgaNotify.addView(svgaImageView) + shareParser().decodeFromAssets( + "svga/kitchen_notify.svga", + object : SVGAParser.ParseCompletion { + override fun onComplete(videoItem: SVGAVideoEntity) { + val dynamicEntity = SVGADynamicEntity() + val textPaint = TextPaint() + textPaint.color = Color.WHITE //字体颜色 + textPaint.textSize = 24f //字体大小 + dynamicEntity.setDynamicText( + StaticLayout( + text.build(), + 0, + text.build().length, + textPaint, + 0, + Layout.Alignment.ALIGN_CENTER, + 1.0f, + 0.0f, + false + ), "noble_text_tx" + ) + val drawable = SVGADrawable(videoItem, dynamicEntity) + svgaImageView.setImageDrawable(drawable) + svgaImageView.stepToFrame(0, true) + } + + override fun onError() {} + }, + null + ) + } + /** * 添加跑马灯 * 以及反射一些参数影响跑马灯 diff --git a/app/src/main/java/com/mango/moshen/utils/MsgBuilder.kt b/app/src/main/java/com/mango/moshen/utils/MsgBuilder.kt new file mode 100644 index 000000000..be9ea83f7 --- /dev/null +++ b/app/src/main/java/com/mango/moshen/utils/MsgBuilder.kt @@ -0,0 +1,43 @@ +package com.mango.moshen.utils + +import android.graphics.Color +import android.text.style.ForegroundColorSpan +import android.view.View +import com.mango.core.im.custom.bean.RoomKitchenAttachment +import com.mango.moshen.ui.webview.CommonWebViewActivity + +class MsgBuilder { + + companion object { + + @JvmStatic + fun buildKitchenMsg( + attachment: RoomKitchenAttachment, + nickColor: Int = Color.parseColor("#FFFE95") + ): SpannableBuilder { + return SpannableBuilder() + .append("恭喜 ", ForegroundColorSpan(Color.WHITE)) + .append(attachment.nick, ForegroundColorSpan(nickColor)) + .append("在星级厨房抽中", ForegroundColorSpan(Color.WHITE)) + .append(attachment.itemMultiple, ForegroundColorSpan(Color.parseColor("#00EAFF"))) + .append("倍奖励,获得", ForegroundColorSpan(Color.WHITE)) + .append(attachment.diamonds, ForegroundColorSpan(Color.parseColor("#00EAFF"))) + .append("钻石!", ForegroundColorSpan(Color.WHITE)) + } + + @JvmStatic + fun setUpKitchenClick(view: View, skipUrl: String, needLevel: Int): Boolean { + val expLevel = UserUtils.getExpLevel() + if (expLevel != 0 && needLevel != 0 && expLevel >= needLevel) { + view.setOnClickListener { + CommonWebViewActivity.start( + view.context, + skipUrl + ) + } + return true + } + return false + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-xhdpi/bg_kitchen_notice.png b/app/src/main/res/drawable-xhdpi/bg_kitchen_notice.png new file mode 100644 index 000000000..ccab2b9da Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_kitchen_notice.png differ diff --git a/app/src/main/res/layout/layout_room_effect.xml b/app/src/main/res/layout/layout_room_effect.xml index e632e79bd..5ccd4bd38 100644 --- a/app/src/main/res/layout/layout_room_effect.xml +++ b/app/src/main/res/layout/layout_room_effect.xml @@ -70,6 +70,20 @@ app:layout_constraintDimensionRatio="75:11" app:layout_constraintTop_toTopOf="parent" /> + + + + + \ No newline at end of file diff --git a/core/src/diff_src_erban/java/com/mango/core/manager/IMNetEaseManager.java b/core/src/diff_src_erban/java/com/mango/core/manager/IMNetEaseManager.java index 17a5fbb79..6ddcac0e4 100644 --- a/core/src/diff_src_erban/java/com/mango/core/manager/IMNetEaseManager.java +++ b/core/src/diff_src_erban/java/com/mango/core/manager/IMNetEaseManager.java @@ -1416,6 +1416,15 @@ public final class IMNetEaseManager { break; } break; + case CUSTOM_MSG_KITCHEN: + if (customAttachment.getSecond() == CUSTOM_MSG_SUB_KITCHEN_ROOM) { + noticeRoomEvent(msg, RoomEvent.KITCHEN_ROOM); + addMessages(msg); + } else if (customAttachment.getSecond() == CUSTOM_MSG_SUB_KITCHEN_ALL_ROOM) { + noticeRoomEvent(msg, RoomEvent.KITCHEN_ALL_ROOM); + addMessages(msg); + } + break; default: break; } @@ -1436,10 +1445,10 @@ public final class IMNetEaseManager { UserModel.get().getCacheLoginUserInfo().setGroupType(PKTeamInfo.TEAM_NONE); //在麦上就更新信息 AvRoomModel.get().updateMyMicQueue( - AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()), - String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo.getRoomId()), - UserModel.get().getCacheLoginUserInfo() - ) + AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()), + String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo.getRoomId()), + UserModel.get().getCacheLoginUserInfo() + ) .subscribe(); } } @@ -2140,31 +2149,31 @@ public final class IMNetEaseManager { public Single> fetchRoomMembersByIds(final List accounts) { return Single.create((SingleOnSubscribe>) e -> { - final RoomInfo mCurrentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo; - if (mCurrentRoomInfo == null || ListUtils.isListEmpty(accounts)) { - e.onError(new IllegalArgumentException("RoomInfo is null or accounts is null")); - return; - } - NIMChatRoomSDK.getChatRoomService() - .fetchRoomMembersByIds(String.valueOf(mCurrentRoomInfo.getRoomId()), accounts) - .setCallback(new RequestCallback>() { - @Override - public void onSuccess(List param) { - e.onSuccess(param); - } + final RoomInfo mCurrentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo; + if (mCurrentRoomInfo == null || ListUtils.isListEmpty(accounts)) { + e.onError(new IllegalArgumentException("RoomInfo is null or accounts is null")); + return; + } + NIMChatRoomSDK.getChatRoomService() + .fetchRoomMembersByIds(String.valueOf(mCurrentRoomInfo.getRoomId()), accounts) + .setCallback(new RequestCallback>() { + @Override + public void onSuccess(List param) { + e.onSuccess(param); + } - @Override - public void onFailed(int code) { - e.onError(new Exception("错误码: " + code)); - } + @Override + public void onFailed(int code) { + e.onError(new Exception("错误码: " + code)); + } - @Override - public void onException(Throwable exception) { - e.onError(exception); - } - }); + @Override + public void onException(Throwable exception) { + e.onError(exception); + } + }); - }).subscribeOn(Schedulers.computation()) + }).subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()); } @@ -2380,16 +2389,16 @@ public final class IMNetEaseManager { if (roomInfo == null) return null; String downMicUid = AvRoomDataManager.get().getRoomQueueMemberUidByMicPosition(micPosition); return Single.create((SingleOnSubscribe) e -> { - RequestResult> result = NIMClient.syncRequest(NIMChatRoomSDK.getChatRoomService() - .pollQueue(String.valueOf(roomInfo.getRoomId()), String.valueOf(micPosition))); - if (result.exception != null) - e.onError(result.exception); - else if (result.code != BaseMvpModel.RESULT_OK) - e.onError(new Throwable("错误码: " + result.code)); - else { - e.onSuccess("下麦回调成功"); - } - }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) + RequestResult> result = NIMClient.syncRequest(NIMChatRoomSDK.getChatRoomService() + .pollQueue(String.valueOf(roomInfo.getRoomId()), String.valueOf(micPosition))); + if (result.exception != null) + e.onError(result.exception); + else if (result.code != BaseMvpModel.RESULT_OK) + e.onError(new Throwable("错误码: " + result.code)); + else { + e.onSuccess("下麦回调成功"); + } + }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .doOnSuccess(s -> GiftValueMrg.get().requestDownMic(micPosition, downMicUid)); } @@ -2458,10 +2467,10 @@ public final class IMNetEaseManager { @Override public void subscribe(SingleEmitter e) throws Exception { NIMChatRoomSDK.getChatRoomService().kickMember( - String.valueOf(roomId), - String.valueOf(account), - notifyExtension - ) + String.valueOf(roomId), + String.valueOf(account), + notifyExtension + ) .setCallback(new RequestCallback() { @Override public void onSuccess(Void param) { @@ -2567,28 +2576,28 @@ public final class IMNetEaseManager { return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR)); final long micUid = baseInfo.getUid(); return Single.create( - new SingleOnSubscribe() { - @Override - public void subscribe(SingleEmitter e) throws Exception { - RoomQueueMsgAttachment queueMsgAttachment = new RoomQueueMsgAttachment(CUSTOM_MSG_HEADER_TYPE_QUEUE, - CUSTOM_MSG_HEADER_TYPE_QUEUE_INVITE); + new SingleOnSubscribe() { + @Override + public void subscribe(SingleEmitter e) throws Exception { + RoomQueueMsgAttachment queueMsgAttachment = new RoomQueueMsgAttachment(CUSTOM_MSG_HEADER_TYPE_QUEUE, + CUSTOM_MSG_HEADER_TYPE_QUEUE_INVITE); - queueMsgAttachment.uid = String.valueOf(micUid); - queueMsgAttachment.micPosition = position; - queueMsgAttachment.handleUid = AuthModel.get().getCurrentUid(); - UserInfo myInfo = UserModel.get().getCacheLoginUserInfo(); - if (myInfo != null) { - queueMsgAttachment.handleNick = myInfo.getNick() == null ? "" : myInfo.getNick(); - } - queueMsgAttachment.targetNick = baseInfo.getNick(); - if (baseInfo.getGroupType() != 0) { - queueMsgAttachment.groupType = baseInfo.getGroupType(); - } - ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( - String.valueOf(roomInfo.getRoomId()), queueMsgAttachment); - e.onSuccess(message); - } - }).subscribeOn(Schedulers.io()) + queueMsgAttachment.uid = String.valueOf(micUid); + queueMsgAttachment.micPosition = position; + queueMsgAttachment.handleUid = AuthModel.get().getCurrentUid(); + UserInfo myInfo = UserModel.get().getCacheLoginUserInfo(); + if (myInfo != null) { + queueMsgAttachment.handleNick = myInfo.getNick() == null ? "" : myInfo.getNick(); + } + queueMsgAttachment.targetNick = baseInfo.getNick(); + if (baseInfo.getGroupType() != 0) { + queueMsgAttachment.groupType = baseInfo.getGroupType(); + } + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( + String.valueOf(roomInfo.getRoomId()), queueMsgAttachment); + e.onSuccess(message); + } + }).subscribeOn(Schedulers.io()) .unsubscribeOn(Schedulers.io()) .filter(new Predicate() { @Override @@ -2675,17 +2684,17 @@ public final class IMNetEaseManager { if (roomInfo == null) return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR)); return Single.create( - (SingleOnSubscribe) e -> { - NobleAttachment nobleMsgAttachment = new NobleAttachment(CUSTOM_MESS_HEAD_NOBLE, - CUSTOM_MESS_SUB_ROOM_WELCOME); - nobleMsgAttachment.uid = uid; - nobleMsgAttachment.nick = nick; - nobleMsgAttachment.nobleInfo = nobleInfo; + (SingleOnSubscribe) e -> { + NobleAttachment nobleMsgAttachment = new NobleAttachment(CUSTOM_MESS_HEAD_NOBLE, + CUSTOM_MESS_SUB_ROOM_WELCOME); + nobleMsgAttachment.uid = uid; + nobleMsgAttachment.nick = nick; + nobleMsgAttachment.nobleInfo = nobleInfo; - ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( - String.valueOf(roomInfo.getRoomId()), nobleMsgAttachment); - e.onSuccess(message); - }).subscribeOn(Schedulers.io()) + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( + String.valueOf(roomInfo.getRoomId()), nobleMsgAttachment); + e.onSuccess(message); + }).subscribeOn(Schedulers.io()) .unsubscribeOn(Schedulers.io()) .filter(chatRoomMessage -> nobleInfo != null && !TextUtils.isEmpty(nick) && uid != 0) .toSingle() @@ -2705,19 +2714,19 @@ public final class IMNetEaseManager { if (roomInfo == null) return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR)); return Single.create( - (SingleOnSubscribe) e -> { - CarAttachment carAttachment = new CarAttachment(CUSTOM_MESS_HEAD_CAR, - CUSTOM_MESS_SUB_CAR_ENTER_ROOM); - carAttachment.uid = uid; - carAttachment.nick = nick; - carAttachment.effect = carInfo.getEffect(); - carAttachment.viewUrl = carInfo.getViewUrl(); - carAttachment.otherViewType = carInfo.getOtherViewType(); + (SingleOnSubscribe) e -> { + CarAttachment carAttachment = new CarAttachment(CUSTOM_MESS_HEAD_CAR, + CUSTOM_MESS_SUB_CAR_ENTER_ROOM); + carAttachment.uid = uid; + carAttachment.nick = nick; + carAttachment.effect = carInfo.getEffect(); + carAttachment.viewUrl = carInfo.getViewUrl(); + carAttachment.otherViewType = carInfo.getOtherViewType(); - ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( - String.valueOf(roomInfo.getRoomId()), carAttachment); - e.onSuccess(message); - }).subscribeOn(Schedulers.io()) + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage( + String.valueOf(roomInfo.getRoomId()), carAttachment); + e.onSuccess(message); + }).subscribeOn(Schedulers.io()) .unsubscribeOn(Schedulers.io()) .filter(chatRoomMessage -> carInfo != null && !TextUtils.isEmpty(nick) && uid != 0) .toSingle() @@ -2802,28 +2811,28 @@ public final class IMNetEaseManager { long delayTime, ReconnectListener listener) { return Single.create((SingleOnSubscribe) emitter -> { - retryChatRoomMessage.setRetryCount(retryChatRoomMessage.getRetryCount() + 1); - ImRetryManager.logIde("start send im msg :" + retryChatRoomMessage.getRetryCount()); - if (isExitRoom()) { - String error = "exite room when send msg"; - emitter.onError(new Throwable(error)); - return; - } - if (isChangeRoom(retryChatRoomMessage.getMessage())) { - String error = "changed room when send msg"; - emitter.onError(new Throwable(error)); - return; - } - sendChatRoomMessage(retryChatRoomMessage.getMessage(), false) - .subscribe((message, throwable) -> { - if (throwable == null) { - retryChatRoomMessage.setMessage(message); - emitter.onSuccess(retryChatRoomMessage); - } else { - emitter.onError(throwable); - } - }); - }) + retryChatRoomMessage.setRetryCount(retryChatRoomMessage.getRetryCount() + 1); + ImRetryManager.logIde("start send im msg :" + retryChatRoomMessage.getRetryCount()); + if (isExitRoom()) { + String error = "exite room when send msg"; + emitter.onError(new Throwable(error)); + return; + } + if (isChangeRoom(retryChatRoomMessage.getMessage())) { + String error = "changed room when send msg"; + emitter.onError(new Throwable(error)); + return; + } + sendChatRoomMessage(retryChatRoomMessage.getMessage(), false) + .subscribe((message, throwable) -> { + if (throwable == null) { + retryChatRoomMessage.setMessage(message); + emitter.onSuccess(retryChatRoomMessage); + } else { + emitter.onError(throwable); + } + }); + }) .retryWhen(flowable -> flowable .flatMap(new Function>() { @Override diff --git a/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachParser.java b/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachParser.java index b248ac9e7..a5f6a0b9e 100644 --- a/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachParser.java +++ b/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachParser.java @@ -28,6 +28,7 @@ import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_T import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEAD_SHIFT_OUT; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_TIP; +import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KITCHEN; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KTV; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE; import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE_NOTICE; @@ -601,6 +602,9 @@ public class CustomAttachParser implements MsgAttachmentParser { case CUSTOM_MSG_WISH_LIST: attachment = new WishListAttachment(first, second); break; + case CUSTOM_MSG_KITCHEN: + attachment = new RoomKitchenAttachment(first, second); + break; default: LogUtils.e("未定义的first,请现在CustomAttachParser中解析first=" + first + " second=" + second); break; diff --git a/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachment.java b/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachment.java index 518830e4c..81ca24303 100644 --- a/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachment.java +++ b/core/src/main/java/com/mango/core/im/custom/bean/CustomAttachment.java @@ -428,6 +428,11 @@ public class CustomAttachment implements MsgAttachment { // 关闭心愿礼物 public static final int CUSTOM_MSG_WISH_LIST_CLOSE = 955; + public static final int CUSTOM_MSG_KITCHEN = 96; // 深海奇缘消息 + public static final int CUSTOM_MSG_SUB_KITCHEN_ROOM = 960; // 深海奇缘礼物房间飘屏通知(静态) + public static final int CUSTOM_MSG_SUB_KITCHEN_ALL_ROOM = 961; // 深海奇缘礼物房间飘屏通知(动态) + public static final int CUSTOM_MSG_SUB_kitchen_ALL_APP = 962; // 深海奇缘礼物全服飘屏通知 + /** * 自定义消息附件的类型,根据该字段区分不同的自定义消息 diff --git a/core/src/main/java/com/mango/core/im/custom/bean/RoomKitchenAttachment.java b/core/src/main/java/com/mango/core/im/custom/bean/RoomKitchenAttachment.java new file mode 100644 index 000000000..4e33acc36 --- /dev/null +++ b/core/src/main/java/com/mango/core/im/custom/bean/RoomKitchenAttachment.java @@ -0,0 +1,130 @@ +package com.mango.core.im.custom.bean; + +import com.alibaba.fastjson.JSONObject; +import com.netease.nim.uikit.common.util.string.StringUtil; + +/** + * Created by chenran on 2017/10/4. + */ + +public class RoomKitchenAttachment extends CustomAttachment { + private long uid; + private String nick; + private long roomUid; + private long itemId; + private String itemMultiple; + private String diamonds; + private int bannerId; + private String skipUrl; + private int needLevel; + + public RoomKitchenAttachment(int first, int second) { + super(first, second); + } + + public long getUid() { + return uid; + } + + public void setUid(long uid) { + this.uid = uid; + } + + public String getNick() { + return nick; + } + + public void setNick(String nick) { + this.nick = nick; + } + + public long getRoomUid() { + return roomUid; + } + + public void setRoomUid(long roomUid) { + this.roomUid = roomUid; + } + + public long getItemId() { + return itemId; + } + + public void setItemId(long itemId) { + this.itemId = itemId; + } + + public String getItemMultiple() { + return itemMultiple; + } + + public void setItemMultiple(String itemMultiple) { + this.itemMultiple = itemMultiple; + } + + public String getDiamonds() { + return diamonds; + } + + public void setDiamonds(String diamonds) { + this.diamonds = diamonds; + } + + public int getBannerId() { + return bannerId; + } + + public void setBannerId(int bannerId) { + this.bannerId = bannerId; + } + + public String getSkipUrl() { + return skipUrl; + } + + public void setSkipUrl(String skipUrl) { + this.skipUrl = skipUrl; + } + + public int getNeedLevel() { + return needLevel; + } + + public void setNeedLevel(int needLevel) { + this.needLevel = needLevel; + } + + @Override + protected void parseData(JSONObject jsonObject) { + uid = jsonObject.getLongValue("uid"); + nick = jsonObject.getString("nick"); + roomUid = jsonObject.getLongValue("roomUid"); + itemId = jsonObject.getLongValue("itemId"); + diamonds = jsonObject.getString("diamonds"); + itemMultiple = jsonObject.getString("itemMultiple"); + bannerId = jsonObject.getIntValue("bannerId"); + skipUrl = jsonObject.getString("skipUrl"); + needLevel = jsonObject.getIntValue("needLevel"); + + } + + @Override + protected JSONObject packData() { + return null; + } + + @Override + public String toString() { + return "RoomKitchenAttachment{" + + "uid=" + uid + + ", nick='" + nick + '\'' + + ", roomUid=" + roomUid + + ", itemId=" + itemId + + ", itemMultiple='" + itemMultiple + '\'' + + ", diamonds='" + diamonds + '\'' + + ", bannerId=" + bannerId + + ", skipUrl='" + skipUrl + '\'' + + ", needLevel=" + needLevel + + '}'; + } +} diff --git a/core/src/main/java/com/mango/core/manager/RoomEvent.java b/core/src/main/java/com/mango/core/manager/RoomEvent.java index 8f9d0ec93..e891ad265 100644 --- a/core/src/main/java/com/mango/core/manager/RoomEvent.java +++ b/core/src/main/java/com/mango/core/manager/RoomEvent.java @@ -251,6 +251,10 @@ public class RoomEvent { public static final int WISH_LIST_EFFECT = 99; + public static final int KITCHEN_ROOM = 100; + + public static final int KITCHEN_ALL_ROOM = 101; + private int event = NONE; private int micPosition = Integer.MIN_VALUE; private int posState = -1; diff --git a/core/src/main/java/com/mango/core/room/bean/RoomInfo.java b/core/src/main/java/com/mango/core/room/bean/RoomInfo.java index 6926718a9..b96a6a791 100644 --- a/core/src/main/java/com/mango/core/room/bean/RoomInfo.java +++ b/core/src/main/java/com/mango/core/room/bean/RoomInfo.java @@ -17,7 +17,7 @@ import lombok.ToString; */ @Data @ToString -public class RoomInfo implements Parcelable,Serializable { +public class RoomInfo implements Parcelable, Serializable { public static final int ROOMTYPE_DEFAULT = -1;//使用服务器的房间类型 public static final int ROOMTYPE_AUCTION = 1;//竞拍房间 public static final int ROOMTYPE_LIGHT_CHAT = 2;//轻聊房 @@ -29,34 +29,68 @@ public class RoomInfo implements Parcelable,Serializable { public static final String DATING_STATE_FLOW = "1";//嘉宾交流 public static final String DATING_STATE_SELECT = "2";//心动选人 public static final String DATING_STATE_PUBLISH = "3";//公布心动 + // 限制类型 + public static final String LOCK = "lock";//密码可进 + public static final String IS_FRIEND = "isFriend";//密码可进 + public static final String IS_INVITE = "isInvite";//密码可进 + public static final Creator CREATOR = new Creator() { + @Override + public RoomInfo createFromParcel(Parcel in) { + return new RoomInfo(in); + } + @Override + public RoomInfo[] newArray(int size) { + return new RoomInfo[size]; + } + }; + public String title; + /** + * 是否需要打开全服红包 true为开启 false为关闭 + */ + public boolean serverRedEnvelopeSwitch; + // 是否有桌球游戏 + public boolean hasDragonGame; + public String roomPwd; + /** + * 主题类型id + */ + public int tagId; + public String tagPict; + /** + * 房间在线人数 (会减去超管的人数) + */ + public int onlineNum; + //是否有ktv权限的意思 + public boolean hasKTVPriv; + //房间是否打开了ktv + public boolean isOpenKTV; + public boolean isOpenGame; + public BoxSwitchVo boxSwitchVo; + public String nick; + public int gender; private long uid; +// private long openTime; /** * 官方账号与非官方账号 */ private int officeUser; - private long roomId; - private long roomUid; - - public String title; //头像 private String avatar; private int type; - - /** 房间主题 */ + /** + * 房间主题 + */ private String roomDesc; private String backPic; - private List speakTemplate; - /** * 房间是否开启,是否正在直播 */ private boolean valid; - /** * 1:房主在房间,2 :房主不在房间 */ @@ -67,97 +101,82 @@ public class RoomInfo implements Parcelable,Serializable { private int audioQuality; // true为关闭 false为开启 private boolean isCloseScreen; - /** - * 是否需要打开全服红包 true为开启 false为关闭 - */ - public boolean serverRedEnvelopeSwitch; - - // 是否有桌球游戏 - public boolean hasDragonGame; - private String meetingName; - -// private long openTime; - - public String roomPwd; - private String sortName; - private String roomTag; - /** 主题类型id */ - public int tagId; - public String tagPict; - /** 房间在线人数 (会减去超管的人数)*/ - public int onlineNum; /** * 是否是皇帝推荐的 */ private byte isRecom; - private boolean isRoomFans; - private BackgroundBean background; - //是否有ktv权限的意思 - public boolean hasKTVPriv; - //房间是否打开了ktv - public boolean isOpenKTV; - - public boolean isOpenGame; - - public BoxSwitchVo boxSwitchVo; - private String singingMusicName; - // 限制类型 - public static final String LOCK = "lock";//密码可进 - public static final String IS_FRIEND = "isFriend";//密码可进 - public static final String IS_INVITE = "isInvite";//密码可进 private String limitType; - private String introduction; - /** * {@link RoomModeType} */ private int roomModeType; private int isPermitRoom; // 1:牌照房, 3:新秀房,其他:普通房 - /** * 是否为房间纯净模式 */ private boolean isPureMode; - /** * 是否关闭抽奖 */ private boolean closeBox; - /** * 离开模式 */ private boolean leaveMode; - public String nick; - public int gender; - private long worldId; // >0:语音派对房 - private boolean showPkBeginTime; private long pkBeginTime; - /** - * 个播匹配开始时间 + * 个播匹配开始时间 */ private long pkMatchStartTime; - /** * 是否有心愿礼物权限 */ private boolean hasWishGiftPermit; - /** * 是否已经开启心愿礼物 */ private boolean hasOpenWishGift; - + /** + * 是否开启礼物值,目前ktv房,cp房,都不支持 + */ + private boolean showGiftValue; + /** + * 0.不隐藏; 1.全局+排行榜 + */ + private int hideFlag; + /** + * 公屏操作人:0.房主或管理员;1.超管 + */ + private int closeScreenFlag; + private boolean redEnvelopeOpen; + /** + * COMMUNICATING(1, "交谈"), + * PICK(2, "心动选人"), + * PUBLISH(3, "公布心动"), + * FINISH(4, "结束"), + */ + private String blindDateState = ""; + private long blindDateVipUid; + private boolean canOpenBlindDate; + /** + * {@link RoomAudioSdkType} + */ + private String audioSdkType; + private String trtcSig; + private boolean isReselect; + private long mgId; + private String mgName; + private int mgMicNum; + private long clearScreenTime; protected RoomInfo(Parcel in) { uid = in.readLong(); @@ -179,8 +198,8 @@ public class RoomInfo implements Parcelable,Serializable { hasDragonGame = in.readByte() != 0; meetingName = in.readString(); roomPwd = in.readString(); - roomTag = in.readString(); sortName = in.readString(); + roomTag = in.readString(); tagId = in.readInt(); tagPict = in.readString(); onlineNum = in.readInt(); @@ -204,6 +223,9 @@ public class RoomInfo implements Parcelable,Serializable { worldId = in.readLong(); showPkBeginTime = in.readByte() != 0; pkBeginTime = in.readLong(); + pkMatchStartTime = in.readLong(); + hasWishGiftPermit = in.readByte() != 0; + hasOpenWishGift = in.readByte() != 0; showGiftValue = in.readByte() != 0; hideFlag = in.readInt(); closeScreenFlag = in.readInt(); @@ -220,6 +242,9 @@ public class RoomInfo implements Parcelable,Serializable { clearScreenTime = in.readLong(); } + public RoomInfo() { + } + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(uid); @@ -241,8 +266,8 @@ public class RoomInfo implements Parcelable,Serializable { dest.writeByte((byte) (hasDragonGame ? 1 : 0)); dest.writeString(meetingName); dest.writeString(roomPwd); - dest.writeString(roomTag); dest.writeString(sortName); + dest.writeString(roomTag); dest.writeInt(tagId); dest.writeString(tagPict); dest.writeInt(onlineNum); @@ -266,6 +291,9 @@ public class RoomInfo implements Parcelable,Serializable { dest.writeLong(worldId); dest.writeByte((byte) (showPkBeginTime ? 1 : 0)); dest.writeLong(pkBeginTime); + dest.writeLong(pkMatchStartTime); + dest.writeByte((byte) (hasWishGiftPermit ? 1 : 0)); + dest.writeByte((byte) (hasOpenWishGift ? 1 : 0)); dest.writeByte((byte) (showGiftValue ? 1 : 0)); dest.writeInt(hideFlag); dest.writeInt(closeScreenFlag); @@ -286,18 +314,10 @@ public class RoomInfo implements Parcelable,Serializable { public int describeContents() { return 0; } - - public static final Creator CREATOR = new Creator() { - @Override - public RoomInfo createFromParcel(Parcel in) { - return new RoomInfo(in); - } - - @Override - public RoomInfo[] newArray(int size) { - return new RoomInfo[size]; - } - }; +// /** +// * 房间角标 +// */ +// private String badge; /** * 获取房间类型,目前是用于统计 @@ -311,62 +331,18 @@ public class RoomInfo implements Parcelable,Serializable { return "普通房"; } - /** - * 是否开启礼物值,目前ktv房,cp房,都不支持 - */ - private boolean showGiftValue; + public static class BackgroundBean implements Parcelable, Serializable { + public static final Creator CREATOR = new Creator() { + @Override + public BackgroundBean createFromParcel(Parcel in) { + return new BackgroundBean(in); + } - /** - * 0.不隐藏; 1.全局+排行榜 - */ - private int hideFlag; - - /** - * 公屏操作人:0.房主或管理员;1.超管 - */ - private int closeScreenFlag; - - private boolean redEnvelopeOpen; - - /** - * COMMUNICATING(1, "交谈"), - * PICK(2, "心动选人"), - * PUBLISH(3, "公布心动"), - * FINISH(4, "结束"), - */ - private String blindDateState = ""; - - private long blindDateVipUid; - - private boolean canOpenBlindDate; - - /** - * {@link RoomAudioSdkType} - */ - private String audioSdkType; - - private String trtcSig; - - private boolean isReselect; - - private long mgId; - - private String mgName; - - private int mgMicNum; - - private long clearScreenTime; -// /** -// * 房间角标 -// */ -// private String badge; - - - public RoomInfo() { - } - - - public static class BackgroundBean implements Parcelable{ + @Override + public BackgroundBean[] newArray(int size) { + return new BackgroundBean[size]; + } + }; /** * id : 4 * name : 背景名称ABC @@ -403,7 +379,6 @@ public class RoomInfo implements Parcelable,Serializable { private int status; private int uid; - protected BackgroundBean(Parcel in) { id = in.readInt(); name = in.readString(); @@ -443,18 +418,6 @@ public class RoomInfo implements Parcelable,Serializable { dest.writeInt(uid); } - public static final Creator CREATOR = new Creator() { - @Override - public BackgroundBean createFromParcel(Parcel in) { - return new BackgroundBean(in); - } - - @Override - public BackgroundBean[] newArray(int size) { - return new BackgroundBean[size]; - } - }; - public int getId() { return id; }