1:修改pk房

2:修改页面跳转
This commit is contained in:
2025-10-30 09:07:35 +08:00
parent a4032c76ad
commit a5ebc83dea
33 changed files with 1575 additions and 968 deletions

View File

@@ -16,7 +16,6 @@
<activity
android:name=".activity.RoomActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:excludeFromRecents="false"
android:exported="false"
android:windowSoftInputMode="adjustPan"

View File

@@ -32,6 +32,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ThreadUtils
@@ -46,7 +47,6 @@ import com.example.moduleroom.fragment.*
import com.example.moduleroom.presenter.RoomPresenter
import com.example.moduleroom.service.ForegroundService
import com.example.moduleroom.service.RoomPlayService
import com.google.common.collect.Sets.SetView
import com.hjq.toast.ToastUtils
import com.liulishuo.okdownload.OkDownloadProvider
import com.orhanobut.logger.Logger
@@ -83,6 +83,7 @@ import com.xscm.moduleutil.interfaces.OnMusicItemClickListener
import com.xscm.moduleutil.listener.MessageListenerSingleton
import com.xscm.moduleutil.listener.MessageListenerSingleton.OnMessageReceivedListener
import com.xscm.moduleutil.rtc.AgoraManager
import com.xscm.moduleutil.rtc.AgoraManagerEx
import com.xscm.moduleutil.rtc.MusicPlayBean
import com.xscm.moduleutil.service.MyRoomSingleton
import com.xscm.moduleutil.utils.*
@@ -125,6 +126,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
var roomId: String? = null
var mRoomInfoResp: RoomInfoResp? = null
@JvmField
@Autowired
var taskId: String? = null
@@ -183,21 +185,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
taskId = intent.getStringExtra("taskId")
}
private fun resumeRoomFromMinimize() {
// 从最小化状态恢复房间
isMinimized = false
clearMinimizeState()
// 恢复房间状态
resumeRoomState()
// 确保UI正确显示
if (mBinding != null) {
// 恢复UI状态
}
}
private var bgEffectView: View? = null
private fun setupEffectView() {
@@ -499,6 +486,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
Log.d("TAG", "=== onDestroy called ===");
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
}
override fun onCreate(savedInstanceState: Bundle?) {
// 在super.onCreate之前设置主题以避免闪白屏
setTheme(com.xscm.moduleutil.R.style.BaseAppTheme) // 设置你的主主题
@@ -526,7 +517,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
// .beginTransaction()
// .replace(R.id.vp_room_pager, roomFragment!!)
// .commitAllowingStateLoss()
// 使用新的 OnBackPressedDispatcher API 来处理返回事件
// 使用新的 API 来处理返回事件
if (onBackPressedDispatcher != null) {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
@@ -613,7 +604,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
this.mRoomBean = roomBean
this.mRoomUserBean = resp.user_info
this.mRoomOwnerBean = resp.room_owner
this.mPitList = mRoomBean!!.pit_list
this.mPitList = mRoomBean?.pit_list ?: ArrayList()
this.roomId = roomBean.room_id
MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
@@ -632,16 +623,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
number = roomBean.online_number
mBinding!!.roomTop.tvNum.text = number.toString() + ""
val userIds = StringBuilder()
for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
if (userId != null && userId != "0" && !userId.isEmpty()) {
if (userIds.length > 0) {
userIds.append(",")
}
userIds.append(userId)
}
}
setviewyc(true)
initPublicScreenFragment()
// 确保Fragment已完全初始化后再调用getUpRoomInfo
if (publicScreenFragment != null && publicScreenFragment!!.isAdded && publicScreenFragment!!.view != null) {
@@ -654,7 +636,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
}
LogUtils.e("加入", roomId)
val userIds = StringBuilder()
if (mRoomInfoResp?.room_info?.pit_list != null) {
for (i in mRoomInfoResp?.room_info?.pit_list!!.indices) {
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
if (userId != null && userId != "0" && !userId.isEmpty()) {
if (userIds.length > 0) {
userIds.append(",")
}
userIds.append(userId)
}
}
}
CommonAppContext.getInstance().isPlaying = true
CommonAppContext.getInstance().playId = roomId
CommonAppContext.getInstance().playName = mRoomBean!!.room_name
@@ -1315,6 +1308,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
)
}
mBinding!!.roomTop.muZc.setOnClickListener { view: View ->
this.onClick(
view
)
}
// SpUtil.saveMyRoomId(roomId);
// MvpPre.getRoomIn(roomId, password);
// MvpPre.getRoomOnline(roomId, "1", "10");
@@ -1438,7 +1437,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if (msgType == 1001) {
handleMsgType1001()
} else if (msgType == 1002) {
handleMsgType1002()
handleMsgType1002(messageEvent, text)
} else if (msgType == 1029) {
handleMsgType1029(messageEvent, text)
} else if (msgType == 1021) {
@@ -1467,7 +1466,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
setRoleType(3, -11)
}
} else if (msgType == 125) {
handleMsgType125(messageEvent, text)
handleMsgType125(messageEvent, text.text)
} else if (msgType == 1006) {
handleMsgType1006()
} else if (msgType == 1007) {
@@ -1586,7 +1585,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
xlhDjs(xlhBean.end_time)
} else if (xlhBean.from_type == 104) {
mBinding?.xlhRk?.visibility = View.GONE
releaseCountDownTimer1()
}
}
@@ -1910,13 +1910,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
for (roomPitBean in mRoomInfoResp!!.song_pit_list) {
AgoraManager.getInstance(this@RoomActivity).ClientRole(false)
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
mBinding!!.rlMic.visibility = View.GONE
mBinding?.rlMic?.visibility = View.GONE
}
if (mRoomInfoResp!!.song_user_info != null && mRoomInfoResp!!.song_user_info.user_id != null) {
if (mRoomInfoResp!!.song_user_info.user_id == SpUtil.getUserId().toString() + "") {
AgoraManager.getInstance(this@RoomActivity).ClientRole(false)
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
mBinding!!.rlMic.visibility = View.GONE
mBinding?.rlMic?.visibility = View.GONE
}
}
}
@@ -1987,6 +1987,21 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
val labelId = mRoomInfoResp!!.room_info.label_id
if ("2" == labelId) {
// val pitBean = RoomPitBean()
// pitBean.pit_number = messageEvent.text.pit_number
// pitBean.user_id = messageEvent.text.fromUserInfo.user_id.toString() + ""
// pitBean.avatar = messageEvent.text.fromUserInfo.avatar
// pitBean.nickname = messageEvent.text.fromUserInfo.nickname
// pitBean.sex = messageEvent.text.fromUserInfo.sex.toString() + ""
// pitBean.charm = messageEvent.text.fromUserInfo.charm
// pitBean.dress = messageEvent.text.fromUserInfo.dress
//
// if (pitBean.pit_number == "9") {
// val roomDefaultWheatView: RoomKtvWheatView = mBinding?.roomTop!!.muZc
// roomDefaultWheatView.setData(pitBean)
// }
roomFragment!!.KtvFragmentEvent(messageEvent)
} else if ("1" == labelId) {
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt() - 1, getPitBean(messageEvent))
@@ -2064,6 +2079,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
val labelId = mRoomInfoResp!!.room_info.label_id
if ("2" == labelId) {
// val pitBean = RoomPitBean()
// pitBean.pit_number = messageEvent.text.pit_number
// pitBean.user_id = ""
// pitBean.avatar = ""
// pitBean.nickname = ""
// pitBean.sex = ""
// pitBean.charm = ""
// if (pitBean.pit_number == "9") {
// val roomDefaultWheatView: RoomKtvWheatView = mBinding?.roomTop!!.muZc
// roomDefaultWheatView.setData(pitBean)
// }
roomFragment!!.KtvFragmentEvent(messageEvent)
} else if ("1" == labelId) {
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt() - 1, getPitBean2(messageEvent, pitNumber))
@@ -2153,6 +2179,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
LogUtils.e("退出房间")
MvpPre!!.quitRoom(roomId, SpUtil.getUserId().toString() + "")
MessageListenerSingleton.quitGroup(roomId);
quit();
performExitRoom(1);
}
}
@@ -2161,12 +2190,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
mBinding!!.roomTop.tvNum.text = number.toString() + ""
}
private fun handleMsgType1002() {
private fun handleMsgType1002(messageEvent: RoomMessageEvent, text: T?) {
number--
if (number < 0) {
number = 0
}
mBinding!!.roomTop.tvNum.text = number.toString() + ""
if (text == null || text.fromUserInfo == null) return
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
MessageListenerSingleton.quitGroup(roomId);
quit();
performExitRoom(1);
}
}
private fun handleMsgType1029(messageEvent: RoomMessageEvent, text: T?) {
@@ -2369,23 +2404,19 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
return mRoomInfoResp
}
private fun handleMsgType125(messageEvent: RoomMessageEvent, text: T?) {
private fun handleMsgType125(messageEvent: RoomMessageEvent, text: String) {
if (text == null) return
try {
val parsedText = GsonUtils.fromJson<text>(
text.text,
text::class.java
)
val parsedText: RoomMessageEvent.text = GsonUtils.fromJson(text, RoomMessageEvent.text::class.java)
if (parsedText.is_mute == 1) {
AgoraManager.getInstance(this).ClientRole(false)
AgoraManager.getInstance(this).muteLocalAudioStreamEx(false, SpUtil.getUserId())
AgoraManagerEx.getInstance(this).muteLocalAudioStreamEx(true)
} else {
AgoraManager.getInstance(this).ClientRole(true)
AgoraManager.getInstance(this).muteLocalAudioStreamEx(true, SpUtil.getUserId())
AgoraManagerEx.getInstance(this).muteLocalAudioStreamEx(false)
}
} catch (e: Exception) {
// Handle exception
LogUtils.e("handleMsgType125: " + e.message)
}
}
@@ -2775,6 +2806,54 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
aBoolean = true
}
}
} else if (id == R.id.mu_zc) {
val muZc: RoomKtvWheatView = mBinding!!.roomTop.muZc
if (muZc.getUserId() != "") {
RoomUserInfoFragment.show(
roomId,
muZc.getUserId(),
muZc.pitNumber,
getHostUser(),
false,
2,
isNumberWhether(),
supportFragmentManager
)
} else {
MvpPre!!.applyPit(roomId, "9")
}
}
}
private fun isNumberWhether(): Int {
if (mRoomInfoResp!!.getUser_info().getPit_number() == 9) {
return 1
}
return 0
}
private fun getHostUser(): Int {
if (mRoomInfoResp?.getUser_info()?.getPit_number() == 9) {
return if (mRoomInfoResp?.getUser_info()?.getIs_room_owner() == 1) {
1
} else if (mRoomInfoResp?.getUser_info()?.getIs_management() == 1) {
2
} else if (mRoomInfoResp?.getUser_info()?.getIs_host() == 1) {
3
} else {
4
}
} else {
if (mRoomInfoResp?.getUser_info()?.getIs_room_owner() == 1) {
return 1
}
if (mRoomInfoResp?.getUser_info()?.getIs_management() == 1) {
return 2
}
if (mRoomInfoResp?.getUser_info()?.getIs_host() == 1) {
return 3
}
return 4
}
}
@@ -2873,33 +2952,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
appStateListener!!.isAppInBackground = true
}
QXGiftPlayerManager.getInstance(applicationContext).destroyEffectSvga()
ARouter.getInstance()
.build(ARouteConstants.ME)
.navigation()
// ARouter.getInstance().build(ARouteConstants.ME)
// .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP)
// .navigation();
// 使用Intent启动主Activity通过ARouter路径
// 这样可以避免模块间的直接依赖
// try {
// val intent = Intent()
// intent.setClassName(packageName, "com.xscm.modulemain.activity.MainActivity")
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
// startActivity(intent)
// } catch (e: Exception) {
// // 如果直接指定类名失败则使用默认的Launcher Activity
// val startMain = Intent(Intent.ACTION_MAIN)
// startMain.addCategory(Intent.CATEGORY_HOME)
// startMain.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
// startActivity(startMain)
// }
// 隐藏Activity而不是销毁它
// moveTaskToBack(true);
// 使用 moveTaskToBack 将应用最小化
// moveTaskToBack(true);
if (ActivityUtils.getActivityList().size <= 0) {
ARouter.getInstance()
.build(ARouteConstants.ME)
.navigation()
} else {
val intent = Intent(this, ActivityUtils.getActivityList()[1]::class.java)
intent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
startActivity(intent)
}
}
private fun saveMinimizeState() {
@@ -3014,12 +3077,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
fun setrlMic(voive: Boolean) {
mBinding!!.rlMic.visibility =
mBinding?.rlMic?.visibility =
if (voive) View.VISIBLE else View.GONE
}
fun rlMore(voive: Boolean) {
mBinding!!.rlMore.visibility = if (voive) View.GONE else View.GONE
mBinding!!.rlMore.visibility = if (voive) View.VISIBLE else View.GONE
}
fun ivMic(inIvMic: Int) {
@@ -3027,16 +3090,16 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
fun setRoleType(roleType: Int, pit_number: Int) {
val rl_voice = mBinding!!.rlVoive // 注意:原拼写错误已修正
val rl_mic = mBinding!!.rlMic
val rl_more = mBinding!!.rlMore
val rl_misc = mBinding!!.rlMisc
val rl_voice = mBinding?.rlVoive // 注意:原拼写错误已修正 喇叭
val rl_mic = mBinding?.rlMic//麦克风
val rl_more = mBinding?.rlMore //PK
val rl_misc = mBinding?.rlMisc //音乐
// 默认隐藏所有按钮
rl_voice.visibility = View.GONE
rl_more.visibility = View.GONE
rl_misc.visibility = View.GONE
rl_mic.visibility = View.GONE
rl_voice?.visibility = View.GONE
rl_more?.visibility = View.GONE
rl_misc?.visibility = View.GONE
rl_mic?.visibility = View.GONE
// 空指针保护
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null || mRoomInfoResp!!.user_info == null) {
@@ -3049,70 +3112,80 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
// 特殊房间类型处理(优先级最高)
if ("6" == typeId) {
mBinding!!.rlMessage.visibility = View.GONE
mBinding?.rlMessage?.visibility = View.GONE
return // 全部隐藏,无需继续处理
} else {
mBinding?.rlMessage?.visibility = View.VISIBLE
}
// 根据角色类型显示按钮
when (roleType) {
1, 2, 3 -> {
rl_voice.visibility = View.VISIBLE
rl_mic.visibility =
rl_voice?.visibility = View.VISIBLE
rl_mic?.visibility =
if (pit_number != 0) View.VISIBLE else View.GONE
rl_more.visibility =
if (pit_number == 9) View.GONE else View.GONE
rl_misc.visibility = View.VISIBLE
rl_more?.visibility =
if (pit_number == 9) View.VISIBLE else View.GONE
rl_misc?.visibility = View.VISIBLE
}
0 -> {
rl_voice.visibility = View.VISIBLE
rl_mic.visibility =
rl_voice?.visibility = View.VISIBLE
rl_mic?.visibility =
if (pit_number != 0) View.VISIBLE else View.GONE
rl_misc.visibility = View.VISIBLE
rl_misc?.visibility = View.VISIBLE
}
5 -> {
rl_voice.visibility = View.VISIBLE
rl_more.visibility = View.GONE
rl_misc.visibility = View.VISIBLE
rl_voice?.visibility = View.VISIBLE
rl_more?.visibility = View.GONE
rl_misc?.visibility = View.VISIBLE
}
else -> {}
}
if (roleType != 5) {
rl_misc.visibility = View.VISIBLE
rl_misc?.visibility = View.VISIBLE
if (userPitNumber == 9) {
rl_more.visibility = View.GONE
rl_more?.visibility = View.VISIBLE
}
}
// label_id 和 type_id 联合判断
if (mutableListOf<String>("1", "3", "4", "8").contains(typeId) && "2" == labelId) {
rl_more.visibility = View.GONE
if (mutableListOf<String>("1").contains(typeId) && "1" == labelId) {
rl_more?.visibility = View.VISIBLE
rl_misc?.visibility = View.VISIBLE
}else{
rl_more?.visibility = View.GONE
rl_misc?.visibility = View.GONE
}
// mic 显示逻辑
if (userPitNumber > 0) {
rl_mic.visibility = View.VISIBLE
switchMic(2)
} else {
if (pit_number == 888) {
rl_mic.visibility = View.VISIBLE
switchMic(2)
} else if (pit_number == -1) {
rl_mic.visibility = View.VISIBLE // 原代码此处缺少 View. 前缀,已补全
rl_mic?.visibility = View.VISIBLE
if (CommonAppContext.getInstance().isMai) {
switchMic(1)
} else {
rl_mic.visibility = View.GONE
switchMic(2)
}
} else {
if (pit_number == 888) {
rl_mic?.visibility = View.VISIBLE
switchMic(2)
} else if (pit_number == -1) {
rl_mic?.visibility = View.VISIBLE // 原代码此处缺少 View. 前缀,已补全
switchMic(1)
} else {
rl_mic?.visibility = View.GONE
switchMic(2)
}
}
if ("7" == typeId || "2" == typeId) {
rl_more.visibility = View.GONE
rl_misc.visibility = View.GONE
rl_more?.visibility = View.GONE
rl_misc?.visibility = View.GONE
}
}
@@ -3309,121 +3382,123 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
// TODO: 2025/8/26 加入房间
override fun roomInfo(resp: RoomInfoResp) {
AppStateManager.getInstance().roomInfo = resp
this.mRoomInfoResp = resp
val roomBean = resp.room_info
this.mRoomBean = roomBean
this.mRoomUserBean = resp.user_info
this.mRoomOwnerBean = resp.room_owner
this.mPitList = mRoomBean!!.pit_list
this.roomId = roomBean.room_id
MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
mBinding!!.roomTop.name.text = roomBean.room_name
mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number
if (mRoomUserBean?.getIs_room_owner() == 1) {
mBinding!!.roomTop.btnFollow.visibility = View.GONE
} else {
mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
if (resp.isCollect) {
mBinding!!.roomTop.btnFollow.background =
resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
mBinding!!.roomTop.btnFollow.text = ""
}
}
number = roomBean.online_number
mBinding!!.roomTop.tvNum.text = number.toString() + ""
setview(resp)
val userIds = StringBuilder()
for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
if (userId != null && userId != "0" && !userId.isEmpty()) {
if (userIds.length > 0) {
userIds.append(",")
}
userIds.append(userId)
}
}
initPublicScreenFragment()
if (!isFinishing && !isDestroyed) {
resetFragment()
upHeight()
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
}
LogUtils.e("加入", roomId)
CommonAppContext.getInstance().isPlaying = true
CommonAppContext.getInstance().playId = roomId
CommonAppContext.getInstance().playName = mRoomBean!!.room_name
CommonAppContext.getInstance().playCover = resp.room_info.room_cover
CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
if (mRoomUserBean?.getIs_collect() == 1) {
mBinding!!.roomTop.btnFollow.background =
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
mBinding!!.roomTop.btnFollow.text = ""
} else {
ThemeableDrawableUtils.setThemeableRoundedBackground(
mBinding!!.roomTop.btnFollow,
ColorManager.getInstance().primaryColorInt,
53
)
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
mBinding!!.roomTop.btnFollow.text = "收藏"
// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
}
if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
AgoraManager.getInstance(this).isBjMusic = false
} else {
AgoraManager.getInstance(this).isBjMusic = true
}
AgoraManager.stopMuisc()
initializeAudio()
toutiao()
upRoomInfo(resp)
if (userIds.length > 0 && roomId != null) {
// MvpPre.userOnlineStatus(userIds.toString(), roomId);
}
if (publicScreenFragment != null) {
publicScreenFragment!!.getUpRoomInfo(resp)
}
instView()
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
.toString() + ""
) {
mBinding!!.roomTop.rl.visibility = View.VISIBLE
ivSoundEffects(true)
} else {
mBinding!!.roomTop.rl.visibility = View.GONE
ivSoundEffects(false)
}
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
mBinding!!.rlMore.visibility = View.GONE
mBinding!!.rlMisc.visibility = View.GONE
}
setupEffectView()
if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") {
mBinding?.xlhRk?.visibility = View.VISIBLE
xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time)
} else {
mBinding?.xlhRk?.visibility = View.INVISIBLE
releaseCountDownTimer1()
}
if (mRoomInfoResp!!.hour_ranking_open == 1) {
mBinding!!.clXsb.visibility = View.VISIBLE
} else {
mBinding!!.clXsb.visibility = View.GONE
}
// this.mRoomInfoResp = resp
// val roomBean = resp.room_info
// this.mRoomBean = roomBean
// this.mRoomUserBean = resp.user_info
// this.mRoomOwnerBean = resp.room_owner
// this.mPitList = mRoomBean!!.pit_list
// this.roomId = roomBean.room_id
// MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
// ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
// mBinding!!.roomTop.name.text = roomBean.room_name
// mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number
// if (mRoomUserBean?.getIs_room_owner() == 1) {
// mBinding!!.roomTop.btnFollow.visibility = View.GONE
// } else {
// mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
// if (resp.isCollect) {
// mBinding!!.roomTop.btnFollow.background =
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
// mBinding!!.roomTop.btnFollow.text = ""
// }
// }
// number = roomBean.online_number
// mBinding!!.roomTop.tvNum.text = number.toString() + ""
//
// val userIds = StringBuilder()
// for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
// val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
// if (userId != null && userId != "0" && !userId.isEmpty()) {
// if (userIds.length > 0) {
// userIds.append(",")
// }
// userIds.append(userId)
// }
// }
// initPublicScreenFragment()
// if (!isFinishing && !isDestroyed) {
// resetFragment()
// upHeight()
// } else {
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
// }
// LogUtils.e("加入", roomId)
//
// CommonAppContext.getInstance().isPlaying = true
// CommonAppContext.getInstance().playId = roomId
// CommonAppContext.getInstance().playName = mRoomBean!!.room_name
//
// CommonAppContext.getInstance().playCover = resp.room_info.room_cover
// CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
//
// if (mRoomUserBean?.getIs_collect() == 1) {
// mBinding!!.roomTop.btnFollow.background =
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
// mBinding!!.roomTop.btnFollow.text = ""
// } else {
// ThemeableDrawableUtils.setThemeableRoundedBackground(
// mBinding!!.roomTop.btnFollow,
// ColorManager.getInstance().primaryColorInt,
// 53
// )
// mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
// mBinding!!.roomTop.btnFollow.text = "收藏"
// // mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
// }
// if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
// AgoraManager.getInstance(this).isBjMusic = false
// } else {
// AgoraManager.getInstance(this).isBjMusic = true
// }
//
// AgoraManager.stopMuisc()
// initializeAudio()
//
//
// toutiao()
// upRoomInfo(resp)
//
//
// if (userIds.length > 0 && roomId != null) {
//// MvpPre.userOnlineStatus(userIds.toString(), roomId);
// }
// if (publicScreenFragment != null) {
// publicScreenFragment!!.getUpRoomInfo(resp)
// }
// instView()
//
// if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
// .toString() + ""
// ) {
// mBinding!!.roomTop.rl.visibility = View.VISIBLE
// ivSoundEffects(true)
// } else {
// mBinding!!.roomTop.rl.visibility = View.GONE
// ivSoundEffects(false)
// }
//
// if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
// mBinding!!.rlMore.visibility = View.GONE
// mBinding!!.rlMisc.visibility = View.GONE
// }
// setupEffectView()
//
// if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") {
// mBinding?.xlhRk?.visibility = View.VISIBLE
// xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time)
// } else {
// mBinding?.xlhRk?.visibility = View.INVISIBLE
// releaseCountDownTimer1()
// }
//
// if (mRoomInfoResp!!.hour_ranking_open == 1) {
// mBinding!!.clXsb.visibility = View.VISIBLE
// } else {
// mBinding!!.clXsb.visibility = View.GONE
// }
}
protected fun tzblChanged() {
@@ -3476,7 +3551,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
// }
if (mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
.toString() + "" && mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.room_info.type_id != "2" && mRoomInfoResp!!.room_info.type_id != "6"
.toString() + "" && mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.room_info.type_id == "1" && mRoomInfoResp!!.room_info.label_id != "1"
) {
rlMore(true)
} else {
@@ -3527,7 +3602,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
mBinding!!.ivQuanC.setOnClickListener { v: View? ->
if (mRoomInfoResp!!.room_info.head_line.room_id != null && mRoomInfoResp!!.room_info.head_line.room_id.isNotEmpty()) {
if (mRoomInfoResp!!.room_info.head_line.room_id != roomId) {
RoomManager.getInstance().fetchRoomDataAndEnter(applicationContext, mRoomInfoResp!!.room_info.head_line.room_id, "",null)
RoomManager.getInstance().fetchRoomDataAndEnter(
applicationContext,
mRoomInfoResp!!.room_info.head_line.room_id,
"",
null
)
} else {
com.blankj.utilcode.util.ToastUtils.showLong("您就在当前房间")
}
@@ -3746,7 +3826,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
if (isInBackground) {
isInBackground = false
MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)
// MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)
}
// 检查是否从最小化状态恢复
@@ -3757,7 +3837,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
resumeRoomState()
setupEffectView()
MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId)
// MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId)
}
// 延迟调整布局,确保视图已经完全加载
@@ -3927,93 +4007,93 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
return
}
this.mRoomInfoResp = resp
setview(resp)
val roomBean = resp.room_info
if (roomBean!!.type_id.equals("6")) {
// val roomBean = resp.room_info
// if (roomBean!!.type_id.equals("6")) {
//
//// upHeight()
// initPublicScreenFragment()
// if (!isFinishing && !isDestroyed) {
// resetFragment()
// upHeight()
// } else {
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
// }
// return
// }
// this.mRoomBean = roomBean
// this.mRoomUserBean = resp.user_info
// this.mRoomOwnerBean = resp.room_owner
// this.mPitList = mRoomBean!!.pit_list!!
//
// ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
// mBinding!!.roomTop.name.text = roomBean.room_name
// mBinding!!.roomTop.idVal.text = roomBean.room_number
// if (mRoomUserBean?.getIs_room_owner() == 1) {
// mBinding!!.roomTop.btnFollow.visibility = View.GONE
// } else {
// mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
// if (resp.isCollect) {
// mBinding!!.roomTop.btnFollow.background =
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
// mBinding!!.roomTop.btnFollow.text = ""
// }
// }
// initPublicScreenFragment()
// if (!isFinishing && !isDestroyed) {
// resetFragment()
// upHeight()
initPublicScreenFragment()
if (!isFinishing && !isDestroyed) {
resetFragment()
upHeight()
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
}
return
}
this.mRoomBean = roomBean
this.mRoomUserBean = resp.user_info
this.mRoomOwnerBean = resp.room_owner
this.mPitList = mRoomBean!!.pit_list!!
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
mBinding!!.roomTop.name.text = roomBean.room_name
mBinding!!.roomTop.idVal.text = roomBean.room_number
if (mRoomUserBean?.getIs_room_owner() == 1) {
mBinding!!.roomTop.btnFollow.visibility = View.GONE
} else {
mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
if (resp.isCollect) {
mBinding!!.roomTop.btnFollow.background =
resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
mBinding!!.roomTop.btnFollow.text = ""
}
}
initPublicScreenFragment()
if (!isFinishing && !isDestroyed) {
resetFragment()
upHeight()
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
}
if (mRoomUserBean?.getIs_collect() == 1) {
mBinding!!.roomTop.btnFollow.background =
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
mBinding!!.roomTop.btnFollow.text = ""
} else {
// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
ThemeableDrawableUtils.setThemeableRoundedBackground(
mBinding!!.roomTop.btnFollow,
ColorManager.getInstance().primaryColorInt,
53
)
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
mBinding!!.roomTop.btnFollow.text = "收藏"
}
if ((resp.room_info.type_id == "3" || resp.room_info.type_id == "1" || resp.room_info.type_id == "4") && resp.room_info.label_id == "2") {
AgoraManager.getInstance(this).isBjMusic = false
} else {
AgoraManager.getInstance(this).isBjMusic = true
}
AgoraManager.stopMuisc()
if (!CommonAppContext.getInstance().isMai) {
initializeAudio()
}
if (mRoomInfoResp!!.room_info.label_id == "2" || mRoomInfoResp!!.room_info.type_id == "7") {
mBinding!!.rlMore.visibility = View.GONE
// mBinding.rlMisc.setVisibility(GONE);
} else if (mRoomInfoResp!!.room_info.label_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "4" ||
mRoomInfoResp!!.room_info.type_id == "8"
) {
mBinding!!.rlMore.visibility = View.GONE
mBinding!!.rlMisc.visibility = View.VISIBLE
}
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
mBinding!!.rlMore.visibility = View.GONE
mBinding!!.rlMisc.visibility = View.GONE
}
if (mRoomInfoResp!!.hour_ranking_open == 1) {
mBinding!!.clXsb.visibility = View.VISIBLE
} else {
mBinding!!.clXsb.visibility = View.GONE
}
// } else {
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
// }
//
// if (mRoomUserBean?.getIs_collect() == 1) {
// mBinding!!.roomTop.btnFollow.background =
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
// mBinding!!.roomTop.btnFollow.text = ""
// } else {
//// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
// ThemeableDrawableUtils.setThemeableRoundedBackground(
// mBinding!!.roomTop.btnFollow,
// ColorManager.getInstance().primaryColorInt,
// 53
// )
// mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
// mBinding!!.roomTop.btnFollow.text = "收藏"
// }
// if ((resp.room_info.type_id == "3" || resp.room_info.type_id == "1" || resp.room_info.type_id == "4") && resp.room_info.label_id == "2") {
// AgoraManager.getInstance(this).isBjMusic = false
// } else {
// AgoraManager.getInstance(this).isBjMusic = true
// }
//
//
// AgoraManager.stopMuisc()
// if (!CommonAppContext.getInstance().isMai) {
// initializeAudio()
// }
//
// if (mRoomInfoResp!!.room_info.label_id == "2" || mRoomInfoResp!!.room_info.type_id == "7") {
// mBinding!!.rlMore.visibility = View.GONE
// // mBinding.rlMisc.setVisibility(GONE);
// } else if (mRoomInfoResp!!.room_info.label_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "4" ||
// mRoomInfoResp!!.room_info.type_id == "8"
// ) {
// mBinding!!.rlMore.visibility = View.GONE
// mBinding!!.rlMisc.visibility = View.VISIBLE
// }
//
// if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
// mBinding!!.rlMore.visibility = View.GONE
// mBinding!!.rlMisc.visibility = View.GONE
// }
//
// if (mRoomInfoResp!!.hour_ranking_open == 1) {
// mBinding!!.clXsb.visibility = View.VISIBLE
// } else {
// mBinding!!.clXsb.visibility = View.GONE
// }
}
fun upHeight() {
@@ -4047,7 +4127,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
.replace(R.id.vp_room_pager, roomFragment!!)
.commitAllowingStateLoss()
}
if ("7" == typeId) {
if (mRoomInfoResp!!.room_info.room_background == null || mRoomInfoResp!!.room_info.room_background == "") {
changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj)
@@ -4141,7 +4220,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
// AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId,
// ""
// )
MvpPre?.getRoomIn(AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId, "")
if (AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId != null && !AgoraManager.getInstance(
OkDownloadProvider.context
).lastRoomId.isEmpty()
) {
MvpPre?.getRoomIn(AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId, "")
}
AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId = ""
// setviewyc(true);
// exitFullScreen()
@@ -4242,6 +4326,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
GiftDisplayManager.getInstance().clearAll()
mBinding!!.giftContainer.removeAllViews()
CommonAppContext.getInstance().isMai = false
// 确保父类的 onDestroy 被调用
super.finish()
}

View File

@@ -4,6 +4,7 @@ import android.app.Activity;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import com.xscm.moduleutil.bean.PkSwTokenBean;
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
@@ -22,6 +23,8 @@ public class SingSongContacts {
void endPk();
void userOnlineStatus(List<UserOnlineStatusBean> list);
void postAgora(PkSwTokenBean pkSwTokenBean);
}
public interface IEmotionRoomPre extends IPresenter {

View File

@@ -212,7 +212,13 @@ public class RoomPkDialogFragment extends BaseMvpDialogFragment<RoomPkPresenter,
@Override
public void searchPkRoom(List<RoomBean> roomBeans) {
mAdapter.setNewData(roomBeans);
if (page==1) {
mAdapter.setNewData(roomBeans);
}else {
if (roomBeans!=null) {
mAdapter.addData(roomBeans);
}
}
}
@Override

View File

@@ -846,7 +846,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;
int popupWidth = (int) (screenWidth * 0.35); // 屏幕宽度的 60%
int popupWidth = (int) (screenWidth * 0.25); // 屏幕宽度的 60%
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%

View File

@@ -824,7 +824,11 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
return;
}
if (roomId == null || !message.getRoomId().contains(roomId)) {
// if (roomId == null ) {
// return;
// }
if (roomId == null ||(!message.getRoomId().contains(roomId)&&message.getMsgType()!=125)) {
return;
}
@@ -931,6 +935,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
case 1061:
case 1025:
case 1058:
case 125:
// EventBus.getDefault().post(message);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).roomInfoEvent(message);
@@ -1013,6 +1019,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
private EMMessageInfo createMessageInfoIfNeeded(RoomMessageEvent message) {
int msgType = message.getMsgType();
RoomMessageEvent.T text = message.getText();
if (text.getIs_pk()!=null&&text.getIs_pk().equals("1")){
return null;
}
switch (msgType) {
case 1001:
@@ -1044,6 +1053,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
}
private void addSingleMessage(RoomMessageEvent message) {
if (message.getText().getIs_pk()!=null&&message.getText().getIs_pk().equals("1")){
return;
}
if (easeChatAdapter != null) {
if (message.getMsgType() == 1049) {
if (message.getText().getStep() != 3) {

View File

@@ -162,7 +162,74 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
protected void initData() {
if (roomInfoResp == null) return;
if (roomInfoResp != null) {
roomId = roomInfoResp.getRoom_info().getRoom_id();
cpUserBean = roomInfoResp.getCp_user();
label_id = roomInfoResp.getRoom_info().getLabel_id();
}
if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
mBinding.im3.setVisibility(VISIBLE);
// setvkk(false);
}else {
mBinding.im3.setVisibility(GONE);
}
mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
// 获取当前用户 ID
String currentUserId = SpUtil.getUserId() + "";
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
boolean isSelfFirst = false;
// 判断当前用户是 user_id 还是 user_id1
if (cpUserBean != null) {
if (currentUserId.equals(cpUserBean.getUser_id())) {
// 当前用户是 user_id
selfBean.setUser_id(cpUserBean.getUser_id());
selfBean.setUser_code(cpUserBean.getUser_code());
selfBean.setNickname(cpUserBean.getNickname());
selfBean.setAvatar(cpUserBean.getAvatar());
selfBean.setDress(cpUserBean.getDress());
selfBean.setPit_number("000");
otherBean.setUser_id(cpUserBean.getUser_id1());
otherBean.setUser_code(cpUserBean.getUser_code1());
otherBean.setNickname(cpUserBean.getNickname1());
otherBean.setAvatar(cpUserBean.getAvatar1());
otherBean.setDress(cpUserBean.getDress1());
otherBean.setPit_number("000");
} else if (currentUserId.equals(cpUserBean.getUser_id1())) {
// 当前用户是 user_id1则交换位置
selfBean.setUser_id(cpUserBean.getUser_id1());
selfBean.setUser_code(cpUserBean.getUser_code1());
selfBean.setNickname(cpUserBean.getNickname1());
selfBean.setAvatar(cpUserBean.getAvatar1());
selfBean.setDress(cpUserBean.getDress1());
selfBean.setPit_number("000");
otherBean.setUser_id(cpUserBean.getUser_id());
otherBean.setUser_code(cpUserBean.getUser_code());
otherBean.setNickname(cpUserBean.getNickname());
otherBean.setAvatar(cpUserBean.getAvatar());
otherBean.setDress(cpUserBean.getDress());
otherBean.setPit_number("000");
}
}
// 不论谁是自己,始终将自己放在 roomMakeWheat1
mBinding.roomMakeWheat1.setData(selfBean);
// 将另一个用户的数据放在 roomMakeWheat2
mBinding.roomMakeWheat2.setData(otherBean);
mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
if (cpUserBean != null) {
countDownTime(Long.parseLong(cpUserBean.getTime_day()));
}
}
private SharedViewModel sharedViewModel;
@@ -694,7 +761,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
((RoomActivity) getActivity()).quitRoom2(roomId);
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
((RoomActivity) getActivity()).jiaR();
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
//// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
return;
}else {
((RoomActivity) getActivity()).performExitRoom(1);

View File

@@ -658,7 +658,9 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
Fragment newFragment = null;
// if (getActivity() instanceof RoomActivity) {
// ((RoomActivity) getActivity()).setviewyc(true);
// }
if ("1".equals(typeId)) {
if ("1".equals(labelId)) {
singSongFragment = SingSongFragment.newInstance(mRoomInfoResp);

View File

@@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ObjectUtils;
import com.example.moduleroom.R;
import com.example.moduleroom.activity.RoomActivity;
@@ -49,6 +50,7 @@ import com.hjq.toast.ToastUtils;
import com.luck.picture.lib.utils.DoubleUtils;
import com.xscm.moduleutil.base.BaseRoomFragment;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.PkSwTokenBean;
import com.xscm.moduleutil.bean.RoomMessageEvent;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
@@ -63,6 +65,7 @@ import com.xscm.moduleutil.event.RoomWheatEvent;
import com.xscm.moduleutil.event.UserInfoShowEvent;
import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.rtc.AgoraManager;
import com.xscm.moduleutil.rtc.AgoraManagerEx;
import com.xscm.moduleutil.utils.GsonUtils;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil;
@@ -85,6 +88,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@@ -136,6 +140,13 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id();
}
@Override
protected void initView() {
super.initView();
mBinding.btSta.setOnClickListener(this);
mBinding.btStop.setOnClickListener(this);
mBinding.imMkf.setOnClickListener(this);
}
@Override
protected SingSongPresenter bindPresenter() {
@@ -144,6 +155,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
@Override
protected void initData() {
// Observable.timer(20, TimeUnit.MILLISECONDS)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(aLong -> {
@@ -154,6 +166,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
.subscribe(aLong -> {
upDtaView(false);
});
}
public void upRoomInfo(RoomInfoResp roomInfoResp) {
@@ -166,8 +180,16 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
((RoomActivity) getActivity()).setvisibTop(true);
}
// 初始化 PopupWindow
if (roomInfoResp != null) {
if (roomInfoResp.getPk_info() != null) {
upWheter();
updateWheatData();
} else {
isWhether2(isFirst);
}
}
isWhether2(isFirst);
parentFragment = (RoomFragment) getParentFragment();
}
@@ -184,7 +206,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// roomInfoUpdate(data);
// }
// });
roomId = roomInfoResp.getRoom_info().getRoom_id(); initPopupWindow();
roomId = roomInfoResp.getRoom_info().getRoom_id();
initPopupWindow();
return super.onCreateView(inflater, container, savedInstanceState);
}
@@ -231,34 +254,39 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
/// 抱麦、锁麦
private void initPopupWindow() {
// 加载弹出视图布局
View popupView = LayoutInflater.from(getContext()).inflate(R.layout.popup_menu, null, false);
// 加载弹出视图布局
View popupView = LayoutInflater.from(getContext()).inflate(R.layout.popup_menu, null, false);
// 创建 PopupWindow
// popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
// 设置固定宽高(单位是像素)
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;
// 创建 PopupWindow
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
// 设置固定宽高(单位是像素)
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;
int popupWidth = (int) (screenWidth * 0.35); // 屏幕宽度的 60%
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%
int popupWidth = (int) (screenWidth * 0.25); // 屏幕宽度的 60%
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%
// 创建 PopupWindow使用.WRAP_CONTENT实现自适应
// popupWindow = new PopupWindow(popupView,
// ViewGroup.LayoutParams.WRAP_CONTENT,
// ViewGroup.LayoutParams.WRAP_CONTENT,
// true);
popupWindow = new PopupWindow(popupView, popupWidth, popupHeight, true);
popupWindow = new PopupWindow(popupView, popupWidth, popupHeight, true);
// 必须设置背景,否则布局会压缩
popupWindow.setBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.drawable.bg_r16_fff));
// 必须设置背景,否则布局会压缩
popupWindow.setBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.drawable.bg_r16_fff));
// 设置动画效果(可选)
popupWindow.setAnimationStyle(com.xscm.moduleutil.R.style.PopupAnimation);
// 设置动画效果(可选)
popupWindow.setAnimationStyle(com.xscm.moduleutil.R.style.PopupAnimation);
// 设置点击外部区域时自动关闭
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
// 设置点击外部区域时自动关闭
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
// 设置弹出视图中的点击事件
setPopupMenuClickListener(popupView, null);
// 设置弹出视图中的点击事件
setPopupMenuClickListener(popupView, null);
}
private void setPopupMenuClickListener(View popupView, View view) {
@@ -405,11 +433,6 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mBinding.cl.setVisibility(View.GONE);
mBinding.btSta.setOnClickListener(this);
mBinding.btStop.setOnClickListener(this);
mBinding.imMkf.setOnClickListener(this);
FlexboxLayout flexboxLayout = mBinding.flexboxLayout;
wheatLayoutSingManager = new WheatLayoutSingManager(CommonAppContext.getInstance(), flexboxLayout);
if (!isFirst) {
@@ -475,6 +498,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} else {
mBinding.flexboxLayout.setVisibility(View.GONE);
mBinding.cl.setVisibility(View.VISIBLE);
MvpPre.postRoomInfo(roomInfoResp.getPk_info().getPk_room_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
}
if (roomInfoResp.getUser_info().getPit_number() != 9) {
@@ -730,7 +754,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
updateWheatData();
}
private boolean aBoolean = false;
private boolean aBoolean = true;
private int is_mute;
@Override
@@ -739,8 +763,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
if (id == R.id.bt_sta) {
PkTimeDialogFragment.show(roomInfoRespPk.getPk_info().getPk_id(), getChildFragmentManager());
} else if (id == R.id.bt_stop) {
if (roomInfoRespPk.getPk_info().getPk_part().equals("3") && pkStatus == 0) {
pkStutas();
//TODO 多次点击导致闪退
if (roomInfoRespPk == null)
return;
if (pkStatus == 0) {
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
pkStutas();
}else {
pkStutasT();
}
} else {
MvpPre.endPk(roomInfoRespPk.getPk_info().getPk_id(), "3", SpUtil.getUserId() + "");
}
@@ -749,28 +780,29 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
is_mute = 0;
aBoolean = false;
AgoraManager.getInstance(getActivity()).muteAllRemoteAudioStreamsEx(false);
AgoraManagerEx.getInstance(getActivity()).muteAllRemoteAudioStreamsExUserId(false);
} else {
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone_off);
is_mute = 1;
aBoolean = true;
AgoraManager.getInstance(getActivity()).muteAllRemoteAudioStreamsEx(true);
AgoraManagerEx.getInstance(getActivity()).muteAllRemoteAudioStreamsExUserId(true);
}
RoomMessageEvent.text text = new RoomMessageEvent.text();
text.setIs_mute(is_mute);
String s = com.blankj.utilcode.util.GsonUtils.toJson(text);
RoomMessageEvent.T t = new RoomMessageEvent.T();
t.setText(s);
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(125, roomInfoResp.getPk_info().getPk_room_id(), t);
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
// 转换为 byte[]
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
// 创建自定义消息
MessageListenerSingleton.getInstance().sendCustomC2CMessage(
roomInfoRespPk.getRoom_info().getPit_list().get(8).getUser_id(),
binaryData
);
if (roomInfoRespPk!=null && roomInfoRespPk.getPk_info() != null) {
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(125, roomInfoResp.getRoom_info().getRoom_id(), t);
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
// 转换为 byte[]
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
// 创建自定义消息
MessageListenerSingleton.getInstance().sendCustomC2CMessage(
roomInfoRespPk.getRoom_info().getPit_list().get(8).getUser_id(),
binaryData
);
}
}
}
@@ -829,12 +861,25 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
@Override
public void postRoomInfoUp(RoomInfoResp resp) {
roomInfoResp = resp;
if (roomInfoRespPk != null) {
getToView();
}
tzblChanged();
}
@Override
public void endPk() {
//TODO 有多次进入的现象
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null)
// return;
// //释放定时器
releaseCountDownTimer();
//
// AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
// MvpPre.postRoomInfo(roomId, "0", 2);
// mBinding.imStart2.setVisibility(GONE);
// mBinding.imStart.setVisibility(GONE);
// roomInfoRespPk = null;
}
private Handler handler = new Handler(Looper.getMainLooper());
@@ -860,7 +905,31 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
}
}
@Override
public void postAgora(PkSwTokenBean pkSwTokenBean) {
String pkUserId = "";
String pkRoomId="";
if (roomInfoRespPk.getPk_info() != null) {
if (roomInfoRespPk.getPk_info().getInvite_pk_user_id().equals(SpUtil.getUserId()+"")) {
pkUserId = roomInfoRespPk.getPk_info().getReceive_pk_user_id();
} else {
pkUserId = roomInfoRespPk.getPk_info().getInvite_pk_user_id();
}
}
LogUtils.e("pk_info", ""+pkUserId);
LogUtils.e("pk_info", ""+roomInfoRespPk.getRoom_info().getRoom_id());
LogUtils.e("pk_info2", ""+roomInfoResp.getRoom_info().getRoom_id());
AgoraManagerEx.getInstance(CommonAppContext.getInstance())
.joinChannelEx(pkSwTokenBean.getAgora_token(), roomInfoRespPk.getRoom_info().getRoom_id(), pkUserId);
// AgoraManager.getInstance(getView().getSelfActivity()).muteAllRemoteAudioStreamsExUserId(false, invite_pk_user_id);
}
private void pkView() {
if (wheatLayoutSingManager != null) {
wheatLayoutSingManager.release();
}
mBinding.flexboxLayout.setVisibility(View.GONE);
mBinding.cl.setVisibility(VISIBLE);
FlexboxLayout flexboxLayout = mBinding.flexboxLayout1;
@@ -868,7 +937,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
wheatLayoutManager1.setOnWheatClickListener(new WheatLayoutManager.OnWheatClickListener() {
@Override
public void onWheatClick(RoomDefaultWheatView view, int pitNumber1) {
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
RoomPitBean pitBean = view.pitBean;
// 可选:点击事件处理
Log.d("Wheat", "Clicked pit: " + pitNumber1);
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
@@ -901,7 +970,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
@Override
public void onMakeWheatClick(RoomDefaultWheatView view, int pitNumber) {
RoomPitBean pitBean = roomInfoRespPk.getRoom_info().getPit_list().get(pitNumber - 1);
RoomPitBean pitBean = view.pitBean;
// 可选:点击事件处理
Log.d("Wheat", "Clicked pit: " + pitNumber);
@@ -938,7 +1007,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
wheatLayoutManager2.setOnWheatClickListener(new WheatLayoutManager.OnWheatClickListener() {
@Override
public void onWheatClick(RoomDefaultWheatView view, int pitNumber1) {
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
RoomPitBean pitBean = view.pitBean;
// 可选:点击事件处理
Log.d("Wheat", "Clicked pit: " + pitNumber1);
@@ -971,7 +1040,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
@Override
public void onMakeWheatClick(RoomDefaultWheatView view, int pitNumber) {
RoomPitBean pitBean = roomInfoRespPk.getRoom_info().getPit_list().get(pitNumber - 1);
RoomPitBean pitBean = view.pitBean;
// 可选:点击事件处理
Log.d("Wheat", "Clicked pit: " + pitNumber);
@@ -979,7 +1048,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
return;
}
RoomUserInfoFragment.show(roomInfoRespPk.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
// 点击的麦位是当前麦位
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
}
@@ -1015,21 +1084,57 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// 设置进度
mBinding.pkProgress.setAnimProgress(progress);
if (roomInfoResp.getUser_info().getPit_number() == 9) {
mBinding.btStop.setVisibility(View.VISIBLE);
LogUtils.e("pk_info_1", "getToView: " + roomInfoRespPk.getPk_info());
LogUtils.e("pk_info_2", "getToView: " + roomInfoResp.getPk_info());
if (roomInfoResp.getPk_info()==null ){
MvpPre.postRoomInfo(roomId, roomInfoResp.getUser_info().getPit_number() + "", 3);
return;
}
if (Objects.equals(roomInfoRespPk.getUser_info().getUser_id(), roomInfoRespPk.getPk_info().getInvite_pk_user_id())) {
mBinding.btStop.setVisibility(VISIBLE);
mBinding.btSta.setVisibility(View.VISIBLE);
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
mBinding.btStop.setVisibility(INVISIBLE);
mBinding.btStop.setVisibility(VISIBLE);
}
if (roomInfoResp.getPk_info() != null) {
if (roomInfoResp.getPk_info().getPk_part().equals("3")) {
mBinding.btSta.setVisibility(INVISIBLE);
}
if (roomInfoRespPk.getPk_info().getPk_part().equals("3")) {
mBinding.btSta.setVisibility(INVISIBLE);
}
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
mBinding.btSta.setVisibility(VISIBLE);
}
}else if (roomInfoRespPk.getUser_info().getPit_number() == 9) {
mBinding.btStop.setVisibility(VISIBLE);
mBinding.btSta.setVisibility(View.INVISIBLE);
} else {
mBinding.btStop.setVisibility(VISIBLE);
mBinding.btSta.setVisibility(View.INVISIBLE);
}
if (Objects.equals(roomInfoResp.getUser_info().getUser_id(), roomInfoResp.getPk_info().getInvite_pk_user_id()!=null ? roomInfoResp.getPk_info().getInvite_pk_user_id():"0")) {
mBinding.btStop.setVisibility(VISIBLE);
mBinding.btSta.setVisibility(View.VISIBLE);
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
mBinding.btStop.setVisibility(VISIBLE);
}
if (roomInfoRespPk.getPk_info().getPk_part().equals("3")) {
mBinding.btSta.setVisibility(INVISIBLE);
}
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
mBinding.btSta.setVisibility(VISIBLE);
}
} else if (roomInfoResp.getUser_info().getPit_number() == 9) {
mBinding.btStop.setVisibility(VISIBLE);
mBinding.btSta.setVisibility(View.INVISIBLE);
} else {
mBinding.btStop.setVisibility(INVISIBLE);
mBinding.btSta.setVisibility(INVISIBLE);
mBinding.btSta.setVisibility(View.INVISIBLE);
}
releaseCountDownTimer();
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
// mBinding.tvPkDjs.setText("等待开始");
@@ -1048,6 +1153,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} else if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
countDownTime(Long.parseLong(roomInfoRespPk.getPk_info().getPk_end_times() != null ? roomInfoRespPk.getPk_info().getPk_end_times() : "0"), 2);
}
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
}
// 添加一个方法来启动倒计时
@@ -1140,194 +1248,14 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mCountDownTimer.cancel();
mCountDownTimer = null;
mBinding.tvPkDjs.setVisibility(GONE);
}
if (mCountDownTimersta != null) {
mCountDownTimersta.cancel();
mCountDownTimersta = null;
mBinding.tvPkDjs.setVisibility(GONE);
}
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onMessageReceived(RoomMessageEvent message) {
// boolean b = false;
//
// if (message.getMsgType() == 1003) {
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
// pitBean.setUser_id(message.getText().getFromUserInfo().getUser_id() + "");
// pitBean.setAvatar(message.getText().getFromUserInfo().getAvatar());
// pitBean.setNickname(message.getText().getFromUserInfo().getNickname());
// pitBean.setSex(message.getText().getFromUserInfo().getSex() + "");
// pitBean.setCharm(message.getText().getFromUserInfo().getCharm());
// pitBean.setDress(message.getText().getFromUserInfo().getDress());
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(message.getText().getPit_number()) - 1, pitBean);
//// if (roomInfoResp.getPk_info()==null) {
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
// } else {
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
// }
//// }else {
//// wheatLayoutManager.setWheatDataPk(roomInfoResp.getRoom_info().getPit_list(), 1);
//// }
// // 通知父 Fragment
// if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
// b = true;
// AgoraManager.getInstance(getActivity()).ClientRole(true);
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
// } else {
// b = false;
// }
// if (parentFragment != null) {
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), true, b);
// }
// } else if (message.getMsgType() == 1004) {
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
// pitBean.setUser_id("");
// pitBean.setAvatar("");
// pitBean.setNickname("");
// pitBean.setSex("");
// pitBean.setCharm("");
// pitBean.setDress("");
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(message.getText().getPit_number()) - 1, pitBean);
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
// } else {
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
// }
// if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
// b = true;
// AgoraManager.getInstance(getActivity()).ClientRole(false);
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
// } else {
// b = false;
// }
//// AgoraManager.getInstance(getActivity()).setEnableAudio(b);
// if (parentFragment != null) {
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), false, b);
// }
// } else if (message.getMsgType() == 1005) {
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
// } else {
// for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
//
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
// }
// } else if (message.getMsgType() == 1030) {
// MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
// if (message.getText().getType() == 1) {
// MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
// if (message.getText().getRoom_id().equals(roomId)) {
// mBinding.btSta.setVisibility(VISIBLE);
// } else {
// mBinding.btSta.setVisibility(INVISIBLE);
// }
//// parentFragment.setRoleType(5, -11);
// if (getActivity() instanceof RoomActivity) {
// ((RoomActivity) getActivity()).setRoleType(5, -11);
// }
// }
// } else if (message.getMsgType() == 1031) {
// countDownTime(Long.parseLong(message.getText().getPk_end_times()), 1);
// mBinding.btSta.setVisibility(INVISIBLE);
// } else if (message.getMsgType() == 1032) {
//// PkResultDialogFragment pkResultDialogFragment = new PkResultDialogFragment(requireContext(), message);
//// pkResultDialogFragment.show();
// showCountDownDialog(requireContext(), message);
// ivitTop(message);
//// parentFragment.setRoleType(3, -11);
// if (getActivity() instanceof RoomActivity) {
// ((RoomActivity) getActivity()).setRoleType(3, -11);
// }
// } else if (message.getMsgType() == 1033) {
// AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
// MvpPre.postRoomInfo(roomId, "0", 2);
// mBinding.imStart2.setVisibility(GONE);
// mBinding.imStart.setVisibility(GONE);
//// parentFragment.setRoleType(3, -11);
// if (getActivity() instanceof RoomActivity) {
// ((RoomActivity) getActivity()).setRoleType(3, -11);
// }
// roomInfoRespPk = null;
//
// } else if (message.getMsgType() == 1015) {
// String roomIdA = message.getText().getRoom_id_a();
// String roomIdB = message.getText().getRoom_id_b();
// String createValueA = message.getText().getCreate_value_a();
// String receiveValueB = message.getText().getReceive_value_b();
//
// if (roomIdA.equals(roomId)) {
// // 当前 roomId 与 roomIdA 相同
// mBinding.tvPkLeftValue.setText(createValueA);
// mBinding.tvPkRightValue.setText(receiveValueB);
// mBinding.pkProgress.setAnimProgress(100f * Integer.parseInt(createValueA) / (Integer.parseInt(createValueA) + Integer.parseInt(receiveValueB)));
//
// } else if (roomIdB.equals(roomId)) {
// // 当前 roomId 与 roomIdB 相同
// mBinding.tvPkLeftValue.setText(receiveValueB);
// mBinding.tvPkRightValue.setText(createValueA);
// mBinding.pkProgress.setAnimProgress(100f * Integer.parseInt(receiveValueB) / (Integer.parseInt(createValueA) + Integer.parseInt(receiveValueB)));
//
// }
// } else if (message.getMsgType() == 125) {
// RoomMessageEvent.text text = com.blankj.utilcode.util.GsonUtils.fromJson(message.getText().getText(), RoomMessageEvent.text.class);
// if (text.getIs_mute() == 1) {
// AgoraManager.getInstance(getContext()).ClientRole(false);
// AgoraManager.getInstance(getContext()).muteLocalAudioStreamEx(false, SpUtil.getUserId());
// } else {
// AgoraManager.getInstance(getContext()).ClientRole(true);
// AgoraManager.getInstance(getContext()).muteLocalAudioStreamEx(true, SpUtil.getUserId());
//
// }
// } else if (message.getMsgType() == 1007) {
// roomInfoResp.getUser_info().setIs_host(1);
// } else if (message.getMsgType() == 1018) {
// roomInfoResp.getUser_info().setIs_host(0);
// } else if (message.getMsgType() == 126) {
// AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, message.getText().getFromUserInfo().getUser_id() + "");
// } else if (message.getMsgType() == 1021) {
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// pitBean.setCharm("0");
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// } else if (message.getMsgType() == 1037) {
/// / 对方想结束本次pk是否同意
// if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// queren();
// }
// } else if (message.getMsgType() == 1035) {
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getFromUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getFromUserInfo().getCharm());
// pitBean.setAvatar(message.getText().getFromUserInfo().getAvatar());
// pitBean.setNickname(message.getText().getFromUserInfo().getNickname());
// pitBean.setSex(message.getText().getFromUserInfo().getSex() + "");
// pitBean.setDress(message.getText().getFromUserInfo().getDress());
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
//
// }
// }
public void event1021(RoomMessageEvent message) {
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
pitBean.setCharm("0");
@@ -1356,7 +1284,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
}
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
} else {
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
}
}
@@ -1377,7 +1305,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number() != null ? roomPitBean.getPit_number() : "0"));
}
} else {
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
}
}
@@ -1389,9 +1317,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
wheatLayoutSingManager.setUpData(message);
} else {
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
if (message.getText().getIs_pk() == null) {
wheatLayoutManager1.setUpData(message, 1);
} else {
wheatLayoutManager2.setUpData(message, 2);
}
// for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
// wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
// }
}
}
@@ -1420,7 +1354,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// ((RoomActivity) getActivity()).ivSoundEffects(true);
// }
// }
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
if (message.getText().getIs_pk() == null) {
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 1);
} else {
wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 2);
}
}
// 通知父 Fragment
if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
@@ -1459,7 +1397,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// ((RoomActivity) getActivity()).ivSoundEffects(false);
// }
// }
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
if (message.getText().getIs_pk() == null) {
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 1);
} else {
wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 2);
}
}
if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
b = true;
@@ -1488,28 +1430,6 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
updateCharmForUser(toUserInfo);
}
}
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutSingManager.upDataCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
// } else {
// for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
//
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
// wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
// }
// }
// }
}
/**
@@ -1536,7 +1456,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
if (pitBean.getUser_id().equals(userId)) {
pitBean.setCharm(charm);
wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()), 2);
break;
}
}
@@ -1545,7 +1465,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
if (pitBean.getUser_id().equals(userId)) {
pitBean.setCharm(charm);
wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
break;
}
}
@@ -1554,14 +1474,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
/// 1030
public void event1030(RoomMessageEvent message) {
MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
if (message.getText().getType() == 1) {
MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
if (message.getText().getRoom_id().equals(roomId)) {
mBinding.btSta.setVisibility(VISIBLE);
} else {
mBinding.btSta.setVisibility(INVISIBLE);
}
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).setRoleType(5, -11);
}
@@ -1582,7 +1498,14 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
/// 1033
public void event1033(RoomMessageEvent message) {
AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
//TODO 有多次进入的现象
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null)
return;
//释放定时器
releaseCountDownTimer();
if (roomInfoRespPk.getRoom_info() != null && roomInfoRespPk.getRoom_info().getRoom_id() != null) {
AgoraManagerEx.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
}
MvpPre.postRoomInfo(roomId, "0", 2);
mBinding.imStart2.setVisibility(GONE);
mBinding.imStart.setVisibility(GONE);
@@ -1591,7 +1514,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
/// 1037
public void event1037(RoomMessageEvent message) {
if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
if (roomInfoResp.getUser_info().getPit_number() == 9 && roomInfoRespPk.getPk_info().getInvite_pk_user_id().equals(message.getText().getFromUserInfo().getUser_id()+"")) {
queren();
}
}
@@ -1667,6 +1590,22 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
}, false, 0).show();
}
private void pkStutasT() {
// 创建并显示确认对话框
new ConfirmDialog(getActivity(),
"提示",
"是否提前结束本场PK",
"确认",
"取消",
v -> {
// 点击“确认”按钮时执行删除操作
MvpPre.endPk(roomInfoRespPk.getPk_info().getPk_id(), "3", SpUtil.getUserId() + "");
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
private int pkStatus;
private void ivitTop(RoomMessageEvent message) {
@@ -1686,6 +1625,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mBinding.imStart.setImageResource(com.xscm.moduleutil.R.mipmap.ping);
mBinding.imStart2.setImageResource(com.xscm.moduleutil.R.mipmap.ping);
}
roomInfoRespPk.getPk_info().setPk_part("4");
countDownTime(Long.parseLong(message.getText().getEnd_time()), 2);
}

View File

@@ -2,6 +2,7 @@ package com.example.moduleroom.presenter;
import android.content.Context;
import com.blankj.utilcode.util.LogUtils;
import com.example.moduleroom.contacts.SingSongContacts;
import com.xscm.moduleutil.base.BaseRoomPresenter;
import com.xscm.moduleutil.base.CommonAppContext;
@@ -11,6 +12,7 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.rtc.AgoraManager;
import com.xscm.moduleutil.rtc.AgoraManagerEx;
import com.xscm.moduleutil.utils.SpUtil;
import java.lang.ref.WeakReference;
@@ -93,8 +95,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
String token = roomInfoResp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
if (roomInfoResp==null){
return;
}
String roomId = roomInfoResp.getRoom_info().getRoom_id(); // 房间 ID
String rtm_token = roomInfoResp.getUser_info().getAgora_rtm_token();
SpUtil.setRtmToken(rtm_token);
@@ -103,16 +106,18 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
if (type==1) {
if (roomInfoResp.getPk_info() != null) {
if (number.equals("9")) {
postRoomSwToken(roomId,uid);
LogUtils.e("pk_info", ""+number);
postRoomSwToken(roomId,uid,roomInfoResp.getPk_info().getInvite_pk_user_id());
///添加多频道
}
}
MvpRef.get().postRoomInfoPk(roomInfoResp);
// postRoomInfo(SpUtil.getMyRoomId(),"9",3);
}else if (type==3){
AgoraManager.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
// AgoraManagerEx.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
MvpRef.get().postRoomInfoUp(roomInfoResp);
}else {
AgoraManager.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
// AgoraManagerEx.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
MvpRef.get().postRoomInfo(roomInfoResp);
}
@@ -156,7 +161,7 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
});
}
public void postRoomSwToken(String roomId,int uid) {
public void postRoomSwToken(String roomId,int uid,String invite_pk_user_id) {
RetrofitClient.getInstance().postRoomSwToken(roomId, new BaseObserver<PkSwTokenBean>() {
@Override
public void onSubscribe(Disposable d) {
@@ -167,8 +172,14 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
public void onNext(PkSwTokenBean pkSwTokenBean) {
if (pkSwTokenBean!=null){
if (pkSwTokenBean.getAgora_token() != null){
AgoraManager.getInstance(getView().getSelfActivity())
.joinChannelEx(pkSwTokenBean.getAgora_token(), roomId, uid);
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().postAgora(pkSwTokenBean);
// AgoraManager.getInstance(getView().getSelfActivity())
// .joinChannelEx(pkSwTokenBean.getAgora_token(), roomId, uid);
// AgoraManager.getInstance(getView().getSelfActivity()).muteAllRemoteAudioStreamsExUserId(false, invite_pk_user_id);
}
}
}

View File

@@ -1,41 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".fragment.RoomKtvFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".fragment.RoomKtvFragment">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_277"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_13"
android:layout_marginEnd="@dimen/dp_16"
android:clipChildren="false">
android:layout_width="match_parent"
android:layout_height="@dimen/dp_277"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_13"
android:layout_marginEnd="@dimen/dp_16"
android:clipChildren="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bj"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/bg_r8_tm"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1.4:1.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:id="@+id/cl_bj"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/bg_r8_tm"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1.4:1.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/music_poster"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:background="#4d000000"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/music_poster"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:background="#4d000000"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!-- <View-->
<!-- android:layout_width="0dp"-->
@@ -50,259 +50,259 @@
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<TextView
android:id="@+id/tv_jz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_70"
android:text="正在加载..."
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
android:id="@+id/tv_jz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_70"
android:text="正在加载..."
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
/>
/>
<io.agora.karaoke_view.v11.LyricsView
android:id="@+id/lyrics_view"
android:layout_width="@dimen/dp_184"
android:layout_height="@dimen/dp_130"
android:layout_marginStart="@dimen/dp_12"
android:visibility="gone"
app:currentLineTextColor="@color/white"
app:currentLineTextSize="@dimen/sp_14"
app:labelWhenNoLyrics="暂无歌词"
app:layout_constraintBottom_toTopOf="@+id/mu_x_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
app:lineSpacing="8dp"
app:startOfVerseIndicatorPaddingTop="6dp"
app:startOfVerseIndicatorRadius="4dp"
app:textSize="@dimen/sp_12" />
android:id="@+id/lyrics_view"
android:layout_width="@dimen/dp_184"
android:layout_height="@dimen/dp_130"
android:layout_marginStart="@dimen/dp_12"
android:visibility="gone"
app:currentLineTextColor="@color/white"
app:currentLineTextSize="@dimen/sp_14"
app:labelWhenNoLyrics="暂无歌词"
app:layout_constraintBottom_toTopOf="@+id/mu_x_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
app:lineSpacing="8dp"
app:startOfVerseIndicatorPaddingTop="6dp"
app:startOfVerseIndicatorRadius="4dp"
app:textSize="@dimen/sp_12"/>
<TextView
android:id="@+id/mu_title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:text="当前播放歌曲:"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/mu_title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:text="当前播放歌曲:"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/mu_name"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_72"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toEndOf="@+id/mu_title"
app:layout_constraintTop_toTopOf="@+id/mu_title"
tools:text="歌曲名称" />
android:id="@+id/mu_name"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_72"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toEndOf="@+id/mu_title"
app:layout_constraintTop_toTopOf="@+id/mu_title"
tools:text="歌曲名称"/>
<RelativeLayout
android:id="@+id/ll_u_b"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_80"
android:background="@mipmap/muis_bj"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mu_title">
android:id="@+id/ll_u_b"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_80"
android:background="@mipmap/muis_bj"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mu_title">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/mu_bj"
android:layout_width="@dimen/dp_25"
android:layout_height="@dimen/dp_25"
android:layout_centerInParent="true"
android:src="@mipmap/default_avatar"
app:riv_oval="true" />
android:id="@+id/mu_bj"
android:layout_width="@dimen/dp_25"
android:layout_height="@dimen/dp_25"
android:layout_centerInParent="true"
android:src="@mipmap/default_avatar"
app:riv_oval="true"/>
</RelativeLayout>
<TextView
android:id="@+id/mu_x_title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12"
android:text="下一首:"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
android:id="@+id/mu_x_title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12"
android:text="下一首:"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView
android:id="@+id/mu_x_name"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:ellipsize="none"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toEndOf="@+id/mu_x_title"
app:layout_constraintTop_toTopOf="@+id/mu_x_title"
tools:text="歌曲名称" />
android:id="@+id/mu_x_name"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_12"
android:ellipsize="none"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toEndOf="@+id/mu_x_title"
app:layout_constraintTop_toTopOf="@+id/mu_x_title"
tools:text="歌曲名称"/>
<com.xscm.moduleutil.widget.RoomKtvWheatView
android:id="@+id/mu_yc"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:room_wheat_number="-1" />
android:id="@+id/mu_yc"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:room_wheat_number="-1"/>
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/fl_pit_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:flexDirection="column"
app:flexWrap="nowrap"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="@+id/mu_yc"
app:layout_constraintTop_toBottomOf="@id/mu_yc">
android:id="@+id/fl_pit_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:flexDirection="column"
app:flexWrap="nowrap"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="@+id/mu_yc"
app:layout_constraintTop_toBottomOf="@id/mu_yc">
<LinearLayout
android:id="@+id/ll_bz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
android:id="@+id/ll_bz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
<ImageView
android:id="@+id/im_bz"
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/accompany_on" />
android:id="@+id/im_bz"
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/accompany_on"/>
<TextView
android:id="@+id/tv_bz"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="原唱"
android:textColor="@color/color_white"
android:textSize="@dimen/sp_10" />
android:id="@+id/tv_bz"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="原唱"
android:textColor="@color/color_white"
android:textSize="@dimen/sp_10"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_ds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
android:id="@+id/ll_ds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_reward" />
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_reward"/>
<TextView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="打赏"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10" />
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="打赏"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_qg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
android:id="@+id/ll_qg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_switch" />
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_switch"/>
<TextView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="切歌"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10" />
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="切歌"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_js"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
android:id="@+id/ll_js"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_end" />
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_end"/>
<TextView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="结束"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10" />
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="结束"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_10"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_sz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical"
android:visibility="gone">
android:id="@+id/ll_sz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_set_up" />
android:layout_width="@dimen/dp_13"
android:layout_height="@dimen/dp_16"
android:layout_gravity="center"
android:src="@mipmap/muisc_set_up"/>
<TextView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="设置"
android:textColor="@color/color_0DFFB9"
android:textSize="@dimen/sp_10" />
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center"
android:gravity="center"
android:text="设置"
android:textColor="@color/color_0DFFB9"
android:textSize="@dimen/sp_10"/>
</LinearLayout>
</com.google.android.flexbox.FlexboxLayout>
@@ -311,21 +311,22 @@
<com.xscm.moduleutil.widget.RoomKtvWheatView
android:id="@+id/mu_zc"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginTop="-55dp"
android:layout_marginEnd="@dimen/dp_5"
android:clickable="true"
android:elevation="9999dp"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:translationZ="30dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toTopOf="parent"
app:room_wheat_number="9" />
android:id="@+id/mu_zc"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginTop="-25dp"
android:layout_marginEnd="@dimen/dp_5"
android:clickable="true"
android:elevation="9999dp"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:translationZ="30dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toTopOf="parent"
app:room_wheat_number="9"
/>
<!-- 在 mu_zc 视图后面添加 -->
<!-- <View-->
<!-- android:id="@+id/mu_zc_touch_overlay"-->
@@ -342,25 +343,29 @@
<!-- app:layout_constraintStart_toEndOf="@+id/cl_bj" />-->
<com.xscm.moduleutil.widget.RoomKtvWheatView
android:id="@+id/mu_jb"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginEnd="@dimen/dp_5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toBottomOf="@+id/mu_zc"
app:room_wheat_number="10" />
android:id="@+id/mu_jb"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toBottomOf="@+id/mu_zc"
app:room_wheat_number="10"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="@dimen/dp_62"
android:layout_height="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toBottomOf="@+id/mu_jb" />
android:id="@+id/recycler_view"
android:layout_width="@dimen/dp_58"
android:layout_height="0dp"
android:paddingEnd="@dimen/dp_5"
android:layout_marginBottom="-100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cl_bj"
app:layout_constraintTop_toBottomOf="@+id/mu_jb"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -185,7 +185,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bt_stop"
android:text="未开始:04:25"
tools:text="未开始:04:25"
android:textSize="@dimen/sp_12"
android:textColor="@color/white"
android:background="@mipmap/pk_djs"

View File

@@ -8,7 +8,7 @@
android:id="@+id/mu_rank"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
app:layout_constraintDimensionRatio="1:1.2"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_172"
android:layout_width="@dimen/dp_152"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

View File

@@ -256,6 +256,21 @@
android:visibility="invisible"/>
</LinearLayout>
<com.xscm.moduleutil.widget.RoomKtvWheatView
android:id="@+id/mu_zc"
android:layout_width="@dimen/dp_62"
android:layout_height="@dimen/dp_88"
android:layout_marginEnd="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_35"
android:clickable="true"
android:elevation="9999dp"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:translationZ="30dp"
android:layout_alignParentEnd="true"
app:room_wheat_number="9"
android:visibility="gone"/>
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_xsb"-->