开启相亲模式

相亲模式公屏消息
This commit is contained in:
huangjian
2021-01-22 16:17:08 +08:00
parent 8b0f55fcde
commit 881cd1d6c4
16 changed files with 212 additions and 65 deletions

View File

@@ -88,6 +88,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
rvOPtList.setLayoutManager(new FullyGridLayoutManager(getContext(), 4));
optAdapter = new OptAdapter(context, null);
addPKAction(optAdapter);
addDatingAction(optAdapter);
addKTVAction(optAdapter);
//addGameAction(optAdapter);
addRoomLimit(optAdapter);
@@ -158,6 +159,33 @@ public class RoomOperationDialog extends BottomSheetDialog {
}
/**
* 相亲 模式
*
* @param optAdapter
*/
private void addDatingAction(OptAdapter optAdapter) {
if (SuperAdminUtil.isSuperAdmin()) {
return;
}
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null) {
return;
}
String str = AvRoomDataManager.get().isDatingMode() ? "相亲中..." :"相亲模式";
int icon = AvRoomDataManager.get().isOpenPKMode() ?
R.drawable.ic_room_opt_op_dating :
R.drawable.ic_room_opt_in_dating;
optAdapter.addData(new OptAction(icon, str, () -> {
if (onActionListener != null) {
onActionListener.onDatingAction();
}
}));
}
}
/**
* 添加KTV 操作
*
@@ -455,6 +483,8 @@ public class RoomOperationDialog extends BottomSheetDialog {
void onPKAction();
void onDatingAction();
void onGameAction();
void onRoomHall();

View File

@@ -1122,6 +1122,8 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
openOrCloseGame();
});
refreshDatingNextStatus();
}
/**
@@ -1300,7 +1302,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
}
}
private void refreshDatingNextStatus() {
private synchronized void refreshDatingNextStatus() {
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (currentRoomInfo == null) return;
if (AvRoomDataManager.get().isPreside(UserUtils.getUserUid())) {
@@ -1738,7 +1740,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
final ButtonItem buttonItem1 = new ButtonItem(getString(R.string.embrace_up_mic) + presideText, new ButtonItem.OnClickListener() {
@Override
public void onClick() {
RoomInviteActivity.openActivity(getActivity(), micPosition,presideMic);
RoomInviteActivity.openActivity(getActivity(), micPosition, presideMic);
}
});
ButtonItem buttonItem2 = new ButtonItem(roomMicInfo.isMicMute() ? getString(R.string.no_forbid_mic) : getString(R.string.forbid_mic), new ButtonItem.OnClickListener() {
@@ -2256,6 +2258,11 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
CreatePKActivity.start(getContext());
}
@Override
public void onDatingAction() {
if (getMvpPresenter() != null) getMvpPresenter().datingOpen();
}
@Override
public void onRoomHall() {
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MY_HALL_CLICK, "厅管理入口");

View File

@@ -910,6 +910,28 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
});
}
public void datingOpen(){
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null) return;
if (AvRoomDataManager.get().isOpenPKMode()){
SingleToastUtil.showToast("PK中不可以开启相亲模式!");
return;
}
if (!AvRoomDataManager.get().isDatingMode()){
mHomePartyMode.datingOpen(roomInfo.getUid())
.compose(bindToLifecycle())
.doOnError(e -> SingleToastUtil.showToast(e.getMessage()))
.subscribe();
}
else {
mHomePartyMode.datingClose(roomInfo.getUid())
.compose(bindToLifecycle())
.doOnError(e -> SingleToastUtil.showToast(e.getMessage()))
.subscribe();
}
}
public void datingNext() {
final RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null) return;

View File

@@ -75,6 +75,7 @@ import com.yizhuan.xchat_android_core.home.model.CollectionRoomModel;
import com.yizhuan.xchat_android_core.im.custom.bean.AuctionAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.DatingAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.GameAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.GameRespondAttachment;
@@ -119,6 +120,7 @@ import com.yizhuan.xchat_android_core.noble.NobleResourceType;
import com.yizhuan.xchat_android_core.noble.NobleUtil;
import com.yizhuan.xchat_android_core.praise.PraiseModel;
import com.yizhuan.xchat_android_core.redpackage.RedEnvelopeRoomMsg;
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomMessageViewNoticeInfo;
import com.yizhuan.xchat_android_core.room.bean.WelcomeInfo;
@@ -508,16 +510,10 @@ public class MessageView extends FrameLayout {
// 房间通告
if ("礼物特效".equals(chatRoomMessage.getContent())) {
setUpdateGiftEffectMsg(tvContent);
}
// else if (chatRoomMessage.getContent().contains(IMNetEaseManager.ROOM_INTRO_TAG)) {
// tvContent.setTextColor(ContextCompat.getColor(mContext, R.color.color_FFE96E));
// tvContent.setText(chatRoomMessage.getContent());
// }
else if (XChatConstants.ROOM_INTRODUCTION.equals(chatRoomMessage.getContent()) || chatRoomMessage.getContent().contains(IMNetEaseManager.ROOM_INTRO_TAG)) {
} else if (XChatConstants.ROOM_INTRODUCTION.equals(chatRoomMessage.getContent()) || chatRoomMessage.getContent().contains(IMNetEaseManager.ROOM_INTRO_TAG)) {
tvContent.setTextColor(ContextCompat.getColor(mContext, R.color.white));
tvContent.setText(chatRoomMessage.getContent());
} else {
// tvContent.setTextColor(Color.WHITE);
tvContent.setTextColor(ContextCompat.getColor(mContext, R.color.appColor));
tvContent.setText(chatRoomMessage.getContent());
}
@@ -793,6 +789,9 @@ public class MessageView extends FrameLayout {
if (second == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_MSG) {
setRedPackageMsg(chatRoomMessage, tvContent);
}
} else if (first == CustomAttachment.CUSTOM_MSG_DATING) {
clearBackground(tvContent);
setDatingMsg(chatRoomMessage, tvContent, second);
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
@@ -800,11 +799,105 @@ public class MessageView extends FrameLayout {
}
} catch (UnsupportedOperationException e) {
e.printStackTrace();
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
}
}
private void setDatingMsg(ChatRoomMessage chatRoomMessage, TextView tvContent, int second) {
if (chatRoomMessage.getAttachment() instanceof DatingAttachment) {
DatingAttachment datingAttachment = (DatingAttachment) chatRoomMessage.getAttachment();
DatingNotifyInfo notifyInfo = datingAttachment.getDatingNotifyInfo();
SpannableBuilder text = new SpannableBuilder(tvContent);
switch (second) {
case CustomAttachment.CUSTOM_MSG_SUB_DATING_SELECT:
text.append("本轮您选择了 ", new ForegroundColorSpan(roomTipColor))
.append((notifyInfo.getTargetPosition() + 1) + "" + (notifyInfo.getTargetGender() == 1 ? "" : "") + "嘉宾 ", new ForegroundColorSpan(textColor))
.append(notifyInfo.getTargetNickname(),new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
} )
.append(" 作为你的心动对象", new ForegroundColorSpan(textColor));
break;
case CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE:
if (notifyInfo.getHasSelectUser()) {
text.append(notifyInfo.getNickname(),new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
})
.append(" 的心动对象是 ", new ForegroundColorSpan(textColor))
.append(notifyInfo.getTargetNickname(), new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
});
} else {
text.append(notifyInfo.getNickname(),new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
})
.append(" 未选择心动对象", new ForegroundColorSpan(roomTipColor));
}
break;
case CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_HEART:
text.append("恭喜 ", new ForegroundColorSpan(textColor))
.append(notifyInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
})
.append("", new ForegroundColorSpan(textColor))
.append(notifyInfo.getTargetNickname(), new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(notifyInfo.getTargetUid())).subscribe(clickConsumer);
}
}
})
.append(" 牵手成功,让我们见证他们幸福的开端", new ForegroundColorSpan(0xFFF84C95));
break;
}
tvContent.setText(text.build());
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
}
}
/**
* 提示已经加入的话题的通知
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -727,6 +727,8 @@ public final class IMNetEaseManager {
noticeQueueMemberInfoUpdate();
}
}
} else if (msg.getMsgType() == MsgTypeEnum.tip) {
addMessages(msg);
} else if (msg.getMsgType() == MsgTypeEnum.custom) {
MsgAttachment attachment = msg.getAttachment();
if (attachment == null) return;

View File

@@ -508,15 +508,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
break;
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
switch (second){
case CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM:
attachment = new RoomInviteFansAttachment(second);
break;
default:
break;
if (second == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM) {
attachment = new RoomInviteFansAttachment(second);
}
break;
case CustomAttachment.CUSTOM_MSG_LUCKY_GIFT:
switch (second){
case CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_ROOM_NOTIFY:
@@ -544,6 +539,7 @@ public class CustomAttachParser implements MsgAttachmentParser {
attachment = new DatingPublishAttachment(first, second);
break;
}
break;
default:
break;
}

View File

@@ -371,11 +371,11 @@ public class CustomAttachment implements MsgAttachment {
//相亲模式
public static final int CUSTOM_MSG_DATING = 71;
public static final int CUSTOM_MSG_SUB_DATING_SELECT = 711;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_RESULT = 712;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE = 713;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_HEART = 714;
public static final int CUSTOM_MSG_DATING = 72;
public static final int CUSTOM_MSG_SUB_DATING_SELECT = 721;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_RESULT = 722;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE = 723;
public static final int CUSTOM_MSG_SUB_DATING_PUBLISH_HEART = 724;
public CustomAttachment() {

View File

@@ -10,6 +10,7 @@ import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.ToString;
/**
@@ -17,6 +18,7 @@ import lombok.Data;
* @date 2017/5/24
*/
@Data
@ToString
public class RoomInfo implements Parcelable,Serializable {
public static final int ROOMTYPE_AUCTION = 1;//竞拍房间
public static final int ROOMTYPE_LIGHT_CHAT = 2;//轻聊房
@@ -183,47 +185,6 @@ public class RoomInfo implements Parcelable,Serializable {
// private String badge;
@Override
public String toString() {
return "RoomInfo{" +
"uid=" + uid +
", officeUser=" + officeUser +
", roomId=" + roomId +
", title='" + title + '\'' +
", avatar='" + avatar + '\'' +
", type=" + type +
", roomDesc='" + roomDesc + '\'' +
", backPic='" + backPic + '\'' +
", valid=" + valid +
", operatorStatus=" + operatorStatus +
", hasAnimationEffect=" + hasAnimationEffect +
", audioQuality=" + audioQuality +
", isCloseScreen=" + isCloseScreen +
", hasDragonGame=" + hasDragonGame +
", meetingName='" + meetingName + '\'' +
", roomPwd='" + roomPwd + '\'' +
", roomTag='" + roomTag + '\'' +
", tagId=" + tagId +
", tagPict='" + tagPict + '\'' +
", onlineNum=" + onlineNum +
", isRecom=" + isRecom +
", isRoomFans=" + isRoomFans +
", background=" + background +
", hasKTVPriv=" + hasKTVPriv +
", isOpenKTV=" + isOpenKTV +
", isOpenGame=" + isOpenGame +
", roomGame=" + roomGame +
", boxSwitchVo=" + boxSwitchVo +
", serverRedEnvelopeSwitch=" + serverRedEnvelopeSwitch +
", singingMusicName='" + singingMusicName + '\'' +
", limitType='" + limitType + '\'' +
", roomModeType=" + roomModeType +
", isPermitRoom=" + isPermitRoom +
", showGiftValue=" + showGiftValue +
'}';
}
public RoomInfo() {
}
@@ -567,5 +528,4 @@ public class RoomInfo implements Parcelable,Serializable {
}
}

View File

@@ -28,12 +28,10 @@ import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Path;
/**
* <p> 轰趴房model层数据获取 </p>
@@ -203,6 +201,21 @@ public class HomePartyModel extends RoomBaseModel implements IHomePartyModel {
}
@Override
public Single<String> datingOpen(long roomUid) {
return mHomePartyService.datingOpen(roomUid)
.compose(RxHelper.handleSchedulers())
.compose(RxHelper.handleStringData());
}
@Override
public Single<String> datingClose(long roomUid) {
return mHomePartyService.datingClose(roomUid)
.compose(RxHelper.handleSchedulers())
.compose(RxHelper.handleStringData());
}
@Override
public Single<String> datingNext(long roomUserId) {
return mHomePartyService.datingNext(roomUserId)
@@ -257,6 +270,26 @@ public class HomePartyModel extends RoomBaseModel implements IHomePartyModel {
@Field("ticket") String ticket,
@Field("uid") long uid);
/**
* 开启相亲模式
*
* @return
*/
@FormUrlEncoded
@POST("/blind-date/enable")
Single<ServiceResult<String>> datingOpen(@Field("roomUid") long roomUid);
/**
* 关闭相亲模式
*
* @return
*/
@FormUrlEncoded
@POST("/blind-date/disable")
Single<ServiceResult<String>> datingClose(@Field("roomUid") long roomUid);
/**
* 相亲开始下一步
*

View File

@@ -63,6 +63,10 @@ public interface IHomePartyModel extends IModel {
*/
Single<String> openOrCloseMicroPhone(int micPosition, int state, long roomUid, String ticket);
Single<String> datingOpen(long roomUid);
Single<String> datingClose(long roomUid);
Single<String> datingNext(long roomUserId);
Single<String> datingSelect(long chosenUserId, long electorUserId, long roomUserId);