feat:同步音萌完成个播PK屏蔽麦功能
This commit is contained in:
@@ -120,7 +120,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
exitRoom();
|
||||
}
|
||||
AvRoomDataManager.get().updateServiceRoomInfo(roomInfo);
|
||||
initAnotherPKData();
|
||||
mAvRoomModel.enterRoom(roomInfo.getRoomId(), 3, fromType, fromNick, fromUid)
|
||||
.flatMap(this::dealServerMicInfo)
|
||||
.map(this::dealMicMemberFromIMNet)
|
||||
@@ -143,6 +142,7 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
.subscribe((stringServiceResult) -> EventBus.getDefault().post(new AudioPartyOpenEvent()));
|
||||
mAvRoomModel.loadMessageHistory(AvRoomDataManager.get().clearScreenTime);
|
||||
IMNetEaseManager.get().joinAvRoom();
|
||||
initAnotherPKData();
|
||||
}, this::dealEnterRoomError);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,12 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
if (AvRoomDataManager.get().isOpenAnotherPKMode()) {
|
||||
RoomPKModel.INSTANCE.getRoomPKData(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(roomPkBean -> AvRoomDataManager.get().roomPkLiveData.setValue(roomPkBean));
|
||||
.subscribe(roomPkBean -> {
|
||||
AvRoomDataManager.get().roomPkLiveData.setValue(roomPkBean);
|
||||
if (AvRoomDataManager.get().isSingleRoom()){
|
||||
AudioEngineManager.get().setRemoteMute(roomPkBean.getAUid(), roomPkBean.getAMicStatus() == 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,10 @@ import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.SingleRoomPKModel
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -55,6 +57,20 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
||||
SingleRoomPkRuleDialog.newInstance().show(context)
|
||||
}
|
||||
|
||||
binding.ivMuteAnother.setOnClickListener {
|
||||
if (AvRoomDataManager.get().isRoomOwner) {
|
||||
roomPkBean?.let {
|
||||
if (it.roundId == null) {
|
||||
return@let
|
||||
}
|
||||
SingleRoomPKModel
|
||||
.muteSingleRoomPkOtherMic(it.roundId, it.aMicStatus xor 1)
|
||||
.subscribe()
|
||||
}
|
||||
} else {
|
||||
"主播已關閉對方房間的聲音".toast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -118,7 +134,13 @@ class SingleRoomPKBoardView @JvmOverloads constructor(
|
||||
binding.ivPkResult.isVisible = true
|
||||
binding.ivPkResult.setImageResource(R.drawable.single_room_pk_ic_result_win)
|
||||
}
|
||||
|
||||
if (roomPkBean?.aMicStatus == 0) {
|
||||
binding.ivMuteAnother.isVisible = true
|
||||
binding.ivMuteAnother.setImageResource(R.drawable.single_room_pk_ic_another_mic_close)
|
||||
} else {
|
||||
binding.ivMuteAnother.setImageResource(R.drawable.single_room_pk_ic_another_mic_open)
|
||||
binding.ivMuteAnother.isVisible = AvRoomDataManager.get().isRoomOwner
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@@ -72,6 +72,14 @@
|
||||
app:layout_constraintStart_toStartOf="@id/iv_blue_avatar"
|
||||
tools:src="@drawable/single_room_pk_ic_result_win" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_mute_another"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/single_room_pk_ic_another_mic_open"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_blue_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_blue_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_blue_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -1324,6 +1324,15 @@ public final class IMNetEaseManager {
|
||||
AvRoomDataManager.get().pkBeginTime = roomPkBean.getBeginTime();
|
||||
noticeRoomEvent(msg, RoomEvent.ROOM_PK_ORDER);
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_SINGLE_ROOM_PK_MUTE_MIC:
|
||||
AudioEngineManager.get().setRemoteMute(roomPkBean.getAUid(), roomPkBean.getAMicStatus() == 0);
|
||||
RoomPkBean currRoomPkBean = AvRoomDataManager.get().roomPkLiveData.getValue();
|
||||
if (currRoomPkBean != null) {
|
||||
currRoomPkBean.setAMicStatus(roomPkBean.getAMicStatus());
|
||||
AvRoomDataManager.get().roomPkLiveData.postValue(currRoomPkBean);
|
||||
}
|
||||
noticeRoomEvent(msg, RoomEvent.ROOM_PK_MUTE_MIC);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_VIP:
|
||||
|
@@ -386,6 +386,7 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_SUB_SINGLE_ROOM_PK_RESULT = 8311;// 个播pk结果通知
|
||||
public static final int CUSTOM_MSG_SUB_SINGLE_ROOM_PK_NOTIFY = 8312;// 个播pk结束触发的飘屏通知
|
||||
public static final int CUSTOM_MSG_SUB_SINGLE_ROOM_PK_FINISH = 8313;// 个播pk结束通知
|
||||
public static final int CUSTOM_MSG_SUB_SINGLE_ROOM_PK_MUTE_MIC = 8316;// 个播pk禁用对方麦克风
|
||||
/**
|
||||
* 贵族
|
||||
*/
|
||||
|
@@ -114,6 +114,11 @@ public class RoomPkBean implements Serializable {
|
||||
* PK预约字段
|
||||
*/
|
||||
private long beginTime;
|
||||
// 0:屏蔽 1:开启
|
||||
/**
|
||||
* 个播PK匹配新增字段
|
||||
*/
|
||||
private int aMicStatus;
|
||||
|
||||
@Data
|
||||
public static class RankBean implements Serializable {
|
||||
|
@@ -215,6 +215,7 @@ public class RoomEvent {
|
||||
public static final int ROOM_PK_ACCEPT = 74;
|
||||
public static final int ROOM_PK_FINISH = 75;
|
||||
public static final int ROOM_PK_NOTIFY = 76;
|
||||
public static final int ROOM_PK_MUTE_MIC = 78;
|
||||
|
||||
/**
|
||||
* 请求上麦
|
||||
|
@@ -104,6 +104,17 @@ object SingleRoomPKModel {
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
/**
|
||||
* 对方麦位屏蔽
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun muteSingleRoomPkOtherMic(roundId: String, micStatus: Int): Single<String> {
|
||||
return api.muteSingleRoomPkOtherMic(AvRoomDataManager.get().roomUid, roundId, micStatus)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 发起挑战
|
||||
@@ -172,6 +183,20 @@ object SingleRoomPKModel {
|
||||
fun getSingleRoomPkRule(
|
||||
@Field("roomUid") roomUid: Long?
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
*对方麦位屏蔽
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/crossroompkround/otherMic")
|
||||
fun muteSingleRoomPkOtherMic(
|
||||
@Field("roomUid") roomUid: Long?,
|
||||
@Field("roundId") roundId: String,
|
||||
@Field("micStatus") micStatus: Int
|
||||
): Single<ServiceResult<String>>
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user