同步优化代码

This commit is contained in:
Martin
2024-08-14 09:35:01 +08:00
parent d61d142ec1
commit 3143ec2be4
155 changed files with 113 additions and 210 deletions

View File

@@ -19,6 +19,7 @@ import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.message.content.MessageChatCardContent;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ChatMsgTypeUtils;
import com.yunbao.common.utils.DateFormatUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ViewUtils;
@@ -39,8 +40,11 @@ import io.rong.imkit.widget.adapter.ViewHolder;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.HQVoiceMessage;
import io.rong.message.ImageMessage;
import io.rong.message.SightMessage;
import io.rong.message.TextMessage;
import io.rong.message.VoiceMessage;
public class MainConversationListAdapter extends ConversationListAdapter {
public static final int TYPE_SEARCH_TITLE = 500;
@@ -134,6 +138,7 @@ public class MainConversationListAdapter extends ConversationListAdapter {
Log.i("列表", "bindDefault: 用户名字:" + conversation.mCore.getConversationTitle());
ImgLoader.display(holder.getContext(), conversation.mCore.getPortraitUrl(), holder.getView(R.id.rc_conversation_portrait));
holder.setText(R.id.rc_conversation_title, conversation.mCore.getConversationTitle());
((TextView) holder.getView(R.id.rc_conversation_content)).setText(ChatMsgTypeUtils.getMsg(conversation.mConversationContent.toString()));
if (conversation.mCore.getSentTime() != -1 && holder.getView(R.id.rc_conversation_date) != null) {
holder.setText(R.id.rc_conversation_date, DateFormatUtil.getDateTimeString(conversation.mCore.getSentTime(), true, holder.getContext()));
holder.getView(R.id.rc_conversation_date).setVisibility(View.VISIBLE);
@@ -337,10 +342,15 @@ public class MainConversationListAdapter extends ConversationListAdapter {
conversation.mCore.setUnreadMessageCount(integer);
if(bean.getContent() instanceof SightMessage){
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[小視頻]":"[Video]");
}else{
}else if(bean.getContent() instanceof HQVoiceMessage){
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[語音]":"[Voice]");
} else if(bean.getContent() instanceof ImageMessage){
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[圖片]":"[picture]");
}else if(bean.getContent() instanceof MessageChatCardContent){
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[站內分享]":"[In-app sharing]");
} else{
conversation.mConversationContent = new SpannableString(((TextMessage) bean.getContent()).getContent());
}
mDataList.set(id, conversation);
notifyItemChanged(id);
}

View File

@@ -87,7 +87,7 @@ public class LiveTaskModel extends BaseModel {
public String getEndTime() {
if (!StringUtil.isEmpty(endTime)) {
endTime =WordUtil.getString(R.string.live_task_new_user_timer) + new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault()).format(new Date(Long.parseLong(endTime) * 1000));
endTime = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault()).format(new Date(Long.parseLong(endTime) * 1000));
}
return endTime;
}

View File

@@ -277,7 +277,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow {
void initData() {
adapter.setList_type(list_type);
if (isAnchor) {
if (isAnchor || (isTab2Enter && isStar)) {
if (isStar) {
gift_hall_type = 2;
} else {

View File

@@ -14,6 +14,7 @@ import com.yunbao.common.R;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.custom.RatioRoundImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.ChatMsgTypeUtils;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
@@ -93,7 +94,7 @@ public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
if (StringUtil.isEmpty(liveBean.getExtras())) {
((TextView) findViewById(R.id.description)).setText(liveBean.getUser().getSignature());
} else {
((TextView) findViewById(R.id.description)).setText(liveBean.getExtras());
((TextView) findViewById(R.id.description)).setText(ChatMsgTypeUtils.getMsg(liveBean.getExtras()));
}
new Handler(Looper.getMainLooper()).postDelayed(() -> {
dismiss();

View File

@@ -2,6 +2,7 @@ package com.yunbao.common.fragment;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.util.Log;
import android.view.View;
@@ -23,6 +24,7 @@ import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
import com.yunbao.common.adapter.MainConversationListAdapter;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.utils.ChatMsgTypeUtils;
import com.yunbao.common.utils.StringUtil;
import org.greenrobot.eventbus.EventBus;
@@ -158,7 +160,7 @@ public abstract class AbsMainMessageChatListFragment extends Fragment {
break;
}
}
srcList.get(i).mConversationContent =new SpannableString(ChatMsgTypeUtils.getMsg(srcList.get(i).mConversationContent.toString()));
}
onRefreshListener.onFinish(srcList);
isNet = false;

View File

@@ -3,6 +3,7 @@ package com.yunbao.common.fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -23,6 +24,7 @@ import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ChatMsgTypeUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.StringUtil;
@@ -39,6 +41,7 @@ import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.UserInfo;
import io.rong.message.VoiceMessage;
public class MainMessageChatListFragment extends AbsMainMessageChatListFragment {
private static final String TAG = "MainMessageChatListFragment";
@@ -72,6 +75,9 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
@Override
public void onFinish(List<BaseUiConversation> baseUiConversations) {
InstructorRemarkManager.get(mContext).getNetInstructorRemark();
for (int i = 0; i <baseUiConversations.size(); i++) {
baseUiConversations.get(i).mCore.getMessage();
}
loadLiveLookTime(baseUiConversations, new OnRecyclerListRefreshListener<Map<String, Integer>>() {
@Override
public void onFinish(Map<String, Integer> stringIntegerMap) {

View File

@@ -0,0 +1,22 @@
package com.yunbao.common.utils;
/**
* 消息类型翻译管理器
*/
public class ChatMsgTypeUtils {
public static String getMsg(String msg) {
String rsult = msg;
switch (msg) {
case "[小视频]":
rsult = WordUtil.isNewZh() ? "[小視頻]" : "[Video]";
break;
case "[语音]":
rsult = WordUtil.isNewZh() ? "[語音]" : "[Voice]";
break;
case "[图片]":
rsult = WordUtil.isNewZh() ? "[圖片]" : "[Image]";
break;
}
return rsult;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -812,6 +812,7 @@ Limited ride And limited avatar frame</string>
<string name="random_pk_dialog_apply">accept</string>
<string name="random_pk_dialog_refuse">refuse</string>
<string name="random_pk_dialog_refuse_again">Persist in refusing</string>
<string name="random_pk_dialog_title">Random PK hint</string>
<string name="speech_robot_setup">Automatic speech robot setup</string>