From a01ddd310be18192efe665bd6934d1f8ebda9409 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 2 Jun 2023 09:56:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=95=E7=A5=A8=E8=A7=82?= =?UTF-8?q?=E4=BC=97=E7=AB=AF=E7=9A=84=E4=B8=AD=E8=8B=B1=E6=96=87=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/bean/LiveRoomVoteModel.java | 29 ++++++++++++++----- .../com/yunbao/common/utils/WordUtil.java | 5 ++-- .../live/activity/LiveAudienceActivity.java | 3 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java index c9de60a77..123ea368b 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java @@ -1,8 +1,8 @@ package com.yunbao.common.bean; -import com.alibaba.fastjson.annotation.JSONField; import com.google.gson.annotations.SerializedName; import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.WordUtil; import java.util.List; @@ -36,8 +36,10 @@ public class LiveRoomVoteModel extends BaseModel { private String answer1; @SerializedName("option_content_second") private String answer2; - @SerializedName("result") - private String result; + @SerializedName("result_zh") + private String resultZh; + @SerializedName("result_en") + private String resultEn; @SerializedName("option_text") private String optionText; @SerializedName("option_content_key") @@ -126,11 +128,23 @@ public class LiveRoomVoteModel extends BaseModel { } public String getResult() { - return result; + return WordUtil.isZh() ? resultZh : resultEn; } - public void setResult(String result) { - this.result = result; + public String getResultZh() { + return resultZh; + } + + public void setResultZh(String resultZh) { + this.resultZh = resultZh; + } + + public String getResultEn() { + return resultEn; + } + + public void setResultEn(String resultEn) { + this.resultEn = resultEn; } public String getOptionText() { @@ -153,7 +167,8 @@ public class LiveRoomVoteModel extends BaseModel { ", userIds=" + userIds + ", answer1='" + answer1 + '\'' + ", answer2='" + answer2 + '\'' + - ", result='" + result + '\'' + + ", resultZh='" + resultZh + '\'' + + ", resultEn='" + resultEn + '\'' + ", optionText='" + optionText + '\'' + ", vote='" + vote + '\'' + ", liveUid='" + liveUid + '\'' + diff --git a/common/src/main/java/com/yunbao/common/utils/WordUtil.java b/common/src/main/java/com/yunbao/common/utils/WordUtil.java index 41c0c83ff..f3725bef9 100644 --- a/common/src/main/java/com/yunbao/common/utils/WordUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/WordUtil.java @@ -3,6 +3,7 @@ package com.yunbao.common.utils; import android.content.res.Resources; import com.yunbao.common.CommonAppContext; +import com.yunbao.common.manager.IMLoginManager; import java.util.Locale; import java.util.regex.Matcher; @@ -26,9 +27,7 @@ public class WordUtil { } public static boolean isZh() { - Locale locale = sResources.getConfiguration().locale; - String language = locale.getLanguage(); - return language.endsWith("zh"); + return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE; } /** diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 26f7ead05..52e55c9c5 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1365,7 +1365,8 @@ public class LiveAudienceActivity extends LiveActivity { voteModel.setAnswer2(map.getString("answer2")); voteModel.setAnswer1Num(map.getInteger("num1")); voteModel.setAnswer2Num(map.getInteger("num2")); - voteModel.setResult(map.getString("result")); + voteModel.setResultZh(map.getString("result_zh")); + voteModel.setResultEn(map.getString("result_en")); voteModel.setOptionText(map.getString("option_text")); System.out.println(">>>" + voteModel); String content = voteModel.getResult();