开箱允许中奖消息开关显示逻辑修改

This commit is contained in:
huangjian
2022-05-31 18:47:04 +08:00
parent f22c051e1e
commit e18a0d7c65
3 changed files with 14 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
package com.yizhuan.erban.avroom.widget; package com.yizhuan.erban.avroom.widget;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_DIAMOND; import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_DIAMOND;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_GIFT; import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_GIFT;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ROOM_DIAMOND; import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ROOM_DIAMOND;
@@ -1631,6 +1633,9 @@ public class MessageView extends FrameLayout {
if (attachment.getPrizeNum() > 1) { if (attachment.getPrizeNum() > 1) {
text.append(" x" + attachment.getPrizeNum() + " ", new ForegroundColorSpan(roomTipColor)); text.append(" x" + attachment.getPrizeNum() + " ", new ForegroundColorSpan(roomTipColor));
} }
if (attachment.getSecond() == CUSTOM_MSG_SUB_BOX_ME) {
text.append("仅自己可见", new ForegroundColorSpan(Color.WHITE));
}
tvContent.setText(text.build()); tvContent.setText(text.build());
} }

View File

@@ -53,18 +53,19 @@ public class BoxMoreDialog extends BaseBindingDialog<DialogBoxMoreBinding> {
closeDialog(); closeDialog();
}); });
if (sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() >= sendMessageSwitchLevel) { boolean canSwitch = sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() >= sendMessageSwitchLevel;
binding.flMsgSwitch.setVisibility(View.VISIBLE);
updateMsgSwitch(DemoCache.readNeedBoxMsg()); updateMsgSwitch(canSwitch && DemoCache.readNeedBoxMsg());
binding.ivSwitch.setOnClickListener(v -> { binding.ivSwitch.setOnClickListener(v -> {
if (canSwitch) {
boolean sendMsg = !DemoCache.readNeedBoxMsg(); boolean sendMsg = !DemoCache.readNeedBoxMsg();
updateMsgSwitch(sendMsg); updateMsgSwitch(sendMsg);
DemoCache.saveNeedBoxMsg(sendMsg); DemoCache.saveNeedBoxMsg(sendMsg);
SingleToastUtil.showToast("设置成功!"); SingleToastUtil.showToast("设置成功!");
}); } else {
} else { SingleToastUtil.showToast("财富值达到" + sendMessageSwitchLevel + "级可用,快去升级吧!");
binding.flMsgSwitch.setVisibility(View.GONE); }
} });
} }
private void updateMsgSwitch(boolean sendMsg) { private void updateMsgSwitch(boolean sendMsg) {

View File

@@ -60,7 +60,6 @@
<FrameLayout <FrameLayout
android:id="@+id/fl_msg_switch" android:id="@+id/fl_msg_switch"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">