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

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;
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_SUB_BOX_ME;
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.ROOM_DIAMOND;
@@ -1631,6 +1633,9 @@ public class MessageView extends FrameLayout {
if (attachment.getPrizeNum() > 1) {
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());
}

View File

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

View File

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