feat:完成小时榜功能
This commit is contained in:
@@ -116,6 +116,7 @@ import com.netease.nimlib.sdk.StatusCode
|
|||||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder
|
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||||
|
import com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||||
import com.orhanobut.logger.Logger
|
import com.orhanobut.logger.Logger
|
||||||
import com.tbruyelle.rxpermissions2.RxPermissions
|
import com.tbruyelle.rxpermissions2.RxPermissions
|
||||||
import com.trello.rxlifecycle3.android.FragmentEvent
|
import com.trello.rxlifecycle3.android.FragmentEvent
|
||||||
@@ -250,6 +251,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
openOrCloseGiftValue(true)
|
openOrCloseGiftValue(true)
|
||||||
updateView()
|
updateView()
|
||||||
updateMicBtn()
|
updateMicBtn()
|
||||||
|
refreshHourRank()
|
||||||
microView.setOnMicroItemClickListener(this)
|
microView.setOnMicroItemClickListener(this)
|
||||||
mDisposable = IMNetEaseManager.get().chatRoomEventObservable
|
mDisposable = IMNetEaseManager.get().chatRoomEventObservable
|
||||||
.subscribe { onReceiveRoomEvent(it) }
|
.subscribe { onReceiveRoomEvent(it) }
|
||||||
@@ -285,7 +287,11 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
ivRadishEntrance?.isVisible = GoldBoxHelper.isShowRadish()
|
ivRadishEntrance?.isVisible = GoldBoxHelper.isShowRadish()
|
||||||
if (ivRadishEntrance != null && GoldBoxHelper.isShowRadish()) {
|
if (ivRadishEntrance != null && GoldBoxHelper.isShowRadish()) {
|
||||||
StatisticManager.Instance()
|
StatisticManager.Instance()
|
||||||
.onEvent(StatisticsProtocol.EVENT_ROOM_POP_SHOW, "房间pop曝光", mapOf("name" to "星际探索"))
|
.onEvent(
|
||||||
|
StatisticsProtocol.EVENT_ROOM_POP_SHOW,
|
||||||
|
"房间pop曝光",
|
||||||
|
mapOf("name" to "星际探索")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
initWishListPager()
|
initWishListPager()
|
||||||
}
|
}
|
||||||
@@ -305,18 +311,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
GiftValueMrg.get().handleReconnect(false)
|
GiftValueMrg.get().handleReconnect(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ROOM_EXIT -> {
|
RoomEvent.ROOM_EXIT -> {
|
||||||
// 退出房间,把标志置为 false
|
// 退出房间,把标志置为 false
|
||||||
AvRoomDataManager.get().isFromMentoring = false
|
AvRoomDataManager.get().isFromMentoring = false
|
||||||
// 退出房间的时候,要停止倒计时
|
// 退出房间的时候,要停止倒计时
|
||||||
EventBus.getDefault().post(MentoringStopCountingEvent())
|
EventBus.getDefault().post(MentoringStopCountingEvent())
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.DOWN_CROWDED_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
RoomEvent.DOWN_CROWDED_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||||
toast(R.string.crowded_down)
|
toast(R.string.crowded_down)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ROOM_MANAGER_ADD, RoomEvent.ROOM_MANAGER_REMOVE -> {
|
RoomEvent.ROOM_MANAGER_ADD, RoomEvent.ROOM_MANAGER_REMOVE -> {
|
||||||
updateView()
|
updateView()
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ROOM_INFO_UPDATE -> {
|
RoomEvent.ROOM_INFO_UPDATE -> {
|
||||||
Logger.i("房间更新事件")
|
Logger.i("房间更新事件")
|
||||||
addOpenDatingTips() //一定要放在updateView之前!!!
|
addOpenDatingTips() //一定要放在updateView之前!!!
|
||||||
@@ -325,19 +335,24 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
updateView()
|
updateView()
|
||||||
updateRemoteMuteBtn()
|
updateRemoteMuteBtn()
|
||||||
openOrCloseGiftValue(false)
|
openOrCloseGiftValue(false)
|
||||||
|
refreshHourRank()
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ENTER_ROOM -> {
|
RoomEvent.ENTER_ROOM -> {
|
||||||
Logger.i("进入房间事件")
|
Logger.i("进入房间事件")
|
||||||
updateView()
|
updateView()
|
||||||
updateRemoteMuteBtn()
|
updateRemoteMuteBtn()
|
||||||
openOrCloseGiftValue(true)
|
openOrCloseGiftValue(true)
|
||||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||||
|
refreshHourRank()
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
||||||
RoomEvent.MIC_QUEUE_STATE_CHANGE -> onQueueMicStateChange(
|
RoomEvent.MIC_QUEUE_STATE_CHANGE -> onQueueMicStateChange(
|
||||||
roomEvent.micPosition,
|
roomEvent.micPosition,
|
||||||
roomEvent.posState
|
roomEvent.posState
|
||||||
)
|
)
|
||||||
|
|
||||||
RoomEvent.KICK_DOWN_MIC_BY_S_ADMIN, RoomEvent.KICK_DOWN_MIC -> if (event == RoomEvent.KICK_DOWN_MIC) {
|
RoomEvent.KICK_DOWN_MIC_BY_S_ADMIN, RoomEvent.KICK_DOWN_MIC -> if (event == RoomEvent.KICK_DOWN_MIC) {
|
||||||
SingleToastUtil.showToast(
|
SingleToastUtil.showToast(
|
||||||
mContext.resources.getString(
|
mContext.resources.getString(
|
||||||
@@ -351,16 +366,20 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.DOWN_MIC -> {
|
RoomEvent.DOWN_MIC -> {
|
||||||
onDownMicro(roomEvent.micPosition)
|
onDownMicro(roomEvent.micPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.UP_MIC -> {
|
RoomEvent.UP_MIC -> {
|
||||||
onUpMicro(roomEvent.micPosition)
|
onUpMicro(roomEvent.micPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.INVITE_UP_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
RoomEvent.INVITE_UP_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||||
//自己的消息
|
//自己的消息
|
||||||
onInviteUpMic(roomEvent.micPosition)
|
onInviteUpMic(roomEvent.micPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.KICK_OUT_ROOM -> {
|
RoomEvent.KICK_OUT_ROOM -> {
|
||||||
val reason = roomEvent.reason
|
val reason = roomEvent.reason
|
||||||
if (reason != null && reason.reason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
if (reason != null && reason.reason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
||||||
@@ -378,8 +397,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
AvRoomDataManager.get().removeChatRoomMember(targetUid)
|
AvRoomDataManager.get().removeChatRoomMember(targetUid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomEvent.LEAVE_MODE -> microView.adapter.notifyDataSetChanged()
|
RoomEvent.LEAVE_MODE -> microView.adapter.notifyDataSetChanged()
|
||||||
RoomEvent.ROOM_CLEAN_SCREEN -> messageView.clear()
|
RoomEvent.ROOM_CLEAN_SCREEN -> messageView.clear()
|
||||||
|
RoomEvent.ROOM_HOUR_RANK -> refreshHourRank()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +551,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
rootView.setOnClickListener {
|
rootView.setOnClickListener {
|
||||||
WishListPanelDialog.newInstance().show(mContext)
|
WishListPanelDialog.newInstance().show(mContext)
|
||||||
StatisticManager.Instance()
|
StatisticManager.Instance()
|
||||||
.onEvent(StatisticsProtocol.EVENT_WISHLIST_POP_CLICK, "礼物心愿气泡点击")
|
.onEvent(
|
||||||
|
StatisticsProtocol.EVENT_WISHLIST_POP_CLICK,
|
||||||
|
"礼物心愿气泡点击"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return rootView
|
return rootView
|
||||||
}
|
}
|
||||||
@@ -759,12 +783,14 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
.onEvent(StatisticsProtocol.EVENT_ROOM_CHAT_CLICK, "语音房_公屏发言")
|
.onEvent(StatisticsProtocol.EVENT_ROOM_CHAT_CLICK, "语音房_公屏发言")
|
||||||
sendMsg()
|
sendMsg()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.contribute_list -> {
|
R.id.contribute_list -> {
|
||||||
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
||||||
StatisticManager.Instance()
|
StatisticManager.Instance()
|
||||||
.onEvent(StatisticsProtocol.EVENT_MP_ROOM_RANKING_LIST_CLICK, "房间榜")
|
.onEvent(StatisticsProtocol.EVENT_MP_ROOM_RANKING_LIST_CLICK, "房间榜")
|
||||||
mvpPresenter?.loadRoomRank()
|
mvpPresenter?.loadRoomRank()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1315,6 +1341,24 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
|||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新房间小时榜
|
||||||
|
*/
|
||||||
|
protected open fun refreshHourRank() {
|
||||||
|
val data = AvRoomDataManager.get().hourRankInfo
|
||||||
|
val widget = view?.findViewById<View>(R.id.hourRankWidget) as? RoomHourRankWidget ?: return
|
||||||
|
when (AvRoomDataManager.get().mCurrentRoomInfo?.isPermitRoom) {
|
||||||
|
1, 4 -> {
|
||||||
|
widget.loadData(data)
|
||||||
|
widget.isVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
widget.isVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 底部按钮点击处理
|
* 底部按钮点击处理
|
||||||
*/
|
*/
|
||||||
|
@@ -656,14 +656,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
|||||||
getMvpPresenter().cancelDragon();
|
getMvpPresenter().cancelDragon();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case R.id.tv_hour_rank:
|
|
||||||
DialogWebViewActivity.start(
|
|
||||||
mContext,
|
|
||||||
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().getRoomUid())
|
|
||||||
);
|
|
||||||
StatisticManager.Instance()
|
|
||||||
.onEvent(StatisticsProtocol.EVENT_ROOM_RANKLIST_CLICK, "房间小时榜点击");
|
|
||||||
break;
|
|
||||||
case R.id.tv_notice_board:
|
case R.id.tv_notice_board:
|
||||||
onRoomSettingsClick();
|
onRoomSettingsClick();
|
||||||
break;
|
break;
|
||||||
|
@@ -133,15 +133,6 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
|||||||
.subscribe()
|
.subscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameBinding.tvHourRank.setOnClickListener {
|
|
||||||
DialogWebViewActivity.start(
|
|
||||||
mContext,
|
|
||||||
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
|
||||||
)
|
|
||||||
StatisticManager.Instance()
|
|
||||||
.onEvent(StatisticsProtocol.EVENT_ROOM_RANKLIST_CLICK, "房间小时榜点击")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
|
@@ -0,0 +1,122 @@
|
|||||||
|
package com.nnbc123.app.avroom.hour_rank
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.chuhai.utils.ktx.getColorById
|
||||||
|
import com.chuhai.utils.ktx.singleClick
|
||||||
|
import com.chuhai.utils.log.ILog
|
||||||
|
import com.chuhai.utils.spannable.SpannableTextBuilder
|
||||||
|
import com.nnbc123.app.R
|
||||||
|
import com.nnbc123.app.databinding.RoomHourRankingWidgetBinding
|
||||||
|
import com.nnbc123.app.ui.webview.DialogWebViewActivity
|
||||||
|
import com.nnbc123.core.UriProvider
|
||||||
|
import com.nnbc123.core.manager.AvRoomDataManager
|
||||||
|
import com.nnbc123.core.room.bean.RoomHourRankInfo
|
||||||
|
import com.nnbc123.core.statistic.StatisticManager
|
||||||
|
import com.nnbc123.core.statistic.protocol.StatisticsProtocol
|
||||||
|
import com.nnbc123.library.utils.FormatUtils
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/11/7 11:48
|
||||||
|
* Desc:小时榜组件
|
||||||
|
**/
|
||||||
|
class RoomHourRankWidget : FrameLayout, ILog {
|
||||||
|
|
||||||
|
private val binding: RoomHourRankingWidgetBinding =
|
||||||
|
DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(
|
||||||
|
context
|
||||||
|
), R.layout.room_hour_ranking_widget, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
private var inAnimation: Animation? = null
|
||||||
|
private var outAnimation: Animation? = null
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
|
context,
|
||||||
|
attrs,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet?,
|
||||||
|
defStyleAttr: Int,
|
||||||
|
defStyleRes: Int
|
||||||
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
inAnimation = binding.viewFlipper.inAnimation
|
||||||
|
outAnimation = binding.viewFlipper.outAnimation
|
||||||
|
singleClick {
|
||||||
|
DialogWebViewActivity.start(
|
||||||
|
context,
|
||||||
|
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||||
|
)
|
||||||
|
StatisticManager.Instance()
|
||||||
|
.onEvent(StatisticsProtocol.EVENT_ROOM_RANKLIST_CLICK, "房间小时榜点击")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadData(data: RoomHourRankInfo?) {
|
||||||
|
val rank = data?.rank ?: 0
|
||||||
|
val diff = data?.diffValue ?: 0
|
||||||
|
updateRanking(rank)
|
||||||
|
updateDiff(diff)
|
||||||
|
if (rank <= 1 || rank > 30) {
|
||||||
|
// 不需要轮播
|
||||||
|
binding.viewFlipper.inAnimation = null
|
||||||
|
binding.viewFlipper.outAnimation = null
|
||||||
|
binding.viewFlipper.isAutoStart = false
|
||||||
|
binding.viewFlipper.stopFlipping()
|
||||||
|
binding.viewFlipper.displayedChild = 0
|
||||||
|
} else {
|
||||||
|
if (binding.viewFlipper.inAnimation == null) {
|
||||||
|
binding.viewFlipper.inAnimation = inAnimation
|
||||||
|
}
|
||||||
|
if (binding.viewFlipper.outAnimation == null) {
|
||||||
|
binding.viewFlipper.outAnimation = outAnimation
|
||||||
|
}
|
||||||
|
binding.viewFlipper.isAutoStart = true
|
||||||
|
binding.viewFlipper.startFlipping()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateRanking(rank: Long) {
|
||||||
|
if (rank <= 0) {
|
||||||
|
binding.tvRank.text = "小时榜"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (rank > 30) {
|
||||||
|
binding.tvRank.text = "暂未上榜"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
SpannableTextBuilder(binding.tvRank).appendText(
|
||||||
|
"小时榜 第 ",
|
||||||
|
textColor = context.getColorById(R.color.white)
|
||||||
|
).appendText(
|
||||||
|
rank.toString(),
|
||||||
|
textColor = context.getColorById(R.color.color_FFF265)
|
||||||
|
).appendText(
|
||||||
|
" 名",
|
||||||
|
textColor = context.getColorById(R.color.white)
|
||||||
|
).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateDiff(diff: Long) {
|
||||||
|
val value = FormatUtils.formatUnit(diff, 10000, "w")
|
||||||
|
SpannableTextBuilder(binding.tvDiff).appendText(
|
||||||
|
"距上一名差 ",
|
||||||
|
textColor = context.getColorById(R.color.white)
|
||||||
|
).appendText(
|
||||||
|
value,
|
||||||
|
textColor = context.getColorById(R.color.color_FFF265)
|
||||||
|
).apply()
|
||||||
|
}
|
||||||
|
}
|
@@ -37,7 +37,7 @@ class HomeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
R.id.iv_my_room -> {
|
R.id.iv_my_room -> {
|
||||||
StatisticManager.Instance()
|
StatisticManager.Instance()
|
||||||
.onEvent(StatisticsProtocol.EVENT_HOME_MY_ROOM_CLICK, "首页_我的房间")
|
.onEvent(StatisticsProtocol.EVENT_HOME_MY_ROOM_CLICK, "首页_我的房间")
|
||||||
OpenRoomHelper.openHomePartyRoom(baseActivity)
|
OpenRoomHelper.openRoom(baseActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -415,7 +415,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
"个人中心充值卡片点击"
|
"个人中心充值卡片点击"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.me_item_room -> OpenRoomHelper.openHomePartyRoom(requireActivity() as BaseActivity)
|
R.id.me_item_room -> OpenRoomHelper.openRoom(requireActivity() as BaseActivity)
|
||||||
R.id.me_item_level -> CommonWebViewActivity.start(
|
R.id.me_item_level -> CommonWebViewActivity.start(
|
||||||
mContext,
|
mContext,
|
||||||
UriProvider.getUserLevelUrl()
|
UriProvider.getUserLevelUrl()
|
||||||
|
@@ -286,7 +286,7 @@ public class RouterHandler {
|
|||||||
case RouterType.MY_ROOM:
|
case RouterType.MY_ROOM:
|
||||||
//我的房间,开房
|
//我的房间,开房
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ME_INTO_MY_ROOM_CLICK, "我页_进入我的房间");
|
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ME_INTO_MY_ROOM_CLICK, "我页_进入我的房间");
|
||||||
OpenRoomHelper.openHomePartyRoom((BaseActivity) context);
|
OpenRoomHelper.openRoom((BaseActivity) context);
|
||||||
break;
|
break;
|
||||||
case RouterType.COLLECTION_ROOM:
|
case RouterType.COLLECTION_ROOM:
|
||||||
//收藏的房间
|
//收藏的房间
|
||||||
|
BIN
app/src/main/res/drawable-xxhdpi/room_hour_ranking_ic_crown.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/room_hour_ranking_ic_crown.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
8
app/src/main/res/drawable/room_hour_ranking_bg.xml
Normal file
8
app/src/main/res/drawable/room_hour_ranking_bg.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<gradient
|
||||||
|
android:endColor="#00FFFDA1"
|
||||||
|
android:startColor="#33FFC926" />
|
||||||
|
</shape>
|
58
app/src/main/res/layout/room_hour_ranking_widget.xml
Normal file
58
app/src/main/res/layout/room_hour_ranking_widget.xml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout>
|
||||||
|
|
||||||
|
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/viewFlipper"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:autoStart="true"
|
||||||
|
android:flipInterval="3000"
|
||||||
|
android:inAnimation="@anim/anim_bottom_in"
|
||||||
|
android:outAnimation="@anim/anim_top_out">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/room_hour_ranking_bg"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingEnd="8dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/room_hour_ranking_ic_crown" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_rank"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="9dp"
|
||||||
|
tools:text="小时榜 第 1 名" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/room_hour_ranking_bg"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingEnd="8dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/room_hour_ranking_ic_crown" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diff"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="9dp"
|
||||||
|
tools:text="距上一名差 0" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ViewFlipper>
|
||||||
|
</layout>
|
@@ -628,5 +628,6 @@
|
|||||||
<color name="color_FFFDF5">#FFFDF5</color>
|
<color name="color_FFFDF5">#FFFDF5</color>
|
||||||
<color name="color_FFD46C">#FFD46C</color>
|
<color name="color_FFD46C">#FFD46C</color>
|
||||||
<color name="color_695CEB">#695CEB</color>
|
<color name="color_695CEB">#695CEB</color>
|
||||||
|
<color name="color_FFF265">#FFFFF265</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -60,33 +60,21 @@
|
|||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||||
android:id="@+id/tv_hour_rank"
|
android:id="@+id/hourRankWidget"
|
||||||
android:layout_width="57dp"
|
|
||||||
android:layout_height="22dp"
|
|
||||||
android:layout_below="@id/tv_notice_board"
|
android:layout_below="@id/tv_notice_board"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp" />
|
||||||
android:background="@drawable/shape_white_alpha_10_radius_100"
|
|
||||||
android:drawableStart="@drawable/ic_single_room_rank"
|
|
||||||
android:drawablePadding="3dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:lines="1"
|
|
||||||
android:onClick="@{click}"
|
|
||||||
android:paddingStart="6dp"
|
|
||||||
android:text="小时榜"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="10dp"
|
|
||||||
android:visibility="visible" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_music_flag"
|
android:id="@+id/iv_music_flag"
|
||||||
android:layout_width="22dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="22dp"
|
||||||
android:layout_alignTop="@id/tv_hour_rank"
|
android:layout_alignTop="@id/hourRankWidget"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:layout_toEndOf="@id/tv_hour_rank"
|
android:layout_toEndOf="@id/hourRankWidget"
|
||||||
android:src="@drawable/icon_music_flag"
|
android:src="@drawable/icon_music_flag"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@@ -94,7 +82,7 @@
|
|||||||
android:id="@+id/ll_room_pk_order"
|
android:id="@+id/ll_room_pk_order"
|
||||||
android:layout_width="52dp"
|
android:layout_width="52dp"
|
||||||
android:layout_height="52dp"
|
android:layout_height="52dp"
|
||||||
android:layout_below="@id/tv_hour_rank"
|
android:layout_below="@id/hourRankWidget"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:background="@drawable/bg_room_pk_order"
|
android:background="@drawable/bg_room_pk_order"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@@ -385,7 +373,7 @@
|
|||||||
android:id="@+id/vs_music_player"
|
android:id="@+id/vs_music_player"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@id/tv_hour_rank"
|
android:layout_below="@id/hourRankWidget"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout="@layout/avroom_music_player_layout" />
|
android:layout="@layout/avroom_music_player_layout" />
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@
|
|||||||
android:id="@+id/ll_room_pk_order"
|
android:id="@+id/ll_room_pk_order"
|
||||||
android:layout_width="52dp"
|
android:layout_width="52dp"
|
||||||
android:layout_height="52dp"
|
android:layout_height="52dp"
|
||||||
android:layout_below="@id/tv_hour_rank"
|
android:layout_below="@id/hourRankWidget"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:background="@drawable/bg_room_pk_match_order"
|
android:background="@drawable/bg_room_pk_match_order"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@@ -161,24 +161,14 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||||
<TextView
|
android:id="@+id/hourRankWidget"
|
||||||
android:id="@+id/tv_hour_rank"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="22dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:background="@drawable/bg_single_room_rank_entrance"
|
|
||||||
android:drawableStart="@drawable/ic_single_room_rank"
|
|
||||||
android:drawablePadding="3dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:paddingEnd="6dp"
|
|
||||||
android:text="小时榜"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="10dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/contribute_list" />
|
app:layout_constraintTop_toTopOf="@id/contribute_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="6dp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_music_flag"
|
android:id="@+id/iv_music_flag"
|
||||||
@@ -187,8 +177,8 @@
|
|||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:src="@drawable/icon_music_flag"
|
android:src="@drawable/icon_music_flag"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintStart_toEndOf="@id/tv_hour_rank"
|
app:layout_constraintStart_toEndOf="@id/hourRankWidget"
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_hour_rank" />
|
app:layout_constraintTop_toTopOf="@id/hourRankWidget" />
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@@ -70,11 +70,9 @@ import com.nnbc123.core.decoration.headwear.bean.HeadWearInfo;
|
|||||||
import com.nnbc123.core.exception.ErrorThrowable;
|
import com.nnbc123.core.exception.ErrorThrowable;
|
||||||
import com.nnbc123.core.family.bean.FamilyInfo;
|
import com.nnbc123.core.family.bean.FamilyInfo;
|
||||||
import com.nnbc123.core.family.event.FamilyMineEvent;
|
import com.nnbc123.core.family.event.FamilyMineEvent;
|
||||||
import com.nnbc123.core.game.event.GameInviteEvent;
|
|
||||||
import com.nnbc123.core.gift.GiftModel;
|
import com.nnbc123.core.gift.GiftModel;
|
||||||
import com.nnbc123.core.gift.bean.GiftInfo;
|
import com.nnbc123.core.gift.bean.GiftInfo;
|
||||||
import com.nnbc123.core.helper.AtProxy;
|
import com.nnbc123.core.helper.AtProxy;
|
||||||
import com.nnbc123.core.home.bean.OrderRecordBean;
|
|
||||||
import com.nnbc123.core.im.custom.bean.ActivityTimerAttachment;
|
import com.nnbc123.core.im.custom.bean.ActivityTimerAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.AssistantAttachment;
|
import com.nnbc123.core.im.custom.bean.AssistantAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.CarAttachment;
|
import com.nnbc123.core.im.custom.bean.CarAttachment;
|
||||||
@@ -101,6 +99,7 @@ import com.nnbc123.core.im.custom.bean.MusicInfoAttachment;
|
|||||||
import com.nnbc123.core.im.custom.bean.NobleAttachment;
|
import com.nnbc123.core.im.custom.bean.NobleAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.RoomBoxPrizeAttachment;
|
import com.nnbc123.core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.RoomGiftValueAttachment;
|
import com.nnbc123.core.im.custom.bean.RoomGiftValueAttachment;
|
||||||
|
import com.nnbc123.core.im.custom.bean.RoomHourRankAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.RoomInfoAttachment;
|
import com.nnbc123.core.im.custom.bean.RoomInfoAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.RoomPKAttachment;
|
import com.nnbc123.core.im.custom.bean.RoomPKAttachment;
|
||||||
import com.nnbc123.core.im.custom.bean.RoomPkBean;
|
import com.nnbc123.core.im.custom.bean.RoomPkBean;
|
||||||
@@ -1433,6 +1432,17 @@ public final class IMNetEaseManager {
|
|||||||
addMessages(msg);
|
addMessages(msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_MSG_HOUR_RANK:
|
||||||
|
if (customAttachment.getSecond() == CUSTOM_MSG_HOUR_RANK_UPDATE) {
|
||||||
|
if (attachment instanceof RoomHourRankAttachment) {
|
||||||
|
RoomHourRankAttachment hourRankAttachment = (RoomHourRankAttachment) attachment;
|
||||||
|
// 更新本地信息
|
||||||
|
AvRoomDataManager.get().hourRankInfo = hourRankAttachment.toRoomHourRankingInfo();
|
||||||
|
getChatRoomEventObservable()
|
||||||
|
.onNext(new RoomEvent()
|
||||||
|
.setEvent(RoomEvent.ROOM_HOUR_RANK));
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER
|
|||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC;
|
||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP;
|
||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEAD_SHIFT_OUT;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEAD_SHIFT_OUT;
|
||||||
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HOUR_RANK;
|
||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_TIP;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_TIP;
|
||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KITCHEN;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KITCHEN;
|
||||||
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KTV;
|
import static com.nnbc123.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KTV;
|
||||||
@@ -608,6 +609,11 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
|||||||
case CUSTOM_MSG_KITCHEN:
|
case CUSTOM_MSG_KITCHEN:
|
||||||
attachment = new RoomKitchenAttachment(first, second);
|
attachment = new RoomKitchenAttachment(first, second);
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_MSG_HOUR_RANK:
|
||||||
|
if (second == CustomAttachment.CUSTOM_MSG_HOUR_RANK_UPDATE) {
|
||||||
|
attachment = new RoomHourRankAttachment(first, second);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CUSTOM_MSG_PRIVILEGE:
|
case CUSTOM_MSG_PRIVILEGE:
|
||||||
attachment = new RoomPrivilegeAttachment(first, second);
|
attachment = new RoomPrivilegeAttachment(first, second);
|
||||||
break;
|
break;
|
||||||
|
@@ -434,6 +434,9 @@ public class CustomAttachment implements MsgAttachment {
|
|||||||
public static final int CUSTOM_MSG_SUB_KITCHEN_ALL_ROOM = 961; // 深海奇缘礼物房间飘屏通知(动态)
|
public static final int CUSTOM_MSG_SUB_KITCHEN_ALL_ROOM = 961; // 深海奇缘礼物房间飘屏通知(动态)
|
||||||
public static final int CUSTOM_MSG_SUB_kitchen_ALL_APP = 962; // 深海奇缘礼物全服飘屏通知
|
public static final int CUSTOM_MSG_SUB_kitchen_ALL_APP = 962; // 深海奇缘礼物全服飘屏通知
|
||||||
|
|
||||||
|
public static final int CUSTOM_MSG_HOUR_RANK = 97; // 小时榜
|
||||||
|
public static final int CUSTOM_MSG_HOUR_RANK_UPDATE = 971; // 小时榜更新
|
||||||
|
|
||||||
public static final int CUSTOM_MSG_PRIVILEGE = 102; //特权卡
|
public static final int CUSTOM_MSG_PRIVILEGE = 102; //特权卡
|
||||||
public static final int CUSTOM_MSG_PRIVILEGE_SECOND = 1020;//特权卡
|
public static final int CUSTOM_MSG_PRIVILEGE_SECOND = 1020;//特权卡
|
||||||
|
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
package com.nnbc123.core.im.custom.bean
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.nnbc123.core.room.bean.RoomHourRankInfo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/11/7 11:30
|
||||||
|
* Desc:小时榜
|
||||||
|
**/
|
||||||
|
class RoomHourRankAttachment(first: Int, second: Int) : CustomAttachment(first, second) {
|
||||||
|
|
||||||
|
var roomUid: Long? = null
|
||||||
|
var rank: Long? = null
|
||||||
|
var diffValue: Long? = null
|
||||||
|
|
||||||
|
fun toRoomHourRankingInfo(): RoomHourRankInfo {
|
||||||
|
return RoomHourRankInfo(roomUid, rank, diffValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun parseData(data: JSONObject?) {
|
||||||
|
super.parseData(data)
|
||||||
|
if (data == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.containsKey("roomUid")) {
|
||||||
|
this.roomUid = data.getLong("roomUid")
|
||||||
|
}
|
||||||
|
if (data.containsKey("rank")) {
|
||||||
|
this.rank = data.getLong("rank")
|
||||||
|
}
|
||||||
|
if (data.containsKey("diffValue")) {
|
||||||
|
this.diffValue = data.getLong("diffValue")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.nnbc123.core.room.bean.RoomHourRankInfo;
|
||||||
import com.nnbc123.core.room.wishlist.WishItemInfo;
|
import com.nnbc123.core.room.wishlist.WishItemInfo;
|
||||||
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
||||||
import com.netease.nimlib.sdk.RequestCallback;
|
import com.netease.nimlib.sdk.RequestCallback;
|
||||||
@@ -108,6 +109,8 @@ public final class AvRoomDataManager {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public RoomInfo mCurrentRoomInfo;
|
public RoomInfo mCurrentRoomInfo;
|
||||||
public BoxSwitchVo mBoxSwitchVo;
|
public BoxSwitchVo mBoxSwitchVo;
|
||||||
|
// 小时榜
|
||||||
|
public RoomHourRankInfo hourRankInfo;
|
||||||
public EnterChatRoomResultData mEnterChatRoomResultData;
|
public EnterChatRoomResultData mEnterChatRoomResultData;
|
||||||
/**
|
/**
|
||||||
* 房间创建者
|
* 房间创建者
|
||||||
@@ -285,6 +288,7 @@ public final class AvRoomDataManager {
|
|||||||
public void updateServiceRoomInfo(RoomInfo roomInfo) {
|
public void updateServiceRoomInfo(RoomInfo roomInfo) {
|
||||||
//我们自己服务端信息
|
//我们自己服务端信息
|
||||||
mCurrentRoomInfo = roomInfo;
|
mCurrentRoomInfo = roomInfo;
|
||||||
|
hourRankInfo = roomInfo.getHourRank();
|
||||||
mBoxSwitchVo = roomInfo.boxSwitchVo;
|
mBoxSwitchVo = roomInfo.boxSwitchVo;
|
||||||
phrases = roomInfo.getSpeakTemplate();
|
phrases = roomInfo.getSpeakTemplate();
|
||||||
nick = roomInfo.getNick();
|
nick = roomInfo.getNick();
|
||||||
@@ -396,6 +400,7 @@ public final class AvRoomDataManager {
|
|||||||
if (mCurrentRoomInfo != null) {
|
if (mCurrentRoomInfo != null) {
|
||||||
mCurrentRoomInfo = null;
|
mCurrentRoomInfo = null;
|
||||||
}
|
}
|
||||||
|
hourRankInfo = null;
|
||||||
haveSelfChange = false;
|
haveSelfChange = false;
|
||||||
GiftValueMrg.get().clearObsever();
|
GiftValueMrg.get().clearObsever();
|
||||||
mMicQueueMemberMap.clear();
|
mMicQueueMemberMap.clear();
|
||||||
|
@@ -257,6 +257,9 @@ public class RoomEvent {
|
|||||||
|
|
||||||
public static final int ROOM_PRIVILEGE = 102;
|
public static final int ROOM_PRIVILEGE = 102;
|
||||||
|
|
||||||
|
// 小时榜更新
|
||||||
|
public static final int ROOM_HOUR_RANK = 103;
|
||||||
|
|
||||||
private int event = NONE;
|
private int event = NONE;
|
||||||
private int micPosition = Integer.MIN_VALUE;
|
private int micPosition = Integer.MIN_VALUE;
|
||||||
private int posState = -1;
|
private int posState = -1;
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
package com.nnbc123.core.room.bean
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/11/7 14:37
|
||||||
|
* Desc:房间小时榜
|
||||||
|
**/
|
||||||
|
data class RoomHourRankInfo(
|
||||||
|
var roomUid: Long? = null,
|
||||||
|
var rank: Long? = null,
|
||||||
|
var diffValue: Long? = null
|
||||||
|
) : Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readValue(Long::class.java.classLoader) as? Long,
|
||||||
|
parcel.readValue(Long::class.java.classLoader) as? Long,
|
||||||
|
parcel.readValue(Long::class.java.classLoader) as? Long
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeToParcel(p0: Parcel?, p1: Int) {
|
||||||
|
p0?.writeLong(roomUid ?: 0)
|
||||||
|
p0?.writeLong(rank ?: 0)
|
||||||
|
p0?.writeLong(diffValue ?: 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<RoomHourRankInfo> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): RoomHourRankInfo {
|
||||||
|
return RoomHourRankInfo(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<RoomHourRankInfo?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -95,7 +95,7 @@ public class RoomInfo implements Parcelable, Serializable {
|
|||||||
* {@link RoomModeType}
|
* {@link RoomModeType}
|
||||||
*/
|
*/
|
||||||
private int roomModeType;
|
private int roomModeType;
|
||||||
private int isPermitRoom; // 1:牌照房, 3:新秀房,其他:普通房
|
private int isPermitRoom; // 1:牌照房, 2非牌照房, 3:新秀房, 4:个播
|
||||||
/**
|
/**
|
||||||
* 是否为房间纯净模式
|
* 是否为房间纯净模式
|
||||||
*/
|
*/
|
||||||
@@ -163,6 +163,7 @@ public class RoomInfo implements Parcelable, Serializable {
|
|||||||
isRoomFans = in.readByte() != 0;
|
isRoomFans = in.readByte() != 0;
|
||||||
background = in.readParcelable(BackgroundBean.class.getClassLoader());
|
background = in.readParcelable(BackgroundBean.class.getClassLoader());
|
||||||
roomBackground = in.readParcelable(RoomBackgroundBean.class.getClassLoader());
|
roomBackground = in.readParcelable(RoomBackgroundBean.class.getClassLoader());
|
||||||
|
hourRank = in.readParcelable(RoomHourRankInfo.class.getClassLoader());
|
||||||
hasKTVPriv = in.readByte() != 0;
|
hasKTVPriv = in.readByte() != 0;
|
||||||
isOpenKTV = in.readByte() != 0;
|
isOpenKTV = in.readByte() != 0;
|
||||||
isOpenGame = in.readByte() != 0;
|
isOpenGame = in.readByte() != 0;
|
||||||
@@ -228,6 +229,7 @@ public class RoomInfo implements Parcelable, Serializable {
|
|||||||
dest.writeByte((byte) (isRoomFans ? 1 : 0));
|
dest.writeByte((byte) (isRoomFans ? 1 : 0));
|
||||||
dest.writeParcelable(background, flags);
|
dest.writeParcelable(background, flags);
|
||||||
dest.writeParcelable(roomBackground, flags);
|
dest.writeParcelable(roomBackground, flags);
|
||||||
|
dest.writeParcelable(hourRank, flags);
|
||||||
dest.writeByte((byte) (hasKTVPriv ? 1 : 0));
|
dest.writeByte((byte) (hasKTVPriv ? 1 : 0));
|
||||||
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
|
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
|
||||||
dest.writeByte((byte) (isOpenGame ? 1 : 0));
|
dest.writeByte((byte) (isOpenGame ? 1 : 0));
|
||||||
@@ -287,6 +289,8 @@ public class RoomInfo implements Parcelable, Serializable {
|
|||||||
return "牌照房";
|
return "牌照房";
|
||||||
} else if (isPermitRoom == 3) {
|
} else if (isPermitRoom == 3) {
|
||||||
return "新秀房";
|
return "新秀房";
|
||||||
|
} else if (isPermitRoom == 4) {
|
||||||
|
return "个播房";
|
||||||
}
|
}
|
||||||
return "普通房";
|
return "普通房";
|
||||||
}
|
}
|
||||||
@@ -323,8 +327,17 @@ public class RoomInfo implements Parcelable, Serializable {
|
|||||||
private String mgName;
|
private String mgName;
|
||||||
private int mgMicNum;
|
private int mgMicNum;
|
||||||
private long clearScreenTime;
|
private long clearScreenTime;
|
||||||
|
private RoomHourRankInfo hourRank;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="delombok">
|
public RoomHourRankInfo getHourRank() {
|
||||||
|
return hourRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHourRank(RoomHourRankInfo hourRank) {
|
||||||
|
this.hourRank = hourRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="delombok">
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
// /**
|
// /**
|
||||||
// * 房间角标
|
// * 房间角标
|
||||||
|
@@ -110,11 +110,11 @@ public class FormatUtils {
|
|||||||
|
|
||||||
//PK值相关格式化方式,统一方法,方便以后更改样式
|
//PK值相关格式化方式,统一方法,方便以后更改样式
|
||||||
public static String formatPKValue(long value) {
|
public static String formatPKValue(long value) {
|
||||||
// if (value >= 1000000) return (value / 100) / 100f + "万";
|
// if (value >= 1000000) return (value / 100) / 100f + "万";
|
||||||
return String.valueOf(value);
|
return String.valueOf(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatRankValue(int goldAmount){
|
public static String formatRankValue(int goldAmount) {
|
||||||
String strGoldAmount;
|
String strGoldAmount;
|
||||||
if (goldAmount >= 10000) {
|
if (goldAmount >= 10000) {
|
||||||
BigDecimal b = BigDecimal.valueOf(goldAmount / 10000.0);
|
BigDecimal b = BigDecimal.valueOf(goldAmount / 10000.0);
|
||||||
@@ -126,4 +126,29 @@ public class FormatUtils {
|
|||||||
return strGoldAmount;
|
return strGoldAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超过单位值后,返回转换后的数值,否则返回原数值
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @param unitValue 单位值
|
||||||
|
* @param unitName 单位名称/后缀
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String formatUnit(long value, int unitValue, String unitName) {
|
||||||
|
try {
|
||||||
|
if (value >= unitValue) {
|
||||||
|
BigDecimal b = BigDecimal.valueOf(value * 1.0 / unitValue);
|
||||||
|
double df = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
if (unitName != null) {
|
||||||
|
return df + unitName;
|
||||||
|
} else {
|
||||||
|
return String.valueOf(df);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user