fix bugs.2

This commit is contained in:
2025-12-05 16:41:32 +08:00
parent 8640c7366a
commit 8965243e0a
9 changed files with 107 additions and 86 deletions

View File

@@ -407,7 +407,6 @@ public class MessageListenerSingleton {
LogUtils.e("解析 JSON 数据时出错:" + e.getMessage());
return; // 退出方法,避免后续代码执行
}
if (groupID.contains(mRoomId)) {
notifyMessageReceived(event);
}

View File

@@ -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 {
// try {
floatingViewPool.add(currentMqttView!!)
currentMqttView = null
}catch (e:Exception){
LogUtils.e("飘屏显示异常", e)
}
// }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
}

View File

@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.imsdk.v2.V2TIMSendCallback;
@@ -69,6 +70,7 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
// 在需要的地方调用 Activity 的方法
public void someMethod() {
easeChatAdapter.clearData();
ToastUtils.showShort("清除成功");
}
public ChatRoomFragment() {

View File

@@ -741,7 +741,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
pitBean.setIs_online(messageEvent.getText().getFromUserInfo().getIs_online());
if (pitBean.getPit_number().equals("9")) {
RoomKtvWheatView roomDefaultWheatView = mBinding.muZc;
roomDefaultWheatView.setData(pitBean);
@@ -771,6 +771,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
pitBean.setIs_online(messageEvent.getText().getFromUserInfo().getIs_online());
roomInfoResp.getSong_pit_list().add(pitBean);
}
adapter.setNewData(roomInfoResp.getSong_pit_list());

View File

@@ -22,6 +22,7 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
@@ -472,7 +473,7 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
userMsgList.clear();
systemMsgList.clear();
allMsgList.clear();
getData().clear();
notifyDataSetChanged();
}

View File

@@ -149,8 +149,6 @@
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_15"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_constraintBottom_toTopOf="@+id/ll_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -158,44 +156,31 @@
<FrameLayout
android:id="@+id/vp_room_pager"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintDimensionRatio="1:0.88"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <include-->
<!-- android:id="@+id/room_cp_view"-->
<!-- layout="@layout/room_cp_vip_view"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:elevation="10dp"-->
<!-- app:layout_constraintDimensionRatio="16:9"-->
<!-- app:layout_constraintEnd_toEndOf="@+id/vp_room_pager"-->
<!-- app:layout_constraintStart_toStartOf="@+id/vp_room_pager"-->
<!-- app:layout_constraintTop_toTopOf="@+id/vp_room_pager"-->
<!-- android:visibility="gone" />-->
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/ease_container"/>
<FrameLayout
android:id="@+id/ease_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vp_room_pager">
app:layout_constraintTop_toBottomOf="@+id/vp_room_pager"/>
<com.xscm.moduleutil.widget.AvatarFrameView
android:id="@+id/svga_ride"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/dp_80" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.xscm.moduleutil.widget.RoomMessageInputMenu

View File

@@ -242,9 +242,9 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_jukebox"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_200"
android:layout_marginHorizontal="@dimen/dp_12"
android:layout_marginVertical="@dimen/dp_10"
android:layout_height="0dp"
android:layout_marginHorizontal="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@+id/tv_song"
tools:listitem="@layout/item_jukebox" />

View File

@@ -18,12 +18,15 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ccc"
android:layout_width="@dimen/dp_343"
android:layout_height="@dimen/dp_282"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_16"
android:paddingBottom="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:background="@drawable/bg_rounded_corner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

View File

@@ -2,13 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_marginEnd="@dimen/dp_23"
android:layout_height="wrap_content">
<com.xscm.modulemain.view.RoomJukeboxWheatView
android:id="@+id/wheatView"
android:layout_width="@dimen/dp_60"
android:layout_height="@dimen/dp_85"
android:layout_width="@dimen/dp_65"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:room_wheat_number="10"