发布广播增加麦上没人拦截提示

This commit is contained in:
huangjian
2022-01-11 11:37:06 +08:00
parent 1a2f5ae89f
commit b482f155da
2 changed files with 24 additions and 1 deletions

View File

@@ -504,7 +504,13 @@ public class RoomOperationDialog extends BottomSheetDialog {
}
optAdapter.addData(new OptAction(R.drawable.icon_room_send_broadcast,
"发布广播",
() -> SendBroadcastDialog.Companion.newInstance().show(context)
() -> {
if (AvRoomDataManager.get().getOnMicUserCount() > 0) {
SendBroadcastDialog.Companion.newInstance().show(context);
} else {
SingleToastUtil.showToast("当前房间麦上没有用户,暂不支持发布广播");
}
}
));
}

View File

@@ -605,6 +605,23 @@ public final class AvRoomDataManager {
return Integer.MIN_VALUE;
}
/**
* 获取坑上有多少人
*/
public int getOnMicUserCount() {
int count = 0;
int size;
if (mMicQueueMemberMap != null && (size = mMicQueueMemberMap.size()) >= 0) {
for (int i = 0; i < size; i++) {
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
if (roomQueueInfo.mChatRoomMember != null) {
count++;
}
}
}
return count;
}
/**
* 获取坑上没人且没上锁且最大6个坑位的位置
*/