[Modify]星级厨房需求完成

This commit is contained in:
wushaocheng
2022-12-08 17:16:12 +08:00
parent 211d55ad12
commit dc97fe1fb0
15 changed files with 309 additions and 10 deletions

Binary file not shown.

View File

@@ -20,7 +20,6 @@ import android.widget.RelativeLayout
import android.widget.TextView
import androidx.annotation.CallSuper
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
@@ -470,7 +469,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
bannerAdapter.notifyDataSetChanged()
bannerAdapter.setRoomActClickListener(RoomActClickListener { url ->
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_ROOM_PROMOTE_CLICK, ResUtil.getString(R.string.avroom_fragment_baseroomfragment_03))
.onEvent(
StatisticsProtocol.EVENT_ROOM_PROMOTE_CLICK,
ResUtil.getString(R.string.avroom_fragment_baseroomfragment_03)
)
DialogWebViewActivity.start(mContext, url)
})
@@ -628,13 +630,19 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
when (v.id) {
R.id.input_send -> {
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_ROOM_CHAT_CLICK, ResUtil.getString(R.string.avroom_fragment_baseroomfragment_05))
.onEvent(
StatisticsProtocol.EVENT_ROOM_CHAT_CLICK,
ResUtil.getString(R.string.avroom_fragment_baseroomfragment_05)
)
sendMsg()
}
R.id.contribute_list -> {
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_MP_ROOM_RANKING_LIST_CLICK, ResUtil.getString(R.string.avroom_fragment_baseroomfragment_06))
.onEvent(
StatisticsProtocol.EVENT_MP_ROOM_RANKING_LIST_CLICK,
ResUtil.getString(R.string.avroom_fragment_baseroomfragment_06)
)
mvpPresenter?.loadRoomRank()
}
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)

View File

@@ -30,7 +30,6 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.helper.AnimHelper
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.ui.utils.isDestroyed
import com.yizhuan.erban.ui.utils.load

View File

@@ -19,6 +19,7 @@ import android.view.animation.AnimationUtils
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.coorchice.library.SuperTextView
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
@@ -30,11 +31,11 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.helper.AnimHelper
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.ui.utils.isDestroyed
import com.yizhuan.erban.ui.utils.load
import com.yizhuan.erban.ui.utils.loadAnim
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
import com.yizhuan.erban.ui.widget.SimpleAnimListener
import com.yizhuan.erban.ui.widget.drawgift.DrawGiftPlayHelper
import com.yizhuan.erban.utils.SpannableBuilder
@@ -127,6 +128,13 @@ class RoomEffectView @JvmOverloads constructor(
private val drawGiftPlayHelper: DrawGiftPlayHelper by lazy { DrawGiftPlayHelper(context as Activity) }
private var animationLuckySea: Animation? = null
private var luckySeaDisposable: Disposable? = null
private val messagesLuckySea: MutableList<ChatRoomMessage> by lazy { ArrayList() }
private var luckySeaSVGADisposable: Disposable? = null
private val messagesLuckySeaSVGA: MutableList<ChatRoomMessage> by lazy { ArrayList() }
private fun loopCarAnim() {
if (context.isDestroyed()) return
isSvgaPlaying = false
@@ -151,13 +159,13 @@ class RoomEffectView @JvmOverloads constructor(
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
when (roomEvent.event) {
RoomEvent.BOX_NOTIFY -> {
if((mContext as AVRoomActivity).isTopActivity) {
if ((mContext as AVRoomActivity).isTopActivity) {
addBoxNotify(roomEvent.chatRoomMessage)
}
}
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
RoomEvent.BOX_NOTIFY_SVGA -> {
if((mContext as AVRoomActivity).isTopActivity) {
if ((mContext as AVRoomActivity).isTopActivity) {
addBoxNotifyBySVGA(roomEvent.chatRoomMessage)
}
}
@@ -206,6 +214,12 @@ class RoomEffectView @JvmOverloads constructor(
false
)
}
RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY -> {// 深海奇缘礼物房间飘屏通知
addLuckySeaNotify(roomEvent.chatRoomMessage)
}
RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY -> {// 深海奇缘礼物全服飘屏通知
addLuckySeaNotifyBySVGA(roomEvent.chatRoomMessage)
}
else -> {}
}
}
@@ -410,6 +424,171 @@ class RoomEffectView @JvmOverloads constructor(
}
}
/**
* 星级厨房飘屏
*
* @param chatRoomMessage
*/
private fun addLuckySeaNotify(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {
binding.clNotify.visibility = VISIBLE
}
messagesLuckySea.add(chatRoomMessage)
if (luckySeaDisposable == null || messagesLuckySea.size == 1) {
luckySeaDisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesLuckySea.size > 0 }
.subscribe {
showLuckySeaNotify(
messagesLuckySea.removeAt(0)
)
}
}
}
private fun showLuckySeaNotify(chatRoomMessage: ChatRoomMessage) {
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
val bean = attachment.roomLuckySeaMsgInfo
val textView =
LayoutInflater.from(mContext)
.inflate(R.layout.layout_room_lucky_sea_notify, null) as TextView
val text = SpannableBuilder()
.append(
ResUtil.getString(R.string.congratulation),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.nick + " ",
ForegroundColorSpan(ContextCompat.getColor(context, R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.in_the_star_kitchen_draw),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.itemMultiple.toString(),
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.times_reward_get),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.diamonds.toString(),
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.diamond_point),
ForegroundColorSpan(Color.WHITE)
)
textView.text = text.build()
animationLuckySea = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
binding.flLuckySeaNotify.addView(textView)
textView.startAnimation(animationLuckySea)
binding.flLuckySeaNotify.postDelayed(
{ binding.flLuckySeaNotify.removeView(textView) },
SHOW_TIME.toLong()
)
}
/**
* 星级厨房飘屏 SVGA背景的
*
* @param chatRoomMessage
*/
private fun addLuckySeaNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
if (binding.clNotify.visibility == GONE) {
binding.clNotify.visibility = VISIBLE
}
messagesLuckySeaSVGA.add(chatRoomMessage)
if (luckySeaSVGADisposable == null || messagesLuckySeaSVGA.size == 1) {
luckySeaSVGADisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesLuckySeaSVGA.size > 0 }
.subscribe {
showLuckySeaNotifyBySVGA(
messagesLuckySeaSVGA.removeAt(0)
)
}
}
}
private fun showLuckySeaNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
val attachment = chatRoomMessage.attachment as RoomLuckySeaAttachment
val bean = attachment.roomLuckySeaMsgInfo
val text = SpannableBuilder()
.append(
ResUtil.getString(R.string.congratulation),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.nick + " ",
ForegroundColorSpan(ContextCompat.getColor(context, R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.in_the_star_kitchen_draw),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.itemMultiple.toString(),
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.times_reward_get),
ForegroundColorSpan(Color.WHITE)
)
.append(
bean.diamonds.toString(),
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.diamond_point),
ForegroundColorSpan(Color.WHITE)
)
val svgaImageView = SVGAImageView(mContext)
svgaImageView.loops = 1
svgaImageView.clearsAfterDetached = true
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
svgaImageView.layoutParams = params
svgaImageView.callback = object : SimpleSvgaCallback() {
override fun onFinished() {
binding.flSvgaLuckySeaNotify.post { binding.flSvgaLuckySeaNotify.removeView(svgaImageView) }
}
}
binding.flSvgaLuckySeaNotify.addView(svgaImageView)
shareParser().decodeFromAssets("svga/lucky_sea_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"
)
svgaImageView.setOnClickListener {
if(!TextUtils.isEmpty(bean.skipUrl)) {
DialogWebViewActivity.start(mContext, bean.skipUrl)
}
}
val drawable = SVGADrawable(videoItem, dynamicEntity)
svgaImageView.setImageDrawable(drawable)
svgaImageView.stepToFrame(0, true)
}
override fun onError() {}
}, null)
}
/**
* 幸運池飄屏
*
@@ -482,7 +661,7 @@ class RoomEffectView @JvmOverloads constructor(
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesBoxSVGA.size > 0 }
.subscribe {
if((mContext as AVRoomActivity).isTopActivity) {
if ((mContext as AVRoomActivity).isTopActivity) {
showBoxNotifyBySVGA(
messagesBoxSVGA.removeAt(0)
)

View File

@@ -206,7 +206,7 @@ public class HomeTabHomeFragment extends BaseFragment {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRefreshHomeDataEvent(RefreshHomeDataEvent event) {
// if (isResumed()) getData();
if (isResumed()) getData();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -122,6 +122,20 @@
app:layout_constraintDimensionRatio="75:12"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/fl_lucky_sea_notify"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="75:11"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/fl_svga_lucky_sea_notify"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="75:11"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<com.coorchice.library.SuperTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_lucky_sea_notice"
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="2"
android:lineSpacingExtra="0dp"
android:lineSpacingMultiplier="0.9"
android:paddingStart="80dp"
android:paddingEnd="80dp"
android:textSize="12sp"
tools:layout_height="wrap_content"
tools:text="@string/layout_layout_room_box_notify_01" />

View File

@@ -5006,5 +5006,9 @@
<string name="only_can_see_three_month_data">只能查看前3個月的結算統計</string>
<string name="text_modify_bind_phone">更換綁定</string>
<string name="room">房間</string>
<string name="congratulation">恭喜</string>
<string name="in_the_star_kitchen_draw">在星級厨房抽中</string>
<string name="times_reward_get">倍獎勵,獲得</string>
<string name="diamond_point">鉆石!</string>
</resources>

View File

@@ -1328,6 +1328,15 @@ public final class IMNetEaseManager {
noticeRoomEvent(msg, RoomEvent.DRAW_GIFT_EFFECT);
}
break;
case CUSTOM_MSG_LUCKY_SEA:
if (second == CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY) {
addMessages(msg);
noticeRoomEvent(msg, RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY);
}else if(second == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY){
addMessages(msg);
noticeRoomEvent(msg, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
}
break;
default:
break;
}

View File

@@ -32,6 +32,9 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE_NOTICE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEVEL_UP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MENTORING_RELATIONSHIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MINI_WORLD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MODULE_HALL;
@@ -606,6 +609,14 @@ public class CustomAttachParser implements MsgAttachmentParser {
attachment = new DrawGiftAttachment(first, second);
}
break;
case CUSTOM_MSG_LUCKY_SEA:
switch (second) {
case CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY:
case CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY:
attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, second);
break;
}
break;
default:
LogUtils.e(ResUtil.getString(R.string.custom_bean_customattachparser_01) + first + " second=" + second);
break;

View File

@@ -418,6 +418,10 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_DRAW_GIFT_EFFECT = 94;
public static final int CUSTOM_MSG_SUB_TYPE_DRAW_GIFT_EFFECT = 941;
//星级厨房
public static final int CUSTOM_MSG_LUCKY_SEA = 95; // 深海奇缘消息
public static final int CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY = 950; // 深海奇缘礼物房间飘屏通知
public static final int CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY = 951;// 深海奇缘礼物全服飘屏通知
/**
* 自定义消息附件的类型,根据该字段区分不同的自定义消息

View File

@@ -0,0 +1,33 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
/**
* 星级厨房
* Created by wushaocheng on 2022/12/8.
*/
public class RoomLuckySeaAttachment extends CustomAttachment {
private RoomLuckySeaMsgBean roomLuckySeaMsgBean;
public RoomLuckySeaAttachment(int first, int second) {
super(first, second);
}
@Override
protected void parseData(JSONObject data) {
roomLuckySeaMsgBean = new Gson().fromJson(data.toJSONString(), RoomLuckySeaMsgBean.class);
}
@Override
protected JSONObject packData() {
String jsonStr = new Gson().toJson(roomLuckySeaMsgBean);
return JSONObject.parseObject(jsonStr);
}
public RoomLuckySeaMsgBean getRoomLuckySeaMsgInfo() {
return roomLuckySeaMsgBean;
}
}

View File

@@ -0,0 +1,15 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import lombok.Data;
@Data
public class RoomLuckySeaMsgBean {
private long uid;
private String nick;
private long roomUid;//房间uid
private long itemId;//中奖选项id
private int itemMultiple;//倍数
private long diamonds;//钻石
private int bannerId;//bannerId
private String skipUrl;//跳转id
}

View File

@@ -247,6 +247,11 @@ public class RoomEvent {
public static final int DRAW_GIFT_EFFECT = 98;
//深海奇缘礼物房间飘屏通知
public static final int LUCKY_SEA_GIFT_ROOM_NOTIFY = 99;
//深海奇缘礼物全服飘屏通知
public static final int LUCKY_SEA_GIFT_SERVER_NOTIFY = 100;
private int event = NONE;
private int micPosition = Integer.MIN_VALUE;
private int posState = -1;