新增小助手中英文图标判定

新增消息页图标中英文判定
This commit is contained in:
zlzw 2024-04-26 14:47:58 +08:00
parent d0c0f8f82e
commit 651fe12edd
9 changed files with 263 additions and 3 deletions

View File

@ -38,6 +38,7 @@ import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.AnchorStartLiveBean;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
@ -142,6 +143,7 @@ public class AppContext extends CommonAppContext {
registerError();
registerFirebaseCrash();
LogUtils.start(this);
//DebugDialog.getInstance().setParams("初始化","启动");
sInstance = this;
L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this);

View File

@ -0,0 +1,62 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
public class DebugDialogAdapter extends RecyclerView.Adapter<DebugDialogAdapter.DebugViewHolder> {
TreeMap<String, String> paramMap = new TreeMap<>();
private Context mContext;
public DebugDialogAdapter(Context mContext) {
this.mContext = mContext;
}
public void setParamMap(TreeMap<String, String> paramMap) {
Log.i("debug弹窗", "setParamMap: 添加值到view " + paramMap.size());
this.paramMap = paramMap;
notifyDataSetChanged();
}
@NonNull
@Override
public DebugViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new DebugViewHolder(new TextView(mContext));
}
@Override
public void onBindViewHolder(@NonNull DebugViewHolder holder, int position) {
List<String> list = new ArrayList<>(paramMap.keySet());
Log.i("debug弹窗", "onBindViewHolder: 添加值到view " + list.size() + "|" + paramMap.size());
holder.setData(list.get(position), paramMap.get(list.get(position)));
}
@Override
public int getItemCount() {
Log.i("debug弹窗", "getItemCount: " + paramMap.size());
return paramMap.size();
}
public class DebugViewHolder extends RecyclerView.ViewHolder {
public DebugViewHolder(@NonNull View itemView) {
super(itemView);
}
public void setData(String tag, String msg) {
Log.i("debug弹窗", "setData: 添加值到view " + tag + "|" + msg);
((TextView) itemView).setText(tag + ":" + msg);
((TextView) itemView).setTextColor(Color.BLACK);
}
}
}

View File

@ -1,6 +1,9 @@
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;
/**
* 机器人助手IM消息
@ -21,6 +24,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
//标签图片
@SerializedName("icon")
private String icon;
@SerializedName("icon_en")
@JSONField(name = "icon_en")
private String iconEn;
//气泡背景
@SerializedName("system_bubble")
private String systemBubble;
@ -35,7 +41,7 @@ public class AiAutomaticSpeechModel extends BaseModel {
}
public String getAiName() {
return aiName+":";
return aiName + ":";
}
public AiAutomaticSpeechModel setAiName(String aiName) {
@ -43,6 +49,14 @@ public class AiAutomaticSpeechModel extends BaseModel {
return this;
}
public String getIconEn() {
return iconEn;
}
public void setIconEn(String iconEn) {
this.iconEn = iconEn;
}
public String getContent() {
return content;
}
@ -62,6 +76,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
}
public String getIcon() {
if (!WordUtil.isNewZh() && !StringUtil.isEmpty(iconEn)) {
return iconEn;
}
return icon;
}

View File

@ -0,0 +1,119 @@
package com.yunbao.common.dialog;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.ViewGroup;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.enums.ShowPattern;
import com.lzf.easyfloat.interfaces.OnPermissionResult;
import com.lzf.easyfloat.permission.PermissionUtils;
import com.yunbao.common.adapter.DebugDialogAdapter;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ToastUtil;
import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeMap;
public class DebugDialog {
RecyclerView recyclerView;
TreeMap<String, String> params;
DebugDialogAdapter adapter;
private static DebugDialog debugDialog;
Context mContext;
public static DebugDialog getInstance() {
if (debugDialog == null) {
debugDialog = new DebugDialog();
}
return debugDialog;
}
public DebugDialog clear() {
params.clear();
return this;
}
public void setParams(String tag, String msg) {
Log.i("debug弹窗", "setParams: "+tag+"|"+msg);
params.put(tag, msg);
if (adapter != null)
adapter.setParamMap(params);
}
private DebugDialog() {
if(params==null) {
Log.i("debug弹窗", "DebugDialog: 初始化参数");
params = new TreeMap<>();
}
init();
}
private void init(){
this.mContext = AppManager.getInstance().getMainActivity();
if (mContext == null) {
startWaitMainActivity();
return;
}
if (PermissionUtils.checkPermission(mContext)) {
createView();
} else {
PermissionUtils.requestPermission((Activity) mContext, new OnPermissionResult() {
@Override
public void permissionResult(boolean b) {
ToastUtil.show("悬浮权限" + b);
if (b) {
createView();
}
}
});
}
// createView();
}
private void startWaitMainActivity() {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
Log.i("debug弹窗", "run: "+AppManager.getInstance().getMainActivity());
if (AppManager.getInstance().getMainActivity() != null) {
init();
cancel();
}
}
}, 0,1000);
}
protected void createView() {
recyclerView = new RecyclerView(mContext);
adapter = new DebugDialogAdapter(mContext);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
recyclerView.setAdapter(adapter);
recyclerView.setBackgroundColor(Color.WHITE);
EasyFloat.with(mContext)
.setTag("debug")
.setShowPattern(ShowPattern.FOREGROUND)
.setLayout(recyclerView)
.show();
if(!params.isEmpty()){
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
adapter.setParamMap(params);
}
},1000);
Log.i("debug弹窗", "createView: 有值");
}
Log.i("debug弹窗", "createView: 创建");
}
}

View File

@ -19,6 +19,7 @@ import com.yunbao.common.event.LiveSudGameHistoryEvent;
import com.yunbao.common.event.RoomHolderTypeEvent;
import com.yunbao.common.event.SudGameListEvent;
import com.yunbao.common.event.SudGameListSillEvent;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -87,6 +88,12 @@ public class SudGameListSelectPopup extends AttachPopupView {
if (mType == 0 || mType == 4) {
topSelect.setText(getContext().getString(R.string.interactive_game_room_all));
for (int i = 0; i < customSidebarChildModels.size(); i++) {
DebugDialog.getInstance().setParams("UserType", IMLoginManager.get(getContext()).getUserInfo().getUsersType());
if (!IMLoginManager.get(getContext()).getUserInfo().anchorUserType()) {
if ("1490944230389182466".equals(customSidebarChildModels.get(i).getSrc())) {//友尽闯关
continue;
}
}
selectString.add(customSidebarChildModels.get(i).getTitle());
if (TextUtils.equals(String.valueOf(interactionID), customSidebarChildModels.get(i).getSrc())) {
index = i;

View File

@ -11,6 +11,7 @@ public class AppManager {
private static Stack<Activity> activityStack;
public AppManager() {
activityStack=new Stack<>();
}
/**
@ -20,6 +21,33 @@ public class AppManager {
return SingleApp.INSTANCE;
}
public static Activity getActivity(String activityName) {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains(activityName)) {
return activity;
}
}
return null;
}
public Activity getMainActivity() {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains("MainActivity")) {
return activity;
}
}
return null;
}
public Activity getLiveActivity() {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains("LiveAudienceActivity")) {
return activity;
}
}
return null;
}
public static class SingleApp {
public static AppManager INSTANCE = new AppManager();
}
@ -58,7 +86,14 @@ public class AppManager {
* 获取当前显示Activity堆栈中最后一个传入的activity
*/
public Activity getLastActivity() {
if (activityStack.isEmpty()) {
return null;
}
Activity activity = activityStack.lastElement();
if (activity == null || activity.isFinishing()) {
activityStack.remove(activity);
return getLastActivity();
}
return activity;
}
@ -117,7 +152,7 @@ public class AppManager {
}
/**
*仅在debug下运行的代码
* 仅在debug下运行的代码
*/
public static void runDebugCode(Runnable runnable) {
if (BuildConfig.DEBUG) {

View File

@ -2,8 +2,11 @@ package com.yunbao.live.bean;
import android.text.TextUtils;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -30,8 +33,21 @@ public class ImUserBean extends BaseModel {
String _method_ = "";//融雲消息類型
@SerializedName("new_image")
private String newImage;
@JSONField(name = "en_image")
private String newImageEn;
public String getNewImageEn() {
return newImageEn;
}
public void setNewImageEn(String newImageEn) {
this.newImageEn = newImageEn;
}
public String getNewImage() {
if (!WordUtil.isNewZh() && !StringUtil.isEmpty(newImageEn)) {
return newImageEn;
}
return newImage;
}

View File

@ -192,6 +192,8 @@ public class BattlePassRewardFragment extends BaseFragment {
}
if(data.getIs_received()>=2){
Bus.get().post(new BattlePassTypeEvent(1).setBean(data));
}else{
Bus.get().post(new BattlePassTypeEvent(2).setBean(data));
}
Collection<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> values = data.getLive_battle_pass_rewards().values();
List<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> list = new ArrayList<>(values);

View File

@ -41,5 +41,5 @@
<string name="activity_feedback_edit_submit_tip3">Today\'s feedback count has been used up</string>
<string name="activity_feedback_edit_img_select">Select from album</string>
<string name="activity_feedback_edit_img_camera">Photo shoot</string>
<string name="activity_battle_pass_all_get">一键领取</string>
<string name="activity_battle_pass_all_get">Receive all</string>
</resources>