交友聊天房间名去掉换行,收藏房间公屏

This commit is contained in:
oujunhui
2020-06-24 18:47:59 +08:00
parent 9f363fdfa8
commit 4b75843fcb
8 changed files with 80 additions and 2 deletions

View File

@@ -2894,6 +2894,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
/**
* 取消我的报名,如果我已经报名的话
*/
@SuppressLint("CheckResult")
private void cancelMyQueue() {
if (AvRoomDataManager.get().isQueuingMicro() && AvRoomDataManager.get().myIsInQueue) {
MicQueueModel.get().cancelApplyForQueuing(AvRoomDataManager.get().getRoomUid(),
@@ -2973,6 +2974,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
public void onCancel() {
}
@SuppressLint("CheckResult")
@Override
public void onOk() {
ImGameMode.get()

View File

@@ -873,6 +873,7 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
* @param position
* @param ownerUid
*/
@SuppressLint("CheckResult")
public void followOwner(int position, long ownerUid) {
PraiseModel.get().praise(ownerUid, true).subscribe(new BiConsumer<String, Throwable>() {
@Override

View File

@@ -763,7 +763,13 @@ public class MessageView extends FrameLayout {
//麦上用户对你的欢迎语
setMicWelcomeContent(chatRoomMessage, tvContent, baseViewHolder.getAdapterPosition());
}
} else {
} else if (first == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM){
if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_FOLLOW_ROOM_SUCCESS) {
//收藏了房间
setFollowRoomTip(tvContent, (RoomTipAttachment) attachment, chatRoomMessage);
}
}
else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
}
@@ -1638,6 +1644,22 @@ public class MessageView extends FrameLayout {
tvContent.setText(text.build());
}
/**
* xxx 收藏了房间
*
* @param tvContent -
* @param roomTipAttachment -
*/
private void setFollowRoomTip(TextView tvContent, RoomTipAttachment roomTipAttachment, ChatRoomMessage chatRoomMessage) {
if (TextUtils.isEmpty(roomTipAttachment.getNick())) roomTipAttachment.setNick("");
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
SpannableBuilder text = new SpannableBuilder(tvContent)
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
.append(RegexUtil.getPrintableString(roomTipAttachment.getNick()), new ForegroundColorSpan(roomTipColor))
.append(" 收藏了房间", new ForegroundColorSpan(greyColor));
tvContent.setText(text.build());
}
/**
* {badge}{level} xxx 出 运气表情
* <p>
@@ -2348,6 +2370,7 @@ public class MessageView extends FrameLayout {
AvRoomDataManager.get().isRoomFans = true;
SingleToastUtil.showToast("收藏成功!");
EventBus.getDefault().post(new FollowRoomEvent());
setFollowRoomSuccessRoomTip(JavaUtil.str2long(chatRoomMessage.getFromAccount()));
});
}
}
@@ -2366,6 +2389,45 @@ public class MessageView extends FrameLayout {
}
}
/**
* 收藏房间成功
* @param targetUid
*/
@SuppressLint("CheckResult")
private void setFollowRoomSuccessRoomTip(long targetUid){
UserModel.get().getUserInfo(targetUid).subscribe(new Consumer<UserInfo>() {
@Override
public void accept(UserInfo userInfo) throws Exception {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo != null && userInfo != null) {
UserInfo myUserInfo = UserModel.get().getCacheLoginUserInfo();
RoomTipAttachment roomTipAttachment =
new RoomTipAttachment(CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM,
CustomAttachment.CUSTOM_MSG_SUB_TYPE_FOLLOW_ROOM_SUCCESS);
roomTipAttachment.setUid(myUserInfo.getUid());
roomTipAttachment.setNick(myUserInfo.getNick());
roomTipAttachment.setTargetUid(targetUid);
roomTipAttachment.setTargetNick(userInfo.getNick());
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
// 聊天室id
roomInfo.getRoomId() + "",
// 自定义消息
roomTipAttachment
);
IMNetEaseManager.get().sendChatRoomMessage(message, true)
.subscribe(chatRoomMessage -> {
if (chatRoomMessage == null) return;
// 更新自己公屏的信息
IMNetEaseManager.get().addMessagesImmediately(chatRoomMessage);
});
}
}
});
}
public static class SpannableBuilder {
private SpannableStringBuilder builder;

View File

@@ -37,7 +37,7 @@ public class HomePlayAdapter extends BaseQuickAdapter<HomePlayInfo, BaseViewHold
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_tag), item.getTagPict());
helper.setText(R.id.tv_online_num,item.getOnlineNum()+"")
.setText(R.id.tv_title,item.getTitle());
.setText(R.id.tv_title,item.getTitle().replaceAll("\n",""));
if (!ListUtils.isListEmpty(item.getMicUsers()) && item.getMicUsers().size() < 5){
for (int i = 0; i < 5 - item.getMicUserCount(); i++) {

View File

@@ -139,6 +139,9 @@ public class HomePlayFragment extends BaseFragment{
@Override
public void run() {
if (getActivity() != null) {
if (homePlayList.size() <= 1){
return;
}
playAdapter.addData(0,homePlayList.get(homePlayList.size()-1));
playAdapter.remove(homePlayList.size()-1);
handler.postDelayed(this, REFRESH_SPEED);

View File

@@ -31,6 +31,8 @@
android:textColor="@color/color_333333"
android:textSize="13dp"
tools:text="官方交友厅"
android:lines="1"
android:ellipsize="end"
app:layout_constraintStart_toEndOf="@+id/iv_tag"
app:layout_constraintBottom_toBottomOf="@id/iv_tag"
android:layout_marginStart="@dimen/dp_10"

View File

@@ -704,6 +704,7 @@ public final class IMNetEaseManager {
if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_AUCTION
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_ROOM_TIP
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT
|| customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_KICK_MIC

View File

@@ -286,6 +286,8 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_GROUP_ROOM_JOIN_NOTICE = 465; // 话题房间某个人加入的通知
public static final int CUSTOM_MSG_ROOM_FOLLOW = 466;//在房间的公屏上关注房主
public static final int CUSTOM_MSG_ROOM_FOLLOW_2 = 467;//在房间的公屏上关注房主,第二个
public static final int CUSTOM_MSG_ROOM_FOLLOW_SUCCESS = 468;//在房间的关注房主,第二个
//全服广播
public static final int CUSTOM_MSG_HEADER_ALL_SERVICE_PUSH = 49;
@@ -337,6 +339,11 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_HEADER_TYPE_COMMON_SYS_NOTICATION = 58;
public static final int CUSTOM_MSG_SUB_TYPE_FIRST_RECHARGE_SUCCESS = 581; //首充成功
//收藏房间
public static final int CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM = 59;
public static final int CUSTOM_MSG_SUB_TYPE_FOLLOW_ROOM_SUCCESS = 591; //首充成功
public CustomAttachment() {
}