diff --git a/BaseModule/src/main/java/com/xscm/moduleutil/enumType/QXRoomSeatViewType.java b/BaseModule/src/main/java/com/xscm/moduleutil/enumType/QXRoomSeatViewType.java index c33860b7..9195c401 100644 --- a/BaseModule/src/main/java/com/xscm/moduleutil/enumType/QXRoomSeatViewType.java +++ b/BaseModule/src/main/java/com/xscm/moduleutil/enumType/QXRoomSeatViewType.java @@ -22,6 +22,11 @@ public enum QXRoomSeatViewType { */ JUKEBOX(9,"点唱麦位"), + /** + * 签约 + */ + SIGNCONTRACT(7,"签约"), + /** * 小黑屋麦位 */ diff --git a/BaseModule/src/main/java/com/xscm/moduleutil/enumType/RoomType.kt b/BaseModule/src/main/java/com/xscm/moduleutil/enumType/RoomType.kt index 5f19c99c..a7963926 100644 --- a/BaseModule/src/main/java/com/xscm/moduleutil/enumType/RoomType.kt +++ b/BaseModule/src/main/java/com/xscm/moduleutil/enumType/RoomType.kt @@ -15,7 +15,8 @@ enum class RoomType( DATING("交友", 1,3, 4, 8), // 1、3、4、8 均对应交友 BLACK_ROOM("小黑屋", 6), JUKEBOX("点唱", 9), - MUTUAL_ENTERTAINMENT("互娱", 7); + MUTUAL_ENTERTAINMENT("互娱", 17), + SIGN_CONTRACT("签约", 7); companion object { diff --git a/BaseModule/src/main/res/layout/room_view_wheat_charm.xml b/BaseModule/src/main/res/layout/room_view_wheat_charm.xml index 83721d47..d78d2d8f 100644 --- a/BaseModule/src/main/res/layout/room_view_wheat_charm.xml +++ b/BaseModule/src/main/res/layout/room_view_wheat_charm.xml @@ -18,7 +18,7 @@ android:layout_centerInParent="true" android:layout_alignParentStart="true" android:layout_marginStart="@dimen/dp_3" - android:src="@mipmap/room_ic_wheat_charm" /> + android:src="@mipmap/icon_heart_left_bg" /> (), override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {} } - private fun setView(resp: RoomInfoResp?,isSwitchRoomType:Boolean = false) { + private fun setView(resp: RoomInfoResp?, isSwitchRoomType: Boolean = false) { if (resp == null) return AppStateManager.getInstance().roomInfo = resp @@ -1048,7 +1048,7 @@ class RoomActivity : BaseMvpActivity(), fun getRoomInfoResp(): List? { val roomPitBeans = mRoomInfoResp?.room_info?.pit_list.orEmpty().filter { - it.user_id != null && it.user_id != "0" && it.user_id.isNotEmpty()&& it.user_id.toInt() != SpUtil.getUserId() && it.pit_number.toInt()<9 + it.user_id != null && it.user_id != "0" && it.user_id.isNotEmpty() && it.user_id.toInt() != SpUtil.getUserId() && it.pit_number.toInt() < 9 } return roomPitBeans.ifEmpty { null } } @@ -1484,15 +1484,22 @@ class RoomActivity : BaseMvpActivity(), } else if (msgType == EMMessageInfo.QXRoomMessageTypeQXRoomMessageRedRemove) { qxRedPacketManager!!.removeRedPacket(messageEvent.text.redpacket_id) } else if (msgType == EMMessageInfo.QXRoomMessageTypeSongerNum //房间点歌数量变化 - || msgType ==EMMessageInfo.QXRoomMessageTypeSingerRoomCurrentSongDidChanged //点歌房当前歌曲发生变化 - ||msgType == EMMessageInfo.QXRoomMessageTypeSingerRoomNextSongDidChanged) { //点歌房下一首歌曲发生变化 + || msgType == EMMessageInfo.QXRoomMessageTypeSingerRoomCurrentSongDidChanged //点歌房当前歌曲发生变化 + || msgType == EMMessageInfo.QXRoomMessageTypeSingerRoomNextSongDidChanged + ) { //点歌房下一首歌曲发生变化 if (mRoomInfoResp != null && mRoomInfoResp!!.room_info != null) { roomFragment!!.handleRoomMessage(messageEvent) } - }else if(msgType == EMMessageInfo.QXRoomMessageTypeCPText){ + } else if (msgType == EMMessageInfo.QXRoomMessageTypeCPText) { LogUtils.e("CPText", messageEvent.text.rights_icon) - if(messageEvent.text.rights_icon.isNotEmpty()){ - QXGiftPlayerManager.getInstance(this).displayCPView(messageEvent.text.fromUserInfo.avatar,messageEvent.text.toUserInfo.avatar,messageEvent.text.fromUserInfo.nickname, messageEvent.text.toUserInfo.nickname,messageEvent.text.rights_icon) + if (messageEvent.text.rights_icon.isNotEmpty()) { + QXGiftPlayerManager.getInstance(this).displayCPView( + messageEvent.text.fromUserInfo.avatar, + messageEvent.text.toUserInfo.avatar, + messageEvent.text.fromUserInfo.nickname, + messageEvent.text.toUserInfo.nickname, + messageEvent.text.rights_icon + ) } } } @@ -1769,7 +1776,8 @@ class RoomActivity : BaseMvpActivity(), mBinding!!.rlMore.visibility = View.GONE mBinding!!.rlMisc.visibility = View.GONE - mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = getPitBean(messageEvent, 1) + mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = + getPitBean(messageEvent, 1) roomFragment!!.upRoomInfoData(mRoomInfoResp) roomFragment!!.handleRoomMessage(messageEvent) @@ -1848,7 +1856,8 @@ class RoomActivity : BaseMvpActivity(), //TODO 下麦更换数据 val labelId = mRoomInfoResp!!.room_info.label_id if ("1" == labelId) { - mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = RoomPitBean(pitNumber) + mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = + RoomPitBean(pitNumber) roomFragment!!.upRoomInfoData(mRoomInfoResp) if (mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) { @@ -1856,12 +1865,14 @@ class RoomActivity : BaseMvpActivity(), } } } + RoomType.MUTUAL_ENTERTAINMENT -> { mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = RoomPitBean(pitNumber) roomFragment!!.upRoomInfoData(mRoomInfoResp) roomFragment!!.handleRoomMessage(messageEvent) } + else -> { roomFragment!!.updateSeatViewExchangedWithPitArray(mRoomInfoResp) } @@ -2532,8 +2543,8 @@ class RoomActivity : BaseMvpActivity(), mBinding!!.imVoive.setImageResource(com.xscm.moduleutil.R.mipmap.room_voice_kg) } AgoraManager.getInstance().muteSpeaker(voive) - if(mRoomInfoResp?.pk_info != null) { - if (!roomFragment?.singSongFragment?.pkMicIsOn!!){ + if (mRoomInfoResp?.pk_info != null) { + if (!roomFragment?.singSongFragment?.pkMicIsOn!!) { AgoraManagerEx.getInstance().muteSpeaker(voive) } } @@ -2544,7 +2555,7 @@ class RoomActivity : BaseMvpActivity(), mRoomInfoResp?.room_info?.is_pk!! ) - LogUtils.e("pk_info","id == R.id.rl_more ${mRoomInfoResp?.room_info?.is_pk!!}") + LogUtils.e("pk_info", "id == R.id.rl_more ${mRoomInfoResp?.room_info?.is_pk!!}") fragment.show(supportFragmentManager, "RoomPkDialogFragment") addActiveDialogFragment(fragment) // 添加到管理列表 } else if (id == R.id.rl_message) { @@ -3316,9 +3327,9 @@ class RoomActivity : BaseMvpActivity(), * @description: 初始化音频,初始的时候,当是在麦上,将用户设置为主持,在麦下,设置为观众, 默认关闭麦克风 */ fun initializeAudio(isSwitchRoomType: Boolean) { - if (isSwitchRoomType){ + if (isSwitchRoomType) { AgoraManager.getInstance().muteSpeaker(voive) - }else{ + } else { if (mRoomUserBean!!.pit_number != 0) { AgoraManager.getInstance().ClientRole(true) AgoraManager.getInstance().muteLocalAudioStream(false) @@ -3767,7 +3778,7 @@ class RoomActivity : BaseMvpActivity(), } this.mRoomInfoResp = resp - setView(resp,true) + setView(resp, true) } fun upHeight() { @@ -3847,6 +3858,17 @@ class RoomActivity : BaseMvpActivity(), QXRoomSeatViewType.JUKEBOX } + RoomType.SIGN_CONTRACT -> { + if (mRoomInfoResp!!.room_info.room_background == null || mRoomInfoResp!!.room_info.room_background == "") { + changeBackground(com.xscm.moduleutil.R.mipmap.jukebox_bj) + } else { + changeBackgroundColor(mRoomInfoResp!!.room_info.room_background) + } + + setvisibTop(true) + QXRoomSeatViewType.SIGNCONTRACT + } + null -> { LogUtils.e("@@@", "RoomType is null") QXRoomSeatViewType.NONE @@ -4400,10 +4422,10 @@ class RoomActivity : BaseMvpActivity(), } } - private fun userPermissionChange(){ - if (getHostUser() < 4){ + private fun userPermissionChange() { + if (getHostUser() < 4) { mBinding?.roomTop?.rl?.visibility = View.VISIBLE - }else{ + } else { mBinding?.roomTop?.rl?.visibility = View.GONE } } diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/room/contacts/MentorShipContacts.kt b/MainModule/src/main/java/com/xscm/modulemain/activity/room/contacts/MentorShipContacts.kt new file mode 100644 index 00000000..8309d62d --- /dev/null +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/room/contacts/MentorShipContacts.kt @@ -0,0 +1,16 @@ +package com.xscm.modulemain.activity.room.contacts + +import android.app.Activity +import com.xscm.moduleutil.activity.IPresenter +import com.xscm.moduleutil.activity.IView + +class MentorShipContacts { + + interface View : IView{ + + } + + interface Ipre : IPresenter{ + + } +} \ No newline at end of file diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomFragment.java b/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomFragment.java index e41f9e36..cb7251c0 100644 --- a/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomFragment.java +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomFragment.java @@ -58,6 +58,8 @@ import java.util.List; * @description:房间fragment */ public class RoomFragment extends BaseMvpFragment implements RoomContacts.View { + + public static RoomFragment newInstance(RoomActivity roomActivity, RoomInfoResp resp) { Bundle args = new Bundle(); RoomFragment fragment = new RoomFragment(roomActivity, resp); @@ -100,6 +102,7 @@ public class RoomFragment extends BaseMvpFragment(), MentorShipContacts.View { + + companion object { + @Volatile + private var INSTANCE: RoomMentorShipFragment? = null + + fun newInstance(roomInfoResp: RoomInfoResp): RoomMentorShipFragment { + return INSTANCE ?: synchronized(this) { + INSTANCE ?: RoomMentorShipFragment(roomInfoResp).also { INSTANCE = it } + } + } + + } + + override fun getLayoutId(): Int { + return R.layout.fragment_mentor_ship + } + + override fun bindPresenter(): MentorShipPresenter { + return MentorShipPresenter(ActivityUtils.getTopActivity(), this) + } + + + override fun initData() { + } + + override fun initView() { + } + + fun roomInfoUpdate(mRoomInfoResp: RoomInfoResp) { + mRoomInfo = mRoomInfoResp + } + + +} \ No newline at end of file diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/room/presenter/MentorShipPresenter.kt b/MainModule/src/main/java/com/xscm/modulemain/activity/room/presenter/MentorShipPresenter.kt new file mode 100644 index 00000000..42914554 --- /dev/null +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/room/presenter/MentorShipPresenter.kt @@ -0,0 +1,10 @@ +package com.xscm.modulemain.activity.room.presenter + +import android.content.Context +import com.xscm.modulemain.activity.room.contacts.MentorShipContacts +import com.xscm.moduleutil.presenter.BasePresenter + +class MentorShipPresenter(context: Context, view: MentorShipContacts.View) : + BasePresenter(view, context), MentorShipContacts.Ipre { + +} \ No newline at end of file diff --git a/MainModule/src/main/java/com/xscm/modulemain/widget/RoomMentorShipWheatView.kt b/MainModule/src/main/java/com/xscm/modulemain/widget/RoomMentorShipWheatView.kt new file mode 100644 index 00000000..d31f676f --- /dev/null +++ b/MainModule/src/main/java/com/xscm/modulemain/widget/RoomMentorShipWheatView.kt @@ -0,0 +1,126 @@ +package com.xscm.modulemain.widget + +import android.content.Context +import android.content.res.TypedArray +import android.text.TextUtils +import android.util.AttributeSet +import com.xscm.modulemain.R +import com.xscm.moduleutil.bean.room.RoomPitBean +import com.xscm.moduleutil.utils.ImageUtils +import com.xscm.moduleutil.widget.BaseWheatView + +class RoomMentorShipWheatView(context: Context?) : BaseWheatView(context) { + + constructor(context: Context?, attrs: AttributeSet?) : this(context) { + initPit(context, attrs) + } + + override fun getLayoutId(): Int { + return R.layout.layout_room_mentorship_wheat + } + + // 提供一个方法来设置这个属性,便于在代码中动态更改 + fun setRoomWheatNumber(number: String?) { + this.pitNumber = number + } + + override fun setPitData(bean: RoomPitBean?) { + if (bean == null) return + + pitBean = bean // 统一使用参数 bean + stopAndClearAnimation() // 清理之前的动画资源 + + if (isOn) { + handleOnState(bean) + } else { + handleOffState(bean) + } + } + + private fun stopAndClearAnimation() { + if (mIvRipple != null) { + mIvRipple.stopAnimation(true) + } + } + + + private fun handleOnState(bean: RoomPitBean) { + mIvRipple.visibility = VISIBLE + mTvName.visibility = VISIBLE + mTvName.text = bean.nickname + ImageUtils.loadHeadCC(bean.avatar, mRiv) + mCharmView.visibility = VISIBLE + if (TextUtils.isEmpty(bean.dress)) { + mIvFrame.stopAll() + mIvFrame.visibility = INVISIBLE + } else { + mIvFrame.visibility = VISIBLE + mIvFrame.setSource(bean.dress, 3) + } + } + + private fun handleOffState(bean: RoomPitBean) { + if (bean.pit_number == "9") { + mTvName.visibility = GONE + } else { + mTvName.visibility = VISIBLE + mTvName.setText(getPitNumberText()) + } + mCharmView.visibility = GONE + mRiv.visibility = VISIBLE + mRiv.setImageResource(R.mipmap.jukebox_room_mask) + mIvShutup.visibility = GONE + mIvFrame.stopAll() + mIvFrame.visibility = GONE + mIvRipple.visibility = GONE + } + + + private fun getPitNumberText(): String { + if ("-1" == pitNumber) return "" + if ("9" == pitNumber) return "" + if ("10" == pitNumber) return "老板" + return pitNumber + "号麦" + } + + override fun initPit(context: Context?, attrs: AttributeSet?) { + var typedArray: TypedArray? = null + try { + typedArray = context!!.obtainStyledAttributes( + attrs, + com.xscm.moduleutil.R.styleable.RoomDefaultWheatView + ) + pitNumber = + typedArray.getString(com.xscm.moduleutil.R.styleable.RoomDefaultWheatView_room_wheat_number) + } finally { + typedArray?.recycle() + } + + mCharmView = findViewById(R.id.charm_view) + mIvRipple = findViewById(R.id.iv_ripple) + mIvFrame = findViewById(R.id.iv_frame) + mIvShutup = findViewById(R.id.iv_shutup) + mRiv = findViewById(R.id.riv) + } + + override fun onRemoteSoundLevelUpdate(userId: String?, soundLevel: Int) { + + } + + override fun onLocalSoundLevelUpdate(volume: Int) { + + } + + override fun userJoined(userId: Int, elapsd: Int) { + + } + + override fun userOffline(userId: Int, reason: Int) { + + } + + override fun pkOffSide(userId: Int) { + + } + +} \ No newline at end of file diff --git a/MainModule/src/main/res/layout/fragment_mentor_ship.xml b/MainModule/src/main/res/layout/fragment_mentor_ship.xml new file mode 100644 index 00000000..5c22cfee --- /dev/null +++ b/MainModule/src/main/res/layout/fragment_mentor_ship.xml @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MainModule/src/main/res/layout/layout_room_mentorship_wheat.xml b/MainModule/src/main/res/layout/layout_room_mentorship_wheat.xml new file mode 100644 index 00000000..52e886f8 --- /dev/null +++ b/MainModule/src/main/res/layout/layout_room_mentorship_wheat.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file