修改,中英文问题(聊天框的中英文修改)

This commit is contained in:
18401019693 2023-04-25 15:24:57 +08:00
parent 5a9535e81d
commit 43deb95435
9 changed files with 66 additions and 65 deletions

View File

@ -5,16 +5,17 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 31, targetSdkVersion : 31,
versionCode : 418, versionCode : 418,
versionName : "6.5.0" versionName : "6.5.1"
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
// serverHost : "https://napi.yaoulive.com", serverHost : "https://napi.yaoulive.com",
// //
serverHost : "https://ceshi.yaoulive.com", // serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
// txMapAppSecret : "", // txMapAppSecret : "",
// //

View File

@ -799,7 +799,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveAnchorViewHolder.startAnchorLiveTime(); mLiveAnchorViewHolder.startAnchorLiveTime();
} }
mLiveBottomViewHolder = mLiveAnchorViewHolder; mLiveBottomViewHolder = mLiveAnchorViewHolder;
mSocketRyClient = new SocketRyClient(mLiveUid, this); mSocketRyClient = new SocketRyClient(mLiveUid, this,mContext);
mSocketRyClient.setLivePushRyViewHolder(mLivePushViewHolder); mSocketRyClient.setLivePushRyViewHolder(mLivePushViewHolder);
CommonAppContext.Ingroup = 1; CommonAppContext.Ingroup = 1;

View File

@ -7,6 +7,7 @@ import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMMessage; import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.imsdk.v2.V2TIMSendCallback; import com.tencent.imsdk.v2.V2TIMSendCallback;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -146,7 +147,7 @@ public class SocketChatUtil {
.param("medal_name", u.getMedalName()) .param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel()) .param("medal_level", u.getMedalLevel())
.param("good_num", u.getGoodnum()) .param("good_num", u.getGoodnum())
.param("ct",WordUtil.getString(R.string.live_lighted)); .param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.live_lighted));
msg.create(); msg.create();
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() { V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
@Override @Override
@ -321,7 +322,7 @@ public class SocketChatUtil {
.param("uid", u.getId()) .param("uid", u.getId())
.param("touid", toUid) .param("touid", toUid)
.param("toname", toName) .param("toname", toName)
.param("ct", toName +WordUtil.getString(R.string.live_kicked)); .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_kicked));
msg.create(); msg.create();
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() { V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
@Override @Override
@ -364,7 +365,7 @@ public class SocketChatUtil {
.param("uid", u.getId()) .param("uid", u.getId())
.param("touid", toUid) .param("touid", toUid)
.param("toname", toName) .param("toname", toName)
.param("ct", toName +WordUtil.getString(type == 0 ? R.string.live_shut : R.string.live_shut_2)); .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(type == 0 ? R.string.live_shut : R.string.live_shut_2));
msg.create(); msg.create();
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() { V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
@Override @Override
@ -396,7 +397,7 @@ public class SocketChatUtil {
if (u == null) { if (u == null) {
return; return;
} }
String s = action == 1 ?WordUtil.getString(R.string.live_set_admin) :WordUtil.getString(R.string.live_set_admin_cancel); String s = action == 1 ?CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin) :CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin_cancel);
final SocketSendBean msg = new SocketSendBean() final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SET_ADMIN) .param("_method_", Constants.SOCKET_SET_ADMIN)
.param("action", action) .param("action", action)
@ -644,7 +645,7 @@ public class SocketChatUtil {
.param("msgtype", 0) .param("msgtype", 0)
.param("uid", u.getId()) .param("uid", u.getId())
.param("uname", u.getUserNiceName()) .param("uname", u.getUserNiceName())
.param("ct",WordUtil.getString(R.string.red_pack_22) .param("ct",CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
); );
msg.create(); msg.create();
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() { V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {

View File

@ -22,7 +22,6 @@ import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean;
@ -258,7 +257,7 @@ public class SocketClient {
LiveChatBean liveChatBean = new LiveChatBean(); LiveChatBean liveChatBean = new LiveChatBean();
liveChatBean.setType(LiveChatBean.RED_PACK); liveChatBean.setType(LiveChatBean.RED_PACK);
liveChatBean.setId(uid); liveChatBean.setId(uid);
String name = uid.equals(mLiveUid) ?WordUtil.getString(R.string.live_anchor) : map.getString("uname"); String name = uid.equals(mLiveUid) ?CommonAppContext.sInstance.getBaseContext().getString(R.string.live_anchor) : map.getString("uname");
liveChatBean.setContent(name + map.getString("ct")); liveChatBean.setContent(name + map.getString("ct"));
mListener.onRedPack(liveChatBean); mListener.onRedPack(liveChatBean);
break; break;
@ -489,7 +488,7 @@ public class SocketClient {
u.setDress(dressBean); u.setDress(dressBean);
chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN); chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN);
chatBean.setContent(WordUtil.getString(R.string.live_enter_room)); chatBean.setContent(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_enter_room));
chatBean.setGuardType(obj.getIntValue("guard_type")); chatBean.setGuardType(obj.getIntValue("guard_type"));
//增加粉丝徽章信息 //增加粉丝徽章信息
chatBean.setMedalNmae(obj.getString("medal_name")); chatBean.setMedalNmae(obj.getString("medal_name"));
@ -545,9 +544,9 @@ public class SocketClient {
//聊天列表显示 玩家名 1 礼物名 //聊天列表显示 玩家名 1 礼物名
if (CommonAppContext.lang.equals("chinese")) { if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); chatBean.setContent(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else { } else {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); chatBean.setContent(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
} }
@ -612,9 +611,9 @@ public class SocketClient {
chatBean.setGuardType(map.getInteger("guard_type")); chatBean.setGuardType(map.getInteger("guard_type"));
} }
if (CommonAppContext.lang.equals("chinese")) { if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); chatBean.setContent(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else { } else {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); chatBean.setContent(CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
} }
//增加粉丝徽章信息 //增加粉丝徽章信息

View File

@ -11,7 +11,6 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
@ -165,7 +164,7 @@ public class SocketRyChatUtil {
.param("medal_name", u.getMedalName()) .param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel()) .param("medal_level", u.getMedalLevel())
.param("good_num", u.getGoodnum()) .param("good_num", u.getGoodnum())
.param("ct",WordUtil.getString(R.string.live_lighted)); .param("ct",CommonAppContext.sInstance.getBaseContext().getString(R.string.live_lighted));
msg.create(); msg.create();
String targetId = "g" + mLiveUid; String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@ -356,7 +355,7 @@ public class SocketRyChatUtil {
.param("uid", u.getId()) .param("uid", u.getId())
.param("touid", toUid) .param("touid", toUid)
.param("toname", toName) .param("toname", toName)
.param("ct", toName +WordUtil.getString(R.string.live_kicked)); .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(R.string.live_kicked));
msg.create(); msg.create();
String targetId = "g" + mLiveUid; String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@ -403,7 +402,7 @@ public class SocketRyChatUtil {
.param("uid", u.getId()) .param("uid", u.getId())
.param("touid", toUid) .param("touid", toUid)
.param("toname", toName) .param("toname", toName)
.param("ct", toName +WordUtil.getString(type == 0 ? R.string.live_shut : R.string.live_shut_2)); .param("ct", toName +CommonAppContext.sInstance.getBaseContext().getString(type == 0 ? R.string.live_shut : R.string.live_shut_2));
msg.create(); msg.create();
String targetId = "g" + mLiveUid; String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
@ -440,7 +439,7 @@ public class SocketRyChatUtil {
if (u == null) { if (u == null) {
return; return;
} }
String s = action == 1 ?WordUtil.getString(R.string.live_set_admin) :WordUtil.getString(R.string.live_set_admin_cancel); String s = action == 1 ?CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin) :CommonAppContext.sInstance.getBaseContext().getString(R.string.live_set_admin_cancel);
final SocketSendBean msg = new SocketSendBean() final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SET_ADMIN) .param("_method_", Constants.SOCKET_SET_ADMIN)
.param("action", action) .param("action", action)
@ -710,7 +709,7 @@ public class SocketRyChatUtil {
.param("msgtype", 0) .param("msgtype", 0)
.param("uid", u.getId()) .param("uid", u.getId())
.param("uname", u.getUserNiceName()) .param("uname", u.getUserNiceName())
.param("ct",WordUtil.getString(R.string.red_pack_22) .param("ct",CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
); );
msg.create(); msg.create();
String targetId = "g" + mLiveUid; String targetId = "g" + mLiveUid;

View File

@ -6,6 +6,8 @@ import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
import android.app.Activity;
import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.text.TextUtils; import android.text.TextUtils;
@ -38,7 +40,6 @@ import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -71,15 +72,16 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
public class SocketRyClient { public class SocketRyClient {
private static final String TAG = "socket"; private final String TAG = "socket";
private String mLiveUid; private String mLiveUid;
private String mStream; private String mStream;
public static SocketRyClient.SocketHandler mSocketHandler; public static SocketRyClient.SocketHandler mSocketHandler;
private Context mContext;
public SocketRyClient(String mLiveUid, SocketMessageListener listener) { public SocketRyClient(String mLiveUid, SocketMessageListener listener, Activity mContext) {
this.mContext = mContext;
mSocketHandler = new SocketRyClient.SocketHandler(listener); mSocketHandler = new SocketRyClient.SocketHandler(listener);
mSocketHandler.setLiveUid(mLiveUid); mSocketHandler.setLiveUid(mLiveUid);
RongChatRoomClient.getInstance().joinChatRoom("g" + mLiveUid, -1, new IRongCoreCallback.OperationCallback() { RongChatRoomClient.getInstance().joinChatRoom("g" + mLiveUid, -1, new IRongCoreCallback.OperationCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
@ -109,11 +111,11 @@ public class SocketRyClient {
mSocketHandler = null; mSocketHandler = null;
} }
public static class SocketHandler extends Handler { public class SocketHandler extends Handler {
private static SocketMessageListener mListener; private SocketMessageListener mListener;
private LivePushRyViewHolder livePushRyViewHolder; private LivePushRyViewHolder livePushRyViewHolder;
private static String mLiveUid; private String mLiveUid;
public SocketHandler(SocketMessageListener listener) { public SocketHandler(SocketMessageListener listener) {
mListener = new WeakReference<>(listener).get(); mListener = new WeakReference<>(listener).get();
@ -428,7 +430,7 @@ public class SocketRyClient {
LiveChatBean liveChatBean = new LiveChatBean(); LiveChatBean liveChatBean = new LiveChatBean();
liveChatBean.setType(LiveChatBean.RED_PACK); liveChatBean.setType(LiveChatBean.RED_PACK);
liveChatBean.setId(uid); liveChatBean.setId(uid);
String name = uid.equals(mLiveUid) ?WordUtil.getString(R.string.live_anchor) : map.getString("uname"); String name = uid.equals(mLiveUid) ? mContext.getString(R.string.live_anchor) : map.getString("uname");
liveChatBean.setContent(name + map.getString("ct")); liveChatBean.setContent(name + map.getString("ct"));
mListener.onRedPack(liveChatBean); mListener.onRedPack(liveChatBean);
break; break;
@ -623,7 +625,7 @@ public class SocketRyClient {
} }
} }
private static void buyGuardInSameRoom(JSONObject map) { private void buyGuardInSameRoom(JSONObject map) {
LiveBuyGuardMsgBean buyGuardMsgBean = new LiveBuyGuardMsgBean(); LiveBuyGuardMsgBean buyGuardMsgBean = new LiveBuyGuardMsgBean();
buyGuardMsgBean.setUid(map.getString("uid")); buyGuardMsgBean.setUid(map.getString("uid"));
buyGuardMsgBean.setUserName(map.getString("ct")); buyGuardMsgBean.setUserName(map.getString("ct"));
@ -633,7 +635,7 @@ public class SocketRyClient {
mListener.onBuyGuard(buyGuardMsgBean); mListener.onBuyGuard(buyGuardMsgBean);
} }
private static void buyGuardByNotify(JSONObject map) { private void buyGuardByNotify(JSONObject map) {
if (mLiveUid.equals(map.getString("liveuid"))) { if (mLiveUid.equals(map.getString("liveuid"))) {
buyGuardInSameRoom(map); buyGuardInSameRoom(map);
//同一直播间玩家自己开通也能看到全服通知 //同一直播间玩家自己开通也能看到全服通知
@ -666,7 +668,7 @@ public class SocketRyClient {
} }
private static void buyZuoJiByNotify(JSONObject map) { private void buyZuoJiByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nickname")); receiveGiftBean.setUserNiceName(map.getString("nickname"));
receiveGiftBean.setCarName(map.getString("carname")); receiveGiftBean.setCarName(map.getString("carname"));
@ -675,7 +677,7 @@ public class SocketRyClient {
} }
private static void buyLiangNameByNotify(JSONObject map) { private void buyLiangNameByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nickname")); receiveGiftBean.setUserNiceName(map.getString("nickname"));
receiveGiftBean.setLiangName(map.getString("liangname")); receiveGiftBean.setLiangName(map.getString("liangname"));
@ -683,7 +685,7 @@ public class SocketRyClient {
mListener.onBuyLiangName(receiveGiftBean); mListener.onBuyLiangName(receiveGiftBean);
} }
private static void buyVipByNotify(JSONObject map) { private void buyVipByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nicename")); receiveGiftBean.setUserNiceName(map.getString("nicename"));
receiveGiftBean.setVipName(map.getString("ct")); receiveGiftBean.setVipName(map.getString("ct"));
@ -707,7 +709,7 @@ public class SocketRyClient {
mListener.onBuyVip(receiveGiftBean); mListener.onBuyVip(receiveGiftBean);
} }
private static void sendActiveMsg(JSONObject map, SocketReceiveBean received) { private void sendActiveMsg(JSONObject map, SocketReceiveBean received) {
String msgtype = map.getString("msgtype"); String msgtype = map.getString("msgtype");
if ("1".equals(msgtype)) {//新年大作战活动 if ("1".equals(msgtype)) {//新年大作战活动
LiveChatBean chatBean = new LiveChatBean(); LiveChatBean chatBean = new LiveChatBean();
@ -720,7 +722,7 @@ public class SocketRyClient {
} }
} }
private static void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) { private void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) {
String msgtype = map.getString("msgtype"); String msgtype = map.getString("msgtype");
if ("2".equals(msgtype)) {//发言点亮 if ("2".equals(msgtype)) {//发言点亮
if ("409002".equals(received.getRetcode())) { if ("409002".equals(received.getRetcode())) {
@ -814,7 +816,7 @@ public class SocketRyClient {
u.setDress(dressBean); u.setDress(dressBean);
chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN); chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN);
chatBean.setContent(WordUtil.getString(R.string.live_enter_room)); chatBean.setContent(mContext.getString(R.string.live_enter_room));
chatBean.setGuardType(obj.getIntValue("guard_type")); chatBean.setGuardType(obj.getIntValue("guard_type"));
chatBean.setNobleId(obj.getString("noble_id"));//貴族ID chatBean.setNobleId(obj.getString("noble_id"));//貴族ID
chatBean.setStartColor(obj.getString("startColor"));//昵称开始颜色 chatBean.setStartColor(obj.getString("startColor"));//昵称开始颜色
@ -833,7 +835,7 @@ public class SocketRyClient {
} }
//送礼物 全服通知 //送礼物 全服通知
private static void sendGiftByNotify(JSONObject map) { private void sendGiftByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class); LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class);
receiveGiftBean.setAvatar(map.getString("uhead")); receiveGiftBean.setAvatar(map.getString("uhead"));
receiveGiftBean.setUserNiceName(map.getString("uname")); receiveGiftBean.setUserNiceName(map.getString("uname"));
@ -864,9 +866,9 @@ public class SocketRyClient {
//聊天列表显示 玩家名 1 礼物名 //聊天列表显示 玩家名 1 礼物名
if (CommonAppContext.lang.equals("chinese")) { if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else { } else {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
} }
receiveGiftBean.setLiveChatBean(chatBean); receiveGiftBean.setLiveChatBean(chatBean);
@ -898,7 +900,7 @@ public class SocketRyClient {
} }
} }
private static void xydComplete(JSONObject map) { private void xydComplete(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setAvatar(map.getString("uhead") + ""); receiveGiftBean.setAvatar(map.getString("uhead") + "");
receiveGiftBean.setUserNiceName(map.getString("uname")); receiveGiftBean.setUserNiceName(map.getString("uname"));
@ -927,16 +929,16 @@ public class SocketRyClient {
chatBean.setGuardType(map.getInteger("guard_type")); chatBean.setGuardType(map.getInteger("guard_type"));
} }
if (CommonAppContext.lang.equals("chinese")) { if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else { } else {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
} }
mListener.onSendGift(receiveGiftBean); mListener.onSendGift(receiveGiftBean);
} }
// 玩家自己送礼物 // 玩家自己送礼物
private static void sendGiftInSameRoom(JSONObject map) { private void sendGiftInSameRoom(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class); LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class);
receiveGiftBean.setAvatar(map.getString("uhead") + ""); receiveGiftBean.setAvatar(map.getString("uhead") + "");
receiveGiftBean.setUserNiceName(map.getString("uname")); receiveGiftBean.setUserNiceName(map.getString("uname"));
@ -967,9 +969,9 @@ public class SocketRyClient {
chatBean.setGuardType(map.getInteger("guard_type")); chatBean.setGuardType(map.getInteger("guard_type"));
} }
if (CommonAppContext.lang.equals("chinese")) { if (CommonAppContext.lang.equals("chinese")) {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
} else { } else {
chatBean.setContent(WordUtil.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " +WordUtil.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen()); chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
} }
//增加粉丝徽章信息 //增加粉丝徽章信息
@ -1012,7 +1014,7 @@ public class SocketRyClient {
/** /**
* 接收到系统消息显示在聊天栏中 * 接收到系统消息显示在聊天栏中
*/ */
private static void systemChatMessage(String content) { private void systemChatMessage(String content) {
LiveChatBean bean = new LiveChatBean(); LiveChatBean bean = new LiveChatBean();
bean.setContent(content); bean.setContent(content);
bean.setType(LiveChatBean.SYSTEM); bean.setType(LiveChatBean.SYSTEM);
@ -1022,7 +1024,7 @@ public class SocketRyClient {
/** /**
* 接收到系统消息显示在聊天栏中 * 接收到系统消息显示在聊天栏中
*/ */
private static void systemChatMessage2(String content) { private void systemChatMessage2(String content) {
LiveChatBean bean = new LiveChatBean(); LiveChatBean bean = new LiveChatBean();
bean.setContent(content); bean.setContent(content);
bean.setType(LiveChatBean.SYSTEM2); bean.setType(LiveChatBean.SYSTEM2);
@ -1032,7 +1034,7 @@ public class SocketRyClient {
/** /**
* 处理观众与主播连麦逻辑 * 处理观众与主播连麦逻辑
*/ */
private static void processLinkMic(JSONObject map) { private void processLinkMic(JSONObject map) {
int action = map.getIntValue("action"); int action = map.getIntValue("action");
switch (action) { switch (action) {
case 1://主播收到观众连麦的申请 case 1://主播收到观众连麦的申请
@ -1087,7 +1089,7 @@ public class SocketRyClient {
* *
* @param map * @param map
*/ */
private static void processLinkMicAnchor(JSONObject map) { private void processLinkMicAnchor(JSONObject map) {
int action = map.getIntValue("action"); int action = map.getIntValue("action");
switch (action) { switch (action) {
case 1://收到其他主播连麦的邀请的回调 case 1://收到其他主播连麦的邀请的回调
@ -1126,7 +1128,7 @@ public class SocketRyClient {
* *
* @param map * @param map
*/ */
private static void processAnchorLinkMicPk(JSONObject map) { private void processAnchorLinkMicPk(JSONObject map) {
int action = map.getIntValue("action"); int action = map.getIntValue("action");
Log.i("Socket", "action = " + action + " json = " + map.toString()); Log.i("Socket", "action = " + action + " json = " + map.toString());

View File

@ -43,7 +43,6 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.manager.NewLevelManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
@ -147,7 +146,7 @@ public class LiveTextRender {
* 幸运天使 * 幸运天使
*/ */
public void luckyAngel(Context mContext, TextView mTextView, MsgModel msgModel) { public void luckyAngel(Context mContext, TextView mTextView, MsgModel msgModel) {
String msg = WordUtil.getString(R.string.lucky_angel); String msg = mContext.getString(R.string.lucky_angel);
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName()); msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
int unameIndexOf = msg.indexOf(msgModel.getUserName()); int unameIndexOf = msg.indexOf(msgModel.getUserName());
int giftIndexOf = msg.indexOf(msgModel.getGiftName()); int giftIndexOf = msg.indexOf(msgModel.getGiftName());
@ -164,7 +163,7 @@ public class LiveTextRender {
* 幸运100%活动 * 幸运100%活动
*/ */
public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel) { public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel) {
String msg = WordUtil.getString(R.string.lucky_100); String msg = mContext.getString(R.string.lucky_100);
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName()); msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
int unameIndexOf = msg.indexOf(msgModel.getUserName()); int unameIndexOf = msg.indexOf(msgModel.getUserName());
int giftIndexOf = msg.indexOf(msgModel.getGiftName()); int giftIndexOf = msg.indexOf(msgModel.getGiftName());
@ -553,7 +552,7 @@ public class LiveTextRender {
if (textView != null) { if (textView != null) {
getLiveLevelImage(context, bean.getLevel(), false,new ImgLoader.DrawableCallback() { getLiveLevelImage(context, bean.getLevel(), false, new ImgLoader.DrawableCallback() {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
SpannableStringBuilder builder = createPrefix(drawable, bean); SpannableStringBuilder builder = createPrefix(drawable, bean);
@ -774,7 +773,7 @@ public class LiveTextRender {
public SpannableStringBuilder renderGiftInfo2(String giftName) { public SpannableStringBuilder renderGiftInfo2(String giftName) {
SpannableStringBuilder builder = new SpannableStringBuilder(); SpannableStringBuilder builder = new SpannableStringBuilder();
String s1 =WordUtil.getString(R.string.live_send_gift_1); String s1 = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1);
String content = s1 + " " + giftName; String content = s1 + " " + giftName;
int index1 = s1.length(); int index1 = s1.length();
builder.append(content); builder.append(content);
@ -784,8 +783,8 @@ public class LiveTextRender {
public SpannableStringBuilder renderGiftInfo(int giftCount, String giftName) { public SpannableStringBuilder renderGiftInfo(int giftCount, String giftName) {
SpannableStringBuilder builder = new SpannableStringBuilder(); SpannableStringBuilder builder = new SpannableStringBuilder();
String s1 =WordUtil.getString(R.string.live_send_gift_1); String s1 = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1);
String s2 =WordUtil.getString(R.string.live_send_gift_2) + giftName; String s2 = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + giftName;
String content = s1 + giftCount + s2; String content = s1 + giftCount + s2;
int index1 = s1.length(); int index1 = s1.length();
int index2 = index1 + String.valueOf(giftCount).length(); int index2 = index1 + String.valueOf(giftCount).length();
@ -823,7 +822,7 @@ public class LiveTextRender {
} }
SpannableStringBuilder builder = new SpannableStringBuilder(); SpannableStringBuilder builder = new SpannableStringBuilder();
//有时在想海外项目的时候这个""怎么翻译而且英语中也没有""这个单位啊 //有时在想海外项目的时候这个""怎么翻译而且英语中也没有""这个单位啊
String wan = " " +WordUtil.getString(R.string.num_wan); String wan = " " + CommonAppContext.sInstance.getBaseContext().getString(R.string.num_wan);
String s = StringUtil.toWan2(num) + wan; String s = StringUtil.toWan2(num) + wan;
builder.append(s); builder.append(s);
int index2 = s.length(); int index2 = s.length();

View File

@ -59,7 +59,6 @@ import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RandomUtil;
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.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -360,7 +359,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.clearChat(); mLiveRoomViewHolder.clearChat();
mLiveRoomViewHolder.releaseGift(); mLiveRoomViewHolder.releaseGift();
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext);
if (mLiveLinkMicPresenter != null) { if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient); mLiveLinkMicPresenter.setSocketClient(mSocketClient);
} }
@ -1781,7 +1780,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} else { } else {
if (code == 1008) {//余额不足 if (code == 1008) {//余额不足
mCoinNotEnough = true; mCoinNotEnough = true;
DialogUitl.showSimpleDialog(mContext,mContext.getString(R.string.live_coin_not_enough), false, DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.live_coin_not_enough), false,
new DialogUitl.SimpleCallback2() { new DialogUitl.SimpleCallback2() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {

View File

@ -5,6 +5,7 @@ import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.video.R; import com.yunbao.video.R;
@ -18,7 +19,7 @@ import java.util.List;
public class VideoCommentBean implements Parcelable { public class VideoCommentBean implements Parcelable {
private static final String REPLY =WordUtil.getString(R.string.video_comment_reply) + " "; private static final String REPLY = CommonAppContext.sInstance.getBaseContext().getString(R.string.video_comment_reply) + " ";
private String mId; private String mId;
private String mUid; private String mUid;