酒吧交友房聊天。
This commit is contained in:
@@ -2682,7 +2682,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
emotionPickerDialog.setOnEmotionSelectedListener { emotion ->
|
||||
// 处理选中的表情
|
||||
if (publicScreenFragment != null) {
|
||||
publicScreenFragment!!.sendChatEmoji(emotion)
|
||||
val typeId = mRoomInfoResp?.room_info?.type_id
|
||||
val labelId = mRoomInfoResp?.room_info?.label_id
|
||||
//TODO 酒吧交友房 公开聊天时
|
||||
if (typeId.equals("6") && labelId.equals("11") && mBinding?.ivPrivateSet?.tag == "0") {
|
||||
publicScreenFragment?.sendPriMsg(2,null,emotion,AgoraManager.getInstance().lastRoomId)
|
||||
}else{
|
||||
publicScreenFragment!!.sendChatEmoji(emotion)
|
||||
}
|
||||
}
|
||||
}
|
||||
emotionPickerDialog.show()
|
||||
@@ -4479,7 +4486,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
return@OnClickListener
|
||||
}
|
||||
if (publicScreenFragment != null) {
|
||||
publicScreenFragment!!.fasong(RoomInputEvent(text))
|
||||
val typeId = mRoomInfoResp?.room_info?.type_id
|
||||
val labelId = mRoomInfoResp?.room_info?.label_id
|
||||
//TODO 酒吧交友房 公开聊天时
|
||||
if (typeId.equals("6") && labelId.equals("11") && mBinding?.ivPrivateSet?.tag == "0") {
|
||||
publicScreenFragment?.sendPriMsg(1,RoomInputEvent(text),null,AgoraManager.getInstance().lastRoomId)
|
||||
}else{
|
||||
publicScreenFragment!!.fasong(RoomInputEvent(text))
|
||||
}
|
||||
}
|
||||
etContent.setText("")
|
||||
countDownTimer()
|
||||
@@ -4530,7 +4544,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
fun dialogMessage(event: RoomInputEvent) {
|
||||
if (publicScreenFragment != null) {
|
||||
publicScreenFragment!!.fasong(event)
|
||||
val typeId = mRoomInfoResp?.room_info?.type_id
|
||||
val labelId = mRoomInfoResp?.room_info?.label_id
|
||||
//TODO 酒吧交友房 公开聊天时
|
||||
if (typeId.equals("6") && labelId.equals("11") && mBinding?.ivPrivateSet?.tag == "0") {
|
||||
publicScreenFragment?.sendPriMsg(1,event,null,AgoraManager.getInstance().lastRoomId)
|
||||
}else{
|
||||
publicScreenFragment!!.fasong(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,9 +263,8 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
|
||||
if (emMessage.getText().getFromUserInfo() != null) {
|
||||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), emMessage.getText().getFromUserInfo().getUser_id() != 0 ? emMessage.getText().getFromUserInfo().getUser_id() + "" : emMessage.getText().getFromUserInfo().getId() + "", emMessage.getText().getFromUserInfo().getPit_number(), getHostUser(roomInfoResp.getUser_info()), false, 5, isNumberWhether(), getChildFragmentManager());
|
||||
}
|
||||
|
||||
});
|
||||
// //判断是否开启公屏
|
||||
//判断是否开启公屏
|
||||
setUpPublicScreen();
|
||||
mBinding.tvCount.setOnClickListener(this::onClick);
|
||||
mBinding.tvTabAll.setOnClickListener(this::onClick);
|
||||
@@ -462,6 +461,53 @@ public class ChatRoomFragment extends BaseMvpFragment<ChatRoomPresenter, RoomFra
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void sendPriMsg(int status,RoomInputEvent roomInputEvent,EmotionDeatils emotionDeatils,String roomId) {
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
if (status == 2){
|
||||
EmotionDeatils event = new EmotionDeatils();
|
||||
if (emotionDeatils != null && emotionDeatils.getChildren() != null && !emotionDeatils.getChildren().isEmpty() && emotionDeatils.getChildren().size() > 0) {
|
||||
int position = new Random().nextInt(emotionDeatils.getChildren().size());
|
||||
Children children = emotionDeatils.getChildren().get(position);
|
||||
event.setImage(children.getImage());
|
||||
event.setAnimate_image(emotionDeatils.getAnimate_image());
|
||||
} else {
|
||||
event = emotionDeatils;
|
||||
}
|
||||
t.setFromUserInfo(SpUtil.getUserInfo());
|
||||
t.setEmoji(event);
|
||||
}else {
|
||||
String message = roomInputEvent.text;
|
||||
t.setText(message);
|
||||
t.setFromUserInfo(SpUtil.getUserInfo());
|
||||
}
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(status, roomId, t);
|
||||
handleRoomMessage(roomMessageEvent);
|
||||
String json = GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
V2TIMMessage v2TIMMessage = V2TIMManager.getMessageManager().createCustomMessage(binaryData);
|
||||
// 发送消息
|
||||
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, null, "room" + roomId, V2TIMMessage.V2TIM_PRIORITY_NORMAL, false, null, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
// 自定义消息不会回调进度
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage message) {
|
||||
// 发送群聊自定义消息成功
|
||||
EventBus.getDefault().post(new RoomTaskEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
// 发送群聊自定义消息失败
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void handleRoomMessage(RoomMessageEvent message) {
|
||||
if (message == null) return;
|
||||
|
||||
|
||||
@@ -446,7 +446,6 @@ class RoomPubFragment(var mRoomInfoResp: RoomInfoResp?) :
|
||||
if (view.userId.isNotEmpty()) {
|
||||
for (userInfo in messageEvent.text.toUserInfos) {
|
||||
if (view.userId == userInfo.user_id.toString()) {
|
||||
// view.setData(view.pitBean)
|
||||
view.setPitGift(messageEvent.text.giftInfo.play_image)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user