fix bugs.
This commit is contained in:
@@ -888,7 +888,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {}
|
||||
}
|
||||
|
||||
private fun setView(resp: RoomInfoResp?) {
|
||||
private fun setView(resp: RoomInfoResp?,isSwitchRoomType:Boolean = false) {
|
||||
if (resp == null)
|
||||
return
|
||||
AppStateManager.getInstance().roomInfo = resp
|
||||
@@ -959,13 +959,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
|
||||
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
} else {
|
||||
mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
ivSoundEffects(false)
|
||||
}
|
||||
|
||||
userPermissionChange()
|
||||
|
||||
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
mBinding!!.rlMore.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.GONE
|
||||
@@ -990,7 +990,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
publicScreenFragment!!.upRoomInfo(resp)
|
||||
}
|
||||
AgoraManager.stopMuisc()
|
||||
initializeAudio()
|
||||
initializeAudio(isSwitchRoomType)
|
||||
toutiao()
|
||||
upRoomInfo(resp)
|
||||
instView()
|
||||
@@ -1565,7 +1565,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
if ("9" == toPitNumber && messageEvent.text.fromUserInfo.user_id == SpUtil.getUserId()) {
|
||||
mRoomInfoResp!!.user_info.pit_number = Integer.parseInt(toPitNumber)
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
setRoleType(3, mRoomInfoResp!!.user_info.pit_number)
|
||||
} else {
|
||||
@@ -1575,14 +1574,16 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
isMusic = false
|
||||
}
|
||||
|
||||
mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
|
||||
ivSoundEffects(false)
|
||||
}
|
||||
|
||||
roomFragment!!.handleRoomMessage(messageEvent)
|
||||
|
||||
userPermissionChange()
|
||||
|
||||
|
||||
if (mRoomInfoResp!!.user_info.pit_number == 9) {
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
}
|
||||
}
|
||||
@@ -1601,10 +1602,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomSettingEvent.room_up_pit_type = text.room_up_pit_type
|
||||
roomSettingEvent.type = messageEvent.msgType
|
||||
|
||||
if (mRoomBean != null) {
|
||||
mRoomBean!!.room_up_pit_type = text.room_up_pit_type.toString() + ""
|
||||
EventBus.getDefault().post(mRoomBean)
|
||||
}
|
||||
mRoomBean?.room_up_pit_type = text.room_up_pit_type.toString() + ""
|
||||
EventBus.getDefault().post(mRoomBean)
|
||||
|
||||
EventBus.getDefault().post(roomSettingEvent)
|
||||
}
|
||||
@@ -1676,7 +1675,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val currentUserId = SpUtil.getUserId()
|
||||
|
||||
if ("9" == pitNumber && userId == currentUserId) {
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
// mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
}
|
||||
|
||||
@@ -1747,9 +1746,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
AgoraManager.getInstance().desMusic()
|
||||
isMusic = false
|
||||
}
|
||||
mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
aBoolean = true
|
||||
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
|
||||
setBoolean(aBoolean)
|
||||
// mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
mRoomInfoResp?.user_info?.pit_number = 0
|
||||
ivSoundEffects(false)
|
||||
setRoleType(0, 0)
|
||||
} else if (userId == currentUserId) {
|
||||
aBoolean = true
|
||||
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
|
||||
@@ -2220,6 +2223,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
} else {
|
||||
AgoraManagerEx.getInstance().muteLocalAudioStreamEx(false)
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
// Handle exception
|
||||
LogUtils.e("handleMsgType125: " + e.message)
|
||||
@@ -2229,6 +2233,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private fun handleMsgType1007() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
|
||||
mRoomInfoResp!!.user_info.is_host = 1
|
||||
userPermissionChange()
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
}
|
||||
}
|
||||
@@ -2236,6 +2241,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private fun handleMsgType1006() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
|
||||
mRoomInfoResp!!.user_info.is_management = 1
|
||||
userPermissionChange()
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
}
|
||||
}
|
||||
@@ -2243,6 +2249,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private fun handleMsgType1018() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
|
||||
mRoomInfoResp!!.user_info.is_host = 0
|
||||
userPermissionChange()
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
}
|
||||
}
|
||||
@@ -2250,6 +2257,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private fun handleMsgType1017() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
|
||||
mRoomInfoResp!!.user_info.is_management = 0
|
||||
userPermissionChange()
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
}
|
||||
}
|
||||
@@ -2370,7 +2378,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
|
||||
private var isSwith = false
|
||||
private var voive = false //声音开关
|
||||
private var voive = false //声音开关 false 静音关闭 true 静音开启
|
||||
private var canSend = true
|
||||
private var aBoolean = true //上下麦按钮
|
||||
private var mCountDownTimer: CountDownTimer? = null
|
||||
@@ -2446,14 +2454,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.rl_voive) {
|
||||
voive = !voive
|
||||
if (voive) {
|
||||
mBinding!!.imVoive.setImageResource(com.xscm.moduleutil.R.mipmap.room_voice_g)
|
||||
voive = false
|
||||
} else {
|
||||
mBinding!!.imVoive.setImageResource(com.xscm.moduleutil.R.mipmap.room_voice_kg)
|
||||
voive = true
|
||||
}
|
||||
AgoraManager.getInstance().muteSpeaker(!voive)
|
||||
AgoraManager.getInstance().muteSpeaker(voive)
|
||||
if(mRoomInfoResp?.pk_info != null) {
|
||||
if (!roomFragment?.singSongFragment?.pkMicIsOn!!){
|
||||
AgoraManagerEx.getInstance().muteSpeaker(voive)
|
||||
}
|
||||
}
|
||||
} else if (id == R.id.rl_more) { //点击PK
|
||||
val fragment = RoomPkDialogFragment.newInstance(
|
||||
roomId,
|
||||
@@ -2541,28 +2553,37 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
return if (mRoomInfoResp?.user_info?.is_room_owner == 1) {
|
||||
1
|
||||
} else if (mRoomInfoResp?.user_info?.is_management == 1) {
|
||||
2
|
||||
} else if (mRoomInfoResp?.user_info?.is_host == 1) {
|
||||
3
|
||||
} 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
|
||||
4
|
||||
}
|
||||
// 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
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -3024,11 +3045,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
fun upRoomInfo(resp: RoomInfoResp?) {
|
||||
this.mRoomInfoResp = resp
|
||||
|
||||
userPermissionChange()
|
||||
|
||||
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
} else {
|
||||
mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
ivSoundEffects(false)
|
||||
}
|
||||
}
|
||||
@@ -3220,16 +3242,20 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
* @data 2025/6/27
|
||||
* @description: 初始化音频,初始的时候,当是在麦上,将用户设置为主持,在麦下,设置为观众, 默认关闭麦克风
|
||||
*/
|
||||
fun initializeAudio() {
|
||||
if (mRoomUserBean!!.pit_number != 0) {
|
||||
AgoraManager.getInstance().ClientRole(true)
|
||||
AgoraManager.getInstance().muteLocalAudioStream(false)
|
||||
} else {
|
||||
AgoraManager.getInstance().ClientRole(false)
|
||||
AgoraManager.getInstance().muteLocalAudioStream(true)
|
||||
fun initializeAudio(isSwitchRoomType: Boolean) {
|
||||
if (isSwitchRoomType){
|
||||
AgoraManager.getInstance().muteSpeaker(voive)
|
||||
}else{
|
||||
if (mRoomUserBean!!.pit_number != 0) {
|
||||
AgoraManager.getInstance().ClientRole(true)
|
||||
AgoraManager.getInstance().muteLocalAudioStream(false)
|
||||
} else {
|
||||
AgoraManager.getInstance().ClientRole(false)
|
||||
AgoraManager.getInstance().muteLocalAudioStream(true)
|
||||
}
|
||||
AgoraManager.getInstance()
|
||||
.setLocalAudioEnabled(false, SpUtil.getUserId().toString() + "")
|
||||
}
|
||||
AgoraManager.getInstance()
|
||||
.setLocalAudioEnabled(false, SpUtil.getUserId().toString() + "")
|
||||
}
|
||||
|
||||
override fun showPasswordDialog() {
|
||||
@@ -3392,6 +3418,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
is RoomHourBean.RoomListBean -> {
|
||||
ClickUtils.clearAllClickRecords()
|
||||
AgoraManager.getInstance().cleanup()
|
||||
roomId = event.room_id
|
||||
isSwitchRoom = true
|
||||
@@ -3502,45 +3529,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
|
||||
// CommonAppContext.getInstance().isShow = true
|
||||
// CommonAppContext.getInstance().isPlaying = true
|
||||
// CommonAppContext.getInstance().isRoomJoininj = false
|
||||
// // 当Activity恢复时,重置标记
|
||||
// userLeaving = true
|
||||
//
|
||||
// MvpPre!!.roomRedPackets(roomId);
|
||||
// LogUtils.e("RoomActivity", "onResume")
|
||||
//
|
||||
// if ((mRoomInfoResp?.room_info?.type_id.equals("1") || mRoomInfoResp?.room_info?.type_id.equals(
|
||||
// "8"
|
||||
// ) || mRoomInfoResp?.room_info?.type_id.equals(
|
||||
// "3"
|
||||
// )
|
||||
// || mRoomInfoResp?.room_info?.type_id.equals("4")) && mRoomInfoResp?.room_info?.label_id.equals(
|
||||
// "2"
|
||||
// )
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
// if (isInBackground) {
|
||||
// isInBackground = false
|
||||
// MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
// }
|
||||
//
|
||||
// // 检查是否从最小化状态恢复
|
||||
// if (isMinimized) {
|
||||
// isMinimized = false
|
||||
// clearMinimizeState()
|
||||
// // 恢复房间状态
|
||||
// resumeRoomState()
|
||||
// setupEffectView()
|
||||
//
|
||||
// MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
// }
|
||||
//
|
||||
// // 延迟调整布局,确保视图已经完全加载
|
||||
// mBinding?.mainContentContainer?.post { this.adjustLayoutHeights() }
|
||||
//在后台关闭礼物弹出,前台恢复礼物弹出
|
||||
GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
|
||||
}
|
||||
|
||||
// 添加检查房间连接状态的方法
|
||||
@@ -3704,7 +3694,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
this.mRoomInfoResp = resp
|
||||
|
||||
setView(resp)
|
||||
setView(resp,true)
|
||||
}
|
||||
|
||||
fun upHeight() {
|
||||
@@ -4324,6 +4314,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun userPermissionChange(){
|
||||
if (getHostUser() < 4){
|
||||
mBinding?.roomTop?.rl?.visibility = View.VISIBLE
|
||||
}else{
|
||||
mBinding?.roomTop?.rl?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val CLICK_INTERVAL: Long = 500 // 500ms内不允许重复点击
|
||||
private var lastClickTime: Long = 0
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
@@ -85,7 +86,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
String[] permissions = {Manifest.permission.RECORD_AUDIO};
|
||||
private WheatFeedingDialogFragment wheatFeedingDialogFragment;
|
||||
|
||||
private SingSongFragment singSongFragment;
|
||||
public SingSongFragment singSongFragment;
|
||||
/// 二卡八 --pk
|
||||
private RoomKtvFragment ktvFragment;
|
||||
/// KTV
|
||||
@@ -416,12 +417,12 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
setView();
|
||||
|
||||
if (mRoomInfoResp.getUser_info().getPit_number() != 0) {
|
||||
mRoomActivity.switchMic(CommonAppContext.getInstance().isMai?1:2);
|
||||
AgoraManager.getInstance().muteLocalAudioStream(CommonAppContext.getInstance().isMai);
|
||||
} else {
|
||||
AgoraManager.getInstance().muteLocalAudioStream(true);
|
||||
}
|
||||
// if (mRoomInfoResp.getUser_info().getPit_number() != 0) {
|
||||
// mRoomActivity.switchMic(CommonAppContext.getInstance().isMai?1:2);
|
||||
// AgoraManager.getInstance().muteLocalAudioStream(CommonAppContext.getInstance().isMai);
|
||||
// } else {
|
||||
// AgoraManager.getInstance().muteLocalAudioStream(true);
|
||||
// }
|
||||
}
|
||||
|
||||
/// 这是在进入电影放的时候,隐藏下面的和排麦视图
|
||||
@@ -461,10 +462,9 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
if (existingFragment != null) {
|
||||
transaction.show(existingFragment);
|
||||
} else {
|
||||
// callSpecificDestroyMethod(newFragment);
|
||||
transaction.add(containerId, newFragment, tag);
|
||||
}
|
||||
transaction.commitAllowingStateLoss();
|
||||
transaction.commitNowAllowingStateLoss();
|
||||
|
||||
}
|
||||
|
||||
@@ -527,11 +527,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
|
||||
public void setView() {//这里是当进入电影放房的时候,如果是排麦模式,并且不是电影放的时候,就隐藏排麦视图
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity) {
|
||||
if (mRoomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1") && !mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
|
||||
((RoomActivity) getActivity()).clFirstCharge(true);
|
||||
((RoomActivity)ActivityUtils.getTopActivity()).clFirstCharge(true);
|
||||
} else {
|
||||
((RoomActivity) getActivity()).clFirstCharge(false);
|
||||
((RoomActivity)ActivityUtils.getTopActivity()).clFirstCharge(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.xscm.modulemain.dialog.RoomGiftDialogFragment;
|
||||
import com.xscm.modulemain.dialog.RoomOnlineDialogFragment;
|
||||
import com.xscm.modulemain.dialog.RoomUserInfoFragment;
|
||||
import com.xscm.modulemain.dialog.TunerDialogFragment;
|
||||
import com.xscm.modulemain.generated.callback.OnClickListener;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
@@ -81,11 +82,10 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void upData() {
|
||||
@@ -165,7 +165,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setRoleType(2, 9);
|
||||
((RoomActivity) getActivity()).switchMic(2);
|
||||
// ((RoomActivity) getActivity()).switchMic(2);
|
||||
}
|
||||
}
|
||||
} else if (roomPitBean.getPit_number().equals("10")) {
|
||||
@@ -175,7 +175,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setRoleType(2, 10);
|
||||
((RoomActivity) getActivity()).switchMic(2);
|
||||
// ((RoomActivity) getActivity()).switchMic(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,40 +276,24 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
|
||||
private void sv() {
|
||||
RoomKtvWheatView roomDefaultWheatView = mBinding.muZc;
|
||||
|
||||
// 缓存 userId 字符串,避免重复拼接
|
||||
String userIdStr = SpUtil.getUserId() + "";
|
||||
|
||||
// 提前获取相关对象引用,避免多次调用 getter
|
||||
MusicSongBean songUserInfo = roomInfoResp.getSong_user_info();
|
||||
RoomUserBean userInfo = roomInfoResp.getUser_info();
|
||||
|
||||
if (songUserInfo != null) {
|
||||
if (userInfo != null && userInfo.getIs_host() == 1 && userInfo.getPit_number() == 9) {
|
||||
//演唱者and主持
|
||||
if (songUserInfo.getUser_id().equals(userIdStr) && roomDefaultWheatView.getUserId().equals(userIdStr)){
|
||||
setVisibilityView(1);
|
||||
} else if (songUserInfo.getIs_hot() == 1) {
|
||||
setVisibilityView(1);
|
||||
} else if (songUserInfo.getUser_id().equals(userIdStr) && roomDefaultWheatView.getUserId().equals(userIdStr)) {
|
||||
setVisibilityView(4);
|
||||
} else if (songUserInfo.getUser_id().equals(userIdStr)) {
|
||||
}else if(roomDefaultWheatView.getUserId().equals(userIdStr)){//主持 非演唱者
|
||||
setVisibilityView(2);
|
||||
} else {
|
||||
}else if (songUserInfo.getUser_id().equals(userIdStr)){//演唱者
|
||||
setVisibilityView(3);
|
||||
}else {//观众
|
||||
setVisibilityView(4);
|
||||
}
|
||||
} else {
|
||||
if (userInfo != null && userInfo.getIs_host() == 1 && userInfo.getPit_number() == 9) {
|
||||
setVisibilityView(1);
|
||||
} else {
|
||||
setVisibilityView(3);
|
||||
}
|
||||
}
|
||||
|
||||
if (roomDefaultWheatView.getUserId().equals(userIdStr)) {
|
||||
if (mBinding.muYc.getUserId().equals(userIdStr)) {
|
||||
setVisibilityView(4);
|
||||
} else {
|
||||
setVisibilityView(1);
|
||||
}
|
||||
setVisibilityView(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,6 +372,20 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
});
|
||||
|
||||
RoomKtvWheatView muZc = mBinding.muZc;
|
||||
muZc.mIvFace.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ClickUtils.isFastDoubleClick(muZc.mRiv)) {
|
||||
return;
|
||||
}
|
||||
if (!muZc.getUserId().equals("")) {
|
||||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), muZc.getUserId(), muZc.pitNumber, getHostUser(), false, 2, isNumberWhether(), getChildFragmentManager());
|
||||
} else {
|
||||
MvpPre.applyPit(roomInfoResp.getRoom_info().getRoom_id(), "9");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
muZc.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -424,9 +422,6 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
} else {
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity){
|
||||
if (((RoomActivity) ActivityUtils.getTopActivity()).getHostUser() < 4){
|
||||
if (ClickUtils.isFastDoubleClick(v)) {
|
||||
return;
|
||||
}
|
||||
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), "10", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
}else {
|
||||
com.hjq.toast.ToastUtils.show("请等待主持抱麦");
|
||||
@@ -486,32 +481,45 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局的显示和隐藏
|
||||
* @param type 1: 主持 and 演唱者
|
||||
* 2:主持 非 演唱者
|
||||
* 3:演唱者 非 主持
|
||||
* 4:观众
|
||||
*/
|
||||
private void setVisibilityView(int type) {
|
||||
// 当类型为1时,显示"订单"和"调运图"布局,隐藏其他布局
|
||||
if (type == 1) {
|
||||
mBinding.llBz.setVisibility(View.VISIBLE); // 隐藏布局Bz
|
||||
mBinding.llDs.setVisibility(View.GONE); // 显示布局Ds
|
||||
mBinding.llTiaoyt.setVisibility(View.VISIBLE); // 显示布局Tiaoyt
|
||||
mBinding.llQg.setVisibility(View.VISIBLE); // 显示布局Qg
|
||||
mBinding.llSz.setVisibility(View.GONE); // 隐藏布局Sz
|
||||
} else if (type == 2) {
|
||||
mBinding.llBz.setVisibility(View.GONE);
|
||||
mBinding.llDs.setVisibility(View.VISIBLE);
|
||||
mBinding.llTiaoyt.setVisibility(View.VISIBLE);
|
||||
mBinding.llQg.setVisibility(View.VISIBLE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
} else if (type == 2) {
|
||||
mBinding.llBz.setVisibility(View.VISIBLE);
|
||||
mBinding.llDs.setVisibility(View.GONE);
|
||||
mBinding.llTiaoyt.setVisibility(View.GONE);
|
||||
mBinding.llQg.setVisibility(View.VISIBLE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
} else if (type == 3) {
|
||||
mBinding.llBz.setVisibility(View.VISIBLE);
|
||||
mBinding.llDs.setVisibility(View.GONE);
|
||||
mBinding.llTiaoyt.setVisibility(View.VISIBLE);
|
||||
mBinding.llQg.setVisibility(View.VISIBLE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
} else if (type == 4) {
|
||||
mBinding.llBz.setVisibility(View.GONE);
|
||||
mBinding.llDs.setVisibility(View.VISIBLE);
|
||||
mBinding.llTiaoyt.setVisibility(View.GONE);
|
||||
mBinding.llQg.setVisibility(View.GONE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
} else if (type == 4) {
|
||||
mBinding.llBz.setVisibility(View.VISIBLE);
|
||||
} else if (type == 5) {
|
||||
mBinding.llBz.setVisibility(View.GONE);
|
||||
mBinding.llDs.setVisibility(View.GONE);
|
||||
mBinding.llTiaoyt.setVisibility(View.VISIBLE);
|
||||
mBinding.llQg.setVisibility(View.VISIBLE);
|
||||
mBinding.llTiaoyt.setVisibility(View.GONE);
|
||||
mBinding.llQg.setVisibility(View.GONE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ 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.blankj.utilcode.util.ToastUtils;
|
||||
import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
@@ -546,7 +545,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
private boolean aBoolean = true;
|
||||
public boolean pkMicIsOn = false;
|
||||
private int is_mute;
|
||||
|
||||
@Override
|
||||
@@ -568,16 +567,16 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
MvpPre.endPk(roomInfoRespPk.getPk_info().getPk_id(), "3", SpUtil.getUserId() + "");
|
||||
}
|
||||
} else if (id == R.id.im_mkf) {
|
||||
if (aBoolean) {
|
||||
if (pkMicIsOn) {
|
||||
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
|
||||
is_mute = 0;
|
||||
aBoolean = false;
|
||||
AgoraManager.getInstance().muteAllRemoteAudioStreamsExUserId(false);
|
||||
pkMicIsOn = false;
|
||||
AgoraManagerEx.getInstance().muteAllRemoteAudioStreamsEx(false);
|
||||
} else {
|
||||
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone_off);
|
||||
is_mute = 1;
|
||||
aBoolean = true;
|
||||
AgoraManager.getInstance().muteAllRemoteAudioStreamsExUserId(true);
|
||||
pkMicIsOn = true;
|
||||
AgoraManagerEx.getInstance().muteAllRemoteAudioStreamsEx(true);
|
||||
}
|
||||
RoomMessageEvent.text text = new RoomMessageEvent.text();
|
||||
text.setIs_mute(is_mute);
|
||||
|
||||
Reference in New Issue
Block a user