[BugFix]修复星级厨房公屏消息不显示和飘屏显示文字问题

This commit is contained in:
wushaocheng
2022-12-10 17:58:05 +08:00
parent 986870035b
commit dcac7493c8
3 changed files with 41 additions and 4 deletions

View File

@@ -55,6 +55,7 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.dialog.PKResultDialog;
import com.yizhuan.erban.common.util.Utils;
import com.yizhuan.erban.common.widget.CustomAutoWidthImageSpan;
import com.yizhuan.erban.common.widget.CustomImageSpan;
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
@@ -64,7 +65,6 @@ import com.yizhuan.erban.ui.widget.MyItemAnimator;
import com.yizhuan.erban.ui.widget.RecyclerViewNoViewpagerScroll;
import com.yizhuan.erban.ui.widget.UserInfoDialog;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.erban.common.util.Utils;
import com.yizhuan.erban.utils.RegexUtil;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.DemoCache;
@@ -107,6 +107,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageRoomMsgAttachment
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomNoticeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
@@ -205,6 +207,7 @@ public class MessageView extends FrameLayout {
private int greyColor;
private int roomTipNickColor;
private int roomTipColor;
private int roomBlueColor;
private int badgeWidth;
private int badgeHeight;
private int sysIconHeight;
@@ -268,6 +271,7 @@ public class MessageView extends FrameLayout {
greyColor = ContextCompat.getColor(context, R.color.white_transparent_50);
roomTipNickColor = ContextCompat.getColor(context, R.color.color_FEE057);
roomTipColor = ContextCompat.getColor(context, R.color.color_FEE057);
roomBlueColor = ContextCompat.getColor(context, R.color.color_00EAFF);
paddingWidth = Utils.dip2px(context, 11);
paddingHeight = Utils.dip2px(context, 6);
badgeWidth = Utils.dip2px(context, 15);
@@ -873,6 +877,8 @@ public class MessageView extends FrameLayout {
}
} else if (first == CustomAttachment.CUSTOM_MSG_BOX) {
setBoxMeMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_LUCKY_SEA) {
setLuckySeaMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_RADISH) {
setRadishMeMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_QUEUING_MIC) {
@@ -1700,6 +1706,36 @@ public class MessageView extends FrameLayout {
tvContent.setText(text.build());
}
private void setLuckySeaMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
RoomLuckySeaAttachment attachment = (RoomLuckySeaAttachment) chatRoomMessage.getAttachment();
RoomLuckySeaMsgBean bean = attachment.getRoomLuckySeaMsgInfo();
// 內容
SpannableBuilder text = new SpannableBuilder(tvContent)
.append(ResUtil.getString(R.string.congratulation), new ForegroundColorSpan(whiteColor))
.append(bean.getNick() + " ", new ForegroundColorSpan(roomTipNickColor))
.append(
ResUtil.getString(R.string.in_the_star_kitchen_draw),
new ForegroundColorSpan(whiteColor)
)
.append(
String.valueOf(bean.getItemMultiple()),
new ForegroundColorSpan(roomBlueColor)
)
.append(
ResUtil.getString(R.string.times_reward_get),
new ForegroundColorSpan(whiteColor)
)
.append(
String.valueOf(bean.getDiamonds()),
new ForegroundColorSpan(roomBlueColor)
)
.append(
ResUtil.getString(R.string.diamond_point),
new ForegroundColorSpan(whiteColor)
);
tvContent.setText(text.build());
}
private void setRadishMeMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
RoomBoxPrizeAttachment attachment = (RoomBoxPrizeAttachment) chatRoomMessage.getAttachment();
// 內容

View File

@@ -8,10 +8,11 @@
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="2"
android:lineSpacingExtra="0dp"
android:lineSpacingMultiplier="0.9"
android:lineSpacingMultiplier="0.8"
android:maxLines="2"
android:paddingStart="80dp"
android:paddingTop="@dimen/dp_6"
android:paddingEnd="80dp"
android:textSize="12sp"
tools:layout_height="wrap_content"

View File

@@ -3748,7 +3748,7 @@
<string name="layout_layout_pic_login_dialog_05">確定</string>
<string name="layout_layout_pk_board_view_01">PK記分板</string>
<string name="layout_layout_pk_board_view_02">未開始</string>
<string name="layout_layout_room_box_notify_01">哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈哈哈哈哈哈</string>
<string name="layout_layout_room_box_notify_01">哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈</string>
<string name="layout_layout_room_pk_board_view_01">PK記分板</string>
<string name="layout_layout_room_pk_board_view_02">PK結果計算中...</string>
<string name="layout_layout_room_pk_board_view_03">廳的名字七個字</string>