fix [分享直播和动态改成叫【站内分享】]

This commit is contained in:
zlzw 2024-03-25 18:05:59 +08:00
parent a497d70599
commit f8c5b072af
2 changed files with 45 additions and 1 deletions

View File

@ -48,7 +48,26 @@ public class WordUtil {
sResources.updateConfiguration(tmp, sResources.getDisplayMetrics()); sResources.updateConfiguration(tmp, sResources.getDisplayMetrics());
return str; return str;
} }
public static String getChineseString(int res) {
Configuration config = new Configuration();
Configuration tmp = sResources.getConfiguration();
config.setToDefaults();
config.locale = Locale.TRADITIONAL_CHINESE;
sResources.updateConfiguration(config, sResources.getDisplayMetrics());
String str = sResources.getString(res);
sResources.updateConfiguration(tmp, sResources.getDisplayMetrics());
return str;
}
public static String getEnglishString(int res) {
Configuration config = new Configuration();
Configuration tmp = sResources.getConfiguration();
config.setToDefaults();
config.locale = Locale.ENGLISH;
sResources.updateConfiguration(config, sResources.getDisplayMetrics());
String str = sResources.getString(res);
sResources.updateConfiguration(tmp, sResources.getDisplayMetrics());
return str;
}
/** /**
* 是否包含特殊字符 * 是否包含特殊字符
*/ */

View File

@ -1,6 +1,7 @@
package com.yunbao.main.utils; package com.yunbao.main.utils;
import android.graphics.Color; import android.graphics.Color;
import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -17,9 +18,11 @@ import com.yunbao.common.utils.DateFormatUtil;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -59,6 +62,28 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
@Override @Override
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) { public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
List<Integer> defList = new ArrayList<>();
defList.add(R.string.rc_conversation_summary_content_image);
defList.add(R.string.rc_conversation_summary_content_voice);
defList.add(R.string.activity_msg_chat_list_card);
for (int def : defList) {
String str = holder.getContext().getString(def);
String cn = WordUtil.getChineseString(def);
String en = WordUtil.getEnglishString(def);
String content = uiConversation.mConversationContent.toString();
Log.i("列表----", "bindViewHolder: " + str + " | " + uiConversation.mConversationContent);
if (WordUtil.isNewZh()) {
if (en.equals(content)) {
uiConversation.mConversationContent = new SpannableString(WordUtil.getNewString(def));
break;
}
} else {
if (cn.equals(content)) {
uiConversation.mConversationContent = new SpannableString(WordUtil.getNewString(def));
break;
}
}
}
//根据业务需要自定义处理 //根据业务需要自定义处理
super.bindViewHolder(holder, uiConversation, position, list, listener); super.bindViewHolder(holder, uiConversation, position, list, listener);