@@ -1426,11 +1426,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
LogUtils . e ( " messageEvent!!.text.type " + messageEvent . text . type )
CommonAppContext . getInstance ( ) . onlineMap [ userId ?: " " ] = messageEvent . text . type
if ( mRoomInfoResp != null && mRoomInfoResp ?. room _info != null ) {
if ( userId . equals ( SpUtil . getUserId ( ) . toString ( ) ) ) {
if ( messageEvent . text . type != 2 ) {
if ( userId . equals ( SpUtil . getUserId ( ) . toString ( ) ) ) {
if ( messageEvent . text . type != 2 ) {
roomFragment !! . handleRoomMessage ( messageEvent )
}
} else {
} else {
roomFragment !! . handleRoomMessage ( messageEvent )
}
// when(mRoomInfoResp?.room_info?.type_id) {
@@ -1485,22 +1485,22 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
qxRedPacketManager !! . addRedPacket ( messageEvent . text . redpacketInfo )
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeQXRoomMessageRedRemove ) {
qxRedPacketManager !! . removeRedPacket ( messageEvent . text . redpacket _id )
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeSongerNum || //房间点歌数量变化
msgType == EMMessageInfo . QXRoomMessageTypeSingerRoomNextSongDidChanged ) //点歌房下一首歌曲发生变化
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeSongerNum || //房间点歌数量变化
msgType == EMMessageInfo . QXRoomMessageTypeSingerRoomNextSongDidChanged
) //点歌房下一首歌曲发生变化
{
roomFragment !! . handleRoomMessage ( messageEvent )
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeSingerRoomCurrentSongDidChanged ) { //点歌房当前歌曲发生变化)
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeSingerRoomCurrentSongDidChanged ) { //点歌房当前歌曲发生变化)
if ( mRoomInfoResp != null && mRoomInfoResp !! . room _info != null ) {
if ( messageEvent ?. text ?. song _info != null ) {
if ( messageEvent ?. text ?. song _info != null ) {
mRoomInfoResp ?. singer _info ?. song _info = messageEvent . text . song _info
} else {
mRoomInfoResp ?. singer _info ?. song _info = null
} else {
mRoomInfoResp ?. singer _info ?. song _info = null
}
roomFragment ?. upRoomInfo ( mRoomInfoResp )
roomFragment !! . handleRoomMessage ( messageEvent )
}
}
else if ( msgType == EMMessageInfo . QXRoomMessageTypeCPText ) {
} else if ( msgType == EMMessageInfo . QXRoomMessageTypeCPText ) {
LogUtils . e ( " CPText " , messageEvent . text . rights _icon )
if ( messageEvent . text . rights _icon . isNotEmpty ( ) ) {
QXGiftPlayerManager . getInstance ( this ) . displayCPView (
@@ -1908,12 +1908,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
roomFragment !! . upRoomInfoData ( mRoomInfoResp )
roomFragment !! . handleRoomMessage ( messageEvent )
}
RoomType . JUKEBOX -> {
mRoomInfoResp ?. room _info ?. pit _list !! [ pitNumber . toInt ( ) - 1 ] = RoomPitBean ( pitNumber )
mRoomInfoResp ?. room _info ?. pit _list !! [ pitNumber . toInt ( ) - 1 ] = RoomPitBean ( pitNumber )
// getPitBean(messageEvent, 1)
roomFragment !! . upRoomInfoData ( mRoomInfoResp )
roomFragment ?. handleRoomMessage ( messageEvent )
}
else -> {
roomFragment !! . updateSeatViewExchangedWithPitArray ( mRoomInfoResp )
}
@@ -2009,15 +2011,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
private var currentMqttView : View ? = null // 正在播放
var decorView : ViewGroup ? = null //礼物的
// 添加视图池,用于复用飘屏视图
private val floatingViewPool = mutableListOf < View > ( )
// 使用Handler替代post, 提供更精确的控制
private val floatingHandler = Handler ( Looper . getMainLooper ( ) )
// 添加预加载标志
private var isPreloaded = false
private fun handleMsgType1001 ( roomMessageEvent : RoomMessageEvent ) {
if ( roomMessageEvent . text . fromUserInfo != null && roomMessageEvent . text . fromUserInfo . enter _image ?. isNotEmpty ( ) == true ) {
if ( roomMessageEvent . text . fromUserInfo != null && roomMessageEvent . text . fromUserInfo . enter _image ?. isNotEmpty ( ) == true ) {
showFloatingMessage ( roomMessageEvent . text . fromUserInfo )
}
@@ -2091,12 +2096,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
// 将视图放回池中
currentMqttView ?. visibility = View . GONE
try {
floatingViewPool . add ( currentMqttView !! )
currentMqttView = null
} catch ( e : Exception) {
LogUtils. e ( " 飘屏显示异常 " , e )
}
// try {
floatingViewPool . add ( currentMqttView !! )
currentMqttView = null
// } catch (e: Exception){
// LogUtils.e("飘屏显示异常", e)
// }
} )
}
}
@@ -2113,13 +2118,16 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
view . alpha = 0f // 初始设为透明,避免闪烁
// 使用属性动画替代补间动画,提高性能
val enterAnim = ValueAnimator . ofFloat ( screenWidth . toFloat ( ) , ( ( screenWidth - SystemUtils . getWidth ( 316 ) ) / 2 ) . toFloat ( ) )
val enterAnim = ValueAnimator . ofFloat (
screenWidth . toFloat ( ) ,
( ( screenWidth - SystemUtils . getWidth ( 316 ) ) / 2 ) . toFloat ( )
)
enterAnim . duration = 1000 // 减少进入动画时长到800ms
enterAnim . interpolator = DecelerateInterpolator ( )
// 添加透明度动画,使显示更平滑
val alphaAnim = ValueAnimator . ofFloat ( 0f , 1f )
alphaAnim . duration = 1000 // 透明度动画300ms
alphaAnim . duration = 1000 // 透明度动画300ms
enterAnim . addUpdateListener { animation ->
view . translationX = animation . animatedValue as Float
@@ -2507,7 +2515,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
pitBean . nickname = messageEvent . text . fromUserInfo . nickname
pitBean . sex = messageEvent . text . fromUserInfo . sex . toString ( ) + " "
pitBean . charm = messageEvent . text . fromUserInfo . charm
pitBean . is _online = messageEvent . text . fromUserInfo . is _online
pitBean . is _online = messageEvent . text . fromUserInfo . is _online
return pitBean
}
@@ -3346,7 +3354,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
false ,
2 ,
isNumberWhether ( ) ,
supportFragmentManager )
supportFragmentManager
)
}
mBinding !! . ivQuanQiang . setOnClickListener { v : View ? ->
@@ -3630,11 +3639,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
is RoomHourBean . RoomListBean -> {
if ( event . room _id == CommonAppContext . getInstance ( ) . playId ) {
if ( event . room _id == CommonAppContext . getInstance ( ) . playId ) {
return
}
roomId2 = event . room _id
roomId2 = event . room _id
MvpPre ?. getRoomIn ( event . room _id , " " )
}
@@ -3673,9 +3682,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
}
}
private var roomId2 : String ? = null //这是点击小时榜后记录的房间id
private fun getHour ( ) {
private fun getHour ( ) {
ClickUtils . clearAllClickRecords ( )
AgoraManager . getInstance ( ) . cleanup ( )
roomId = roomId2
@@ -3754,8 +3764,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
GiftDisplayManager . getInstance ( ) . setupDisplayView ( mBinding ?. giftContainer )
}
fun refreshRoomInfo ( roomId : String ) {
MvpPre ?. getRoomIn ( roomId , " " )
fun refreshRoomInfo ( roomId : String ) {
MvpPre ?. getRoomIn ( roomId , " " )
}
@@ -3924,31 +3934,51 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
fun upRoomInfoFragment ( resp : RoomInfoResp ? ) {
this . mRoomInfoResp = resp
this . mRoomInfoResp = resp
}
fun upHeight ( ) {
if ( mRoomInfoResp ?. room _info ?. type _id == " 1 " || mRoomInfoResp ?. room _info ?. type _id == " 3 " || mRoomInfoResp ?. room _info ?. type _id == " 4 "
|| mRoomInfoResp ?. room _info ?. type _id == " 8 "
) {
maxHeightDp = if ( mRoomInfoResp ?. room _info ?. label _id == " 1 " ) {
333
} else {
287
}
} else if ( mRoomInfoResp?. room _info?. type _id == " 2 " ) {
maxHeightDp = 297
}
if ( mRoomInfoResp ?. room _info ?. type _id == " 6 " ) {
maxHeightDp = 453
} else if ( mRoomInfoResp ?. room _info ?. type _id == " 7 " ) {
maxHeightDp = 373
} else if ( mRoomInfoResp !! . room _info . type _id == " 9 " ) {
maxHeightDp = 373
} else if ( mRoomInfoResp !! . room _info . type _id == " 10 " ) {
maxHeightDp = 333
}
adjustLayoutHeights ( )
val vpRoomPager : View = mBinding !! . vpRoomPager
val params = ConstraintLayout . LayoutParams (
ConstraintLayout . LayoutParams . MATCH _PARENT ,
ConstraintLayout . LayoutParams . WRAP _CONTENT
)
// params.dimensionRatio = "W,1:0.85"
// when (mRoomInfoResp?.room_info?.type_id) {
// "1", "3", "4", "8" ->
// if ( mRoomInfoResp?. room_info?.label_id == "1")
// params.dimensionRatio = "W,1:0.88"
// else
// params.dimensionRatio = "W,1:0.82"
//
// "2" -> params.dimensionRatio = "W,1:0.85"
// "6" -> params.dimensionRatio = "W,1:1"
// "7" -> params.dimensionRatio = "W,1:0.88"
// "9" -> params.dimensionRatio = "W,1:0.85"
// "10" -> params.dimensionRatio = "W,1:0.88"
// }
vpRoomPager . layoutParams = params
// if (mRoomInfoResp?.room_info?.type_id == "1" || mRoomInfoResp?.room_info?.type_id == "3" || mRoomInfoResp?.room_info?.type_id == "4"
// || mRoomInfoResp?.room_info?.type_id == "8"
// ) {
// maxHeightDp = if (mRoomInfoResp?.room_info?.label_id == "1") {
// 333
// } else {
// 287
// }
// } else if (mRoomInfoResp?.room_info?.type_id == "2") {
// maxHeightDp = 297
// }
// if (mRoomInfoResp?.room_info?.type_id == "6") {
// maxHeightDp = 453
// } else if (mRoomInfoResp?.room_info?.type_id == "7") {
// maxHeightDp = 373
// } else if (mRoomInfoResp!!.room_info.type_id == "9") {
// maxHeightDp = 373
// } else if (mRoomInfoResp!!.room_info.type_id == "10") {
// maxHeightDp = 333
// }
// adjustLayoutHeights()
}
@SuppressLint ( " CommitTransaction " )
@@ -4461,7 +4491,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
roomPitBean . sex = messageEvent . text . list [ j ] . sex . toString ( ) + " "
roomPitBean . dress = messageEvent . text . list [ j ] . dress
roomPitBean . charm = messageEvent . text . list [ j ] . charm
roomPitBean . is _online = messageEvent . text . list [ j ] . is _online
roomPitBean . is _online = messageEvent . text . list [ j ] . is _online
return roomPitBean
}