Merge branch 'v1.5.0/hour_ranking' into v1.5.0/test
This commit is contained in:
@@ -26,7 +26,6 @@ import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.nnbc123.core.Constants
|
||||
import com.nnbc123.core.DemoCache
|
||||
import com.nnbc123.core.UriProvider
|
||||
import com.nnbc123.core.auth.AuthModel
|
||||
import com.nnbc123.core.bean.RoomMicInfo
|
||||
import com.nnbc123.core.gift.GiftModel
|
||||
@@ -45,7 +44,6 @@ import com.nnbc123.core.music.event.MusicPlayingEvent
|
||||
import com.nnbc123.core.music.event.MusicStopEvent
|
||||
import com.nnbc123.core.room.anotherroompk.ShowGiftDialogEvent
|
||||
import com.nnbc123.core.room.anotherroompk.ShowUserInfoDialogEvent
|
||||
import com.nnbc123.core.room.bean.RoomContributeUserInfo
|
||||
import com.nnbc123.core.room.bean.RoomInfo
|
||||
import com.nnbc123.core.room.event.RoomAtEvent
|
||||
import com.nnbc123.core.room.event.RoomClearScreenEvent
|
||||
@@ -116,6 +114,7 @@ import com.netease.nimlib.sdk.StatusCode
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
import com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tbruyelle.rxpermissions2.RxPermissions
|
||||
import com.trello.rxlifecycle3.android.FragmentEvent
|
||||
@@ -250,6 +249,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
openOrCloseGiftValue(true)
|
||||
updateView()
|
||||
updateMicBtn()
|
||||
refreshHourRank()
|
||||
microView.setOnMicroItemClickListener(this)
|
||||
mDisposable = IMNetEaseManager.get().chatRoomEventObservable
|
||||
.subscribe { onReceiveRoomEvent(it) }
|
||||
@@ -285,7 +285,11 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
ivRadishEntrance?.isVisible = GoldBoxHelper.isShowRadish()
|
||||
if (ivRadishEntrance != null && GoldBoxHelper.isShowRadish()) {
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_ROOM_POP_SHOW, "房间pop曝光", mapOf("name" to "星际探索"))
|
||||
.onEvent(
|
||||
StatisticsProtocol.EVENT_ROOM_POP_SHOW,
|
||||
"房间pop曝光",
|
||||
mapOf("name" to "星际探索")
|
||||
)
|
||||
}
|
||||
initWishListPager()
|
||||
}
|
||||
@@ -305,18 +309,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
GiftValueMrg.get().handleReconnect(false)
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_EXIT -> {
|
||||
// 退出房间,把标志置为 false
|
||||
AvRoomDataManager.get().isFromMentoring = false
|
||||
// 退出房间的时候,要停止倒计时
|
||||
EventBus.getDefault().post(MentoringStopCountingEvent())
|
||||
}
|
||||
|
||||
RoomEvent.DOWN_CROWDED_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||
toast(R.string.crowded_down)
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_MANAGER_ADD, RoomEvent.ROOM_MANAGER_REMOVE -> {
|
||||
updateView()
|
||||
}
|
||||
|
||||
RoomEvent.ROOM_INFO_UPDATE -> {
|
||||
Logger.i("房间更新事件")
|
||||
addOpenDatingTips() //一定要放在updateView之前!!!
|
||||
@@ -325,19 +333,24 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
updateView()
|
||||
updateRemoteMuteBtn()
|
||||
openOrCloseGiftValue(false)
|
||||
refreshHourRank()
|
||||
}
|
||||
|
||||
RoomEvent.ENTER_ROOM -> {
|
||||
Logger.i("进入房间事件")
|
||||
updateView()
|
||||
updateRemoteMuteBtn()
|
||||
openOrCloseGiftValue(true)
|
||||
GiftValueMrg.get().updateRoomGiftValue(false)
|
||||
refreshHourRank()
|
||||
}
|
||||
|
||||
RoomEvent.ADD_BLACK_LIST -> onChatRoomMemberBlackAdd(roomEvent.account)
|
||||
RoomEvent.MIC_QUEUE_STATE_CHANGE -> onQueueMicStateChange(
|
||||
roomEvent.micPosition,
|
||||
roomEvent.posState
|
||||
)
|
||||
|
||||
RoomEvent.KICK_DOWN_MIC_BY_S_ADMIN, RoomEvent.KICK_DOWN_MIC -> if (event == RoomEvent.KICK_DOWN_MIC) {
|
||||
SingleToastUtil.showToast(
|
||||
mContext.resources.getString(
|
||||
@@ -351,16 +364,20 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.DOWN_MIC -> {
|
||||
onDownMicro(roomEvent.micPosition)
|
||||
}
|
||||
|
||||
RoomEvent.UP_MIC -> {
|
||||
onUpMicro(roomEvent.micPosition)
|
||||
}
|
||||
|
||||
RoomEvent.INVITE_UP_MIC -> if (AvRoomDataManager.get().isOwner(roomEvent.account)) {
|
||||
//自己的消息
|
||||
onInviteUpMic(roomEvent.micPosition)
|
||||
}
|
||||
|
||||
RoomEvent.KICK_OUT_ROOM -> {
|
||||
val reason = roomEvent.reason
|
||||
if (reason != null && reason.reason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
||||
@@ -378,8 +395,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
AvRoomDataManager.get().removeChatRoomMember(targetUid)
|
||||
}
|
||||
}
|
||||
|
||||
RoomEvent.LEAVE_MODE -> microView.adapter.notifyDataSetChanged()
|
||||
RoomEvent.ROOM_CLEAN_SCREEN -> messageView.clear()
|
||||
RoomEvent.ROOM_HOUR_RANK -> refreshHourRank()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +549,10 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
rootView.setOnClickListener {
|
||||
WishListPanelDialog.newInstance().show(mContext)
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_WISHLIST_POP_CLICK, "礼物心愿气泡点击")
|
||||
.onEvent(
|
||||
StatisticsProtocol.EVENT_WISHLIST_POP_CLICK,
|
||||
"礼物心愿气泡点击"
|
||||
)
|
||||
}
|
||||
return rootView
|
||||
}
|
||||
@@ -759,12 +781,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
.onEvent(StatisticsProtocol.EVENT_ROOM_CHAT_CLICK, "语音房_公屏发言")
|
||||
sendMsg()
|
||||
}
|
||||
R.id.contribute_list -> {
|
||||
DialogWebViewActivity.start(mContext, UriProvider.getRoomRanking())
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_MP_ROOM_RANKING_LIST_CLICK, "房间榜")
|
||||
mvpPresenter?.loadRoomRank()
|
||||
}
|
||||
|
||||
R.id.iv_first_charge_enter -> FirstChargeDialog.start(mContext)
|
||||
}
|
||||
}
|
||||
@@ -1256,18 +1273,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
microView.adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun updateRoomRanks(data: List<RoomContributeUserInfo>) {
|
||||
val avatarList = arrayListOf<ImageView?>(
|
||||
mView.findViewById(R.id.iv_rank_0),
|
||||
mView.findViewById(R.id.iv_rank_1),
|
||||
mView.findViewById(R.id.iv_rank_2)
|
||||
)
|
||||
|
||||
for (i in 0 until avatarList.size) {
|
||||
avatarList[i]?.loadAvatar(data.getOrNull(i)?.avatar)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onSendGiftBtnClick(giftId: Int = 0) {
|
||||
if (giftDialog == null) {
|
||||
GiftDialog.GIFT_DIALOG_FROM = "房间"
|
||||
@@ -1315,6 +1320,24 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
}, 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部按钮点击处理
|
||||
*/
|
||||
|
@@ -346,7 +346,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
}
|
||||
GiftValueMrg.get().updateRoomGiftValue(false);
|
||||
GiftModel.get().refreshGiftList(String.valueOf(AvRoomDataManager.get().getRoomUid())).subscribe();
|
||||
getMvpPresenter().loadRoomRank();
|
||||
EventBus.getDefault().post(new EnterRoomEvent(AvRoomDataManager.get().mCurrentRoomInfo.getType()));
|
||||
UserModel.get().getCurrentUserInfo()
|
||||
.compose(bindToLifecycle())
|
||||
@@ -656,14 +655,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
getMvpPresenter().cancelDragon();
|
||||
});
|
||||
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:
|
||||
onRoomSettingsClick();
|
||||
break;
|
||||
|
@@ -133,15 +133,6 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
gameBinding.tvHourRank.setOnClickListener {
|
||||
DialogWebViewActivity.start(
|
||||
mContext,
|
||||
UriProvider.getSingleRoomHourRankUrl(AvRoomDataManager.get().roomUid)
|
||||
)
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_ROOM_RANKLIST_CLICK, "房间小时榜点击")
|
||||
}
|
||||
}
|
||||
|
||||
@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()
|
||||
}
|
||||
}
|
@@ -522,20 +522,6 @@ public class BaseRoomPresenter<V extends IBaseRoomView> extends BaseMvpPresenter
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void loadRoomRank() {
|
||||
String type = AvRoomDataManager.get().isSingleRoom() ? RoomContributeDataInfo.TYPE_ROOM_WEEK_RANKING : RoomContributeDataInfo.TYPE_ROOM_DAY_RANKING;
|
||||
RoomContributeListModel.get().getSingleRoomRanking(1, type)
|
||||
.compose(bindToLifecycle())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.subscribe(roomContributeDataInfo -> {
|
||||
// if (getMvpView() == null) {
|
||||
// return;
|
||||
// }
|
||||
getMvpView().updateRoomRanks(roomContributeDataInfo.getRankings());
|
||||
});
|
||||
}
|
||||
|
||||
/***
|
||||
* 发送房间消息
|
||||
* @param message
|
||||
|
@@ -70,6 +70,4 @@ interface IBaseRoomView : IMvpBaseView {
|
||||
fun onFollowFail(msg: String?)
|
||||
|
||||
fun updateMicView()
|
||||
|
||||
fun updateRoomRanks(data: List<RoomContributeUserInfo>)
|
||||
}
|
@@ -37,7 +37,7 @@ class HomeFragment : BaseFragment(), View.OnClickListener {
|
||||
R.id.iv_my_room -> {
|
||||
StatisticManager.Instance()
|
||||
.onEvent(StatisticsProtocol.EVENT_HOME_MY_ROOM_CLICK, "首页_我的房间")
|
||||
OpenRoomHelper.openHomePartyRoom(baseActivity)
|
||||
OpenRoomHelper.openRoom(baseActivity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -416,7 +416,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(
|
||||
mContext,
|
||||
UriProvider.getUserLevelUrl()
|
||||
|
@@ -286,7 +286,7 @@ public class RouterHandler {
|
||||
case RouterType.MY_ROOM:
|
||||
//我的房间,开房
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ME_INTO_MY_ROOM_CLICK, "我页_进入我的房间");
|
||||
OpenRoomHelper.openHomePartyRoom((BaseActivity) context);
|
||||
OpenRoomHelper.openRoom((BaseActivity) context);
|
||||
break;
|
||||
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_FFD46C">#FFD46C</color>
|
||||
<color name="color_695CEB">#695CEB</color>
|
||||
<color name="color_FFF265">#FFFFF265</color>
|
||||
|
||||
</resources>
|
||||
|
@@ -60,33 +60,21 @@
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hour_rank"
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="22dp"
|
||||
<com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||
android:id="@+id/hourRankWidget"
|
||||
android:layout_below="@id/tv_notice_board"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
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" />
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_flag"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignTop="@id/tv_hour_rank"
|
||||
android:layout_alignTop="@id/hourRankWidget"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_toEndOf="@id/tv_hour_rank"
|
||||
android:layout_toEndOf="@id/hourRankWidget"
|
||||
android:src="@drawable/icon_music_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -94,7 +82,7 @@
|
||||
android:id="@+id/ll_room_pk_order"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_below="@id/tv_hour_rank"
|
||||
android:layout_below="@id/hourRankWidget"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/bg_room_pk_order"
|
||||
android:gravity="center"
|
||||
@@ -385,7 +373,7 @@
|
||||
android:id="@+id/vs_music_player"
|
||||
android:layout_width="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="@layout/avroom_music_player_layout" />
|
||||
|
||||
|
@@ -41,75 +41,23 @@
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="view_pk_board,micro_view" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contribute_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="85dp"
|
||||
android:background="@drawable/bg_contribute_entrance_single_room"
|
||||
android:gravity="center_vertical"
|
||||
android:onClick="@{click}"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_0"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_1"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-12dp"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rank_2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="-12dp"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="主播榜"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/arrow_right_white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.nnbc123.app.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/pager_view_wish_list"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contribute_list" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_fans_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contribute_list">
|
||||
app:layout_constraintTop_toBottomOf="@id/hourRankWidget">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fans_team_opt"
|
||||
@@ -131,7 +79,7 @@
|
||||
android:id="@+id/ll_room_pk_order"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_below="@id/tv_hour_rank"
|
||||
android:layout_below="@id/hourRankWidget"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/bg_room_pk_match_order"
|
||||
android:gravity="center"
|
||||
@@ -161,24 +109,14 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
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"
|
||||
<com.nnbc123.app.avroom.hour_rank.RoomHourRankWidget
|
||||
android:id="@+id/hourRankWidget"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/contribute_list" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="92dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_flag"
|
||||
@@ -187,8 +125,8 @@
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/icon_music_flag"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_hour_rank"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_hour_rank" />
|
||||
app:layout_constraintStart_toEndOf="@id/hourRankWidget"
|
||||
app:layout_constraintTop_toTopOf="@id/hourRankWidget" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
|
@@ -70,11 +70,9 @@ import com.nnbc123.core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.nnbc123.core.exception.ErrorThrowable;
|
||||
import com.nnbc123.core.family.bean.FamilyInfo;
|
||||
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.bean.GiftInfo;
|
||||
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.AssistantAttachment;
|
||||
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.RoomBoxPrizeAttachment;
|
||||
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.RoomPKAttachment;
|
||||
import com.nnbc123.core.im.custom.bean.RoomPkBean;
|
||||
@@ -1433,6 +1432,17 @@ public final class IMNetEaseManager {
|
||||
addMessages(msg);
|
||||
}
|
||||
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:
|
||||
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_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_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_KITCHEN;
|
||||
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:
|
||||
attachment = new RoomKitchenAttachment(first, second);
|
||||
break;
|
||||
case CUSTOM_MSG_HOUR_RANK:
|
||||
if (second == CustomAttachment.CUSTOM_MSG_HOUR_RANK_UPDATE) {
|
||||
attachment = new RoomHourRankAttachment(first, second);
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_PRIVILEGE:
|
||||
attachment = new RoomPrivilegeAttachment(first, second);
|
||||
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_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_SECOND = 1020;//特权卡(图片、gif)
|
||||
public static final int CUSTOM_MSG_PRIVILEGE_SECOND_VIDEO = 1021;//特权卡(视频类型)
|
||||
|
@@ -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.lifecycle.MutableLiveData;
|
||||
|
||||
import com.nnbc123.core.room.bean.RoomHourRankInfo;
|
||||
import com.nnbc123.core.room.wishlist.WishItemInfo;
|
||||
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
||||
import com.netease.nimlib.sdk.RequestCallback;
|
||||
@@ -108,6 +109,8 @@ public final class AvRoomDataManager {
|
||||
@Nullable
|
||||
public RoomInfo mCurrentRoomInfo;
|
||||
public BoxSwitchVo mBoxSwitchVo;
|
||||
// 小时榜
|
||||
public RoomHourRankInfo hourRankInfo;
|
||||
public EnterChatRoomResultData mEnterChatRoomResultData;
|
||||
/**
|
||||
* 房间创建者
|
||||
@@ -285,6 +288,7 @@ public final class AvRoomDataManager {
|
||||
public void updateServiceRoomInfo(RoomInfo roomInfo) {
|
||||
//我们自己服务端信息
|
||||
mCurrentRoomInfo = roomInfo;
|
||||
hourRankInfo = roomInfo.getHourRank();
|
||||
mBoxSwitchVo = roomInfo.boxSwitchVo;
|
||||
phrases = roomInfo.getSpeakTemplate();
|
||||
nick = roomInfo.getNick();
|
||||
@@ -396,6 +400,7 @@ public final class AvRoomDataManager {
|
||||
if (mCurrentRoomInfo != null) {
|
||||
mCurrentRoomInfo = null;
|
||||
}
|
||||
hourRankInfo = null;
|
||||
haveSelfChange = false;
|
||||
GiftValueMrg.get().clearObsever();
|
||||
mMicQueueMemberMap.clear();
|
||||
|
@@ -257,6 +257,9 @@ public class RoomEvent {
|
||||
|
||||
public static final int ROOM_PRIVILEGE = 102;
|
||||
|
||||
// 小时榜更新
|
||||
public static final int ROOM_HOUR_RANK = 103;
|
||||
|
||||
private int event = NONE;
|
||||
private int micPosition = Integer.MIN_VALUE;
|
||||
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}
|
||||
*/
|
||||
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;
|
||||
background = in.readParcelable(BackgroundBean.class.getClassLoader());
|
||||
roomBackground = in.readParcelable(RoomBackgroundBean.class.getClassLoader());
|
||||
hourRank = in.readParcelable(RoomHourRankInfo.class.getClassLoader());
|
||||
hasKTVPriv = in.readByte() != 0;
|
||||
isOpenKTV = in.readByte() != 0;
|
||||
isOpenGame = in.readByte() != 0;
|
||||
@@ -228,6 +229,7 @@ public class RoomInfo implements Parcelable, Serializable {
|
||||
dest.writeByte((byte) (isRoomFans ? 1 : 0));
|
||||
dest.writeParcelable(background, flags);
|
||||
dest.writeParcelable(roomBackground, flags);
|
||||
dest.writeParcelable(hourRank, flags);
|
||||
dest.writeByte((byte) (hasKTVPriv ? 1 : 0));
|
||||
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
|
||||
dest.writeByte((byte) (isOpenGame ? 1 : 0));
|
||||
@@ -287,6 +289,8 @@ public class RoomInfo implements Parcelable, Serializable {
|
||||
return "牌照房";
|
||||
} else if (isPermitRoom == 3) {
|
||||
return "新秀房";
|
||||
} else if (isPermitRoom == 4) {
|
||||
return "个播房";
|
||||
}
|
||||
return "普通房";
|
||||
}
|
||||
@@ -323,8 +327,17 @@ public class RoomInfo implements Parcelable, Serializable {
|
||||
private String mgName;
|
||||
private int mgMicNum;
|
||||
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>
|
||||
// /**
|
||||
// * 房间角标
|
||||
|
@@ -110,11 +110,11 @@ public class FormatUtils {
|
||||
|
||||
//PK值相关格式化方式,统一方法,方便以后更改样式
|
||||
public static String formatPKValue(long value) {
|
||||
// if (value >= 1000000) return (value / 100) / 100f + "万";
|
||||
// if (value >= 1000000) return (value / 100) / 100f + "万";
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static String formatRankValue(int goldAmount){
|
||||
public static String formatRankValue(int goldAmount) {
|
||||
String strGoldAmount;
|
||||
if (goldAmount >= 10000) {
|
||||
BigDecimal b = BigDecimal.valueOf(goldAmount / 10000.0);
|
||||
@@ -126,4 +126,29 @@ public class FormatUtils {
|
||||
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