From 43deb9543508b4a4dc0f01b6a086f7fd09c5ca15 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 25 Apr 2023 15:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E9=97=AE=E9=A2=98=EF=BC=88=E8=81=8A=E5=A4=A9=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E4=B8=AD=E8=8B=B1=E6=96=87=E4=BF=AE=E6=94=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 7 +- .../live/activity/LiveRyAnchorActivity.java | 2 +- .../yunbao/live/socket/SocketChatUtil.java | 11 ++-- .../com/yunbao/live/socket/SocketClient.java | 13 ++-- .../yunbao/live/socket/SocketRyChatUtil.java | 11 ++-- .../yunbao/live/socket/SocketRyClient.java | 64 ++++++++++--------- .../com/yunbao/live/utils/LiveTextRender.java | 15 ++--- .../live/views/PortraitLiveManager.java | 5 +- .../yunbao/video/bean/VideoCommentBean.java | 3 +- 9 files changed, 66 insertions(+), 65 deletions(-) diff --git a/config.gradle b/config.gradle index 367862767..9c9963b0c 100644 --- a/config.gradle +++ b/config.gradle @@ -5,16 +5,17 @@ ext { minSdkVersion : 21, targetSdkVersion : 31, versionCode : 418, - versionName : "6.5.0" + versionName : "6.5.1" ] 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", + // txMapAppSecret : "", //百度语音识别 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 3eb811a62..968f4bc64 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -799,7 +799,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveAnchorViewHolder.startAnchorLiveTime(); } mLiveBottomViewHolder = mLiveAnchorViewHolder; - mSocketRyClient = new SocketRyClient(mLiveUid, this); + mSocketRyClient = new SocketRyClient(mLiveUid, this,mContext); mSocketRyClient.setLivePushRyViewHolder(mLivePushViewHolder); CommonAppContext.Ingroup = 1; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketChatUtil.java index c78c0d62a..1e676f041 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketChatUtil.java @@ -7,6 +7,7 @@ import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMMessage; import com.tencent.imsdk.v2.V2TIMSendCallback; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; @@ -146,7 +147,7 @@ public class SocketChatUtil { .param("medal_name", u.getMedalName()) .param("medal_level", u.getMedalLevel()) .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(); V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback() { @Override @@ -321,7 +322,7 @@ public class SocketChatUtil { .param("uid", u.getId()) .param("touid", toUid) .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(); V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback() { @Override @@ -364,7 +365,7 @@ public class SocketChatUtil { .param("uid", u.getId()) .param("touid", toUid) .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(); V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback() { @Override @@ -396,7 +397,7 @@ public class SocketChatUtil { if (u == null) { 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() .param("_method_", Constants.SOCKET_SET_ADMIN) .param("action", action) @@ -644,7 +645,7 @@ public class SocketChatUtil { .param("msgtype", 0) .param("uid", u.getId()) .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(); V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback() { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketClient.java b/live/src/main/java/com/yunbao/live/socket/SocketClient.java index d23b3e297..4d164de00 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java @@ -22,7 +22,6 @@ import com.yunbao.common.http.HttpClient; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.bean.LiveBuyGuardMsgBean; @@ -258,7 +257,7 @@ public class SocketClient { LiveChatBean liveChatBean = new LiveChatBean(); liveChatBean.setType(LiveChatBean.RED_PACK); 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")); mListener.onRedPack(liveChatBean); break; @@ -489,7 +488,7 @@ public class SocketClient { u.setDress(dressBean); 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.setMedalNmae(obj.getString("medal_name")); @@ -545,9 +544,9 @@ public class SocketClient { //聊天列表显示 玩家名 送 1 个 礼物名 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 { - 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")); } 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 { - 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()); } //增加粉丝徽章信息 diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 25a3d2635..6d1573c92 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -11,7 +11,6 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.http.LiveHttpUtil; @@ -165,7 +164,7 @@ public class SocketRyChatUtil { .param("medal_name", u.getMedalName()) .param("medal_level", u.getMedalLevel()) .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(); String targetId = "g" + mLiveUid; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; @@ -356,7 +355,7 @@ public class SocketRyChatUtil { .param("uid", u.getId()) .param("touid", toUid) .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(); String targetId = "g" + mLiveUid; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; @@ -403,7 +402,7 @@ public class SocketRyChatUtil { .param("uid", u.getId()) .param("touid", toUid) .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(); String targetId = "g" + mLiveUid; Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; @@ -440,7 +439,7 @@ public class SocketRyChatUtil { if (u == null) { 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() .param("_method_", Constants.SOCKET_SET_ADMIN) .param("action", action) @@ -710,7 +709,7 @@ public class SocketRyChatUtil { .param("msgtype", 0) .param("uid", u.getId()) .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(); String targetId = "g" + mLiveUid; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 67a9268f0..f86d0ab75 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -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.LiveRoomViewHolder.getIsHot; +import android.app.Activity; +import android.content.Context; import android.os.Handler; import android.os.Message; 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.L; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -71,15 +72,16 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient; public class SocketRyClient { - private static final String TAG = "socket"; + private final String TAG = "socket"; private String mLiveUid; 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.setLiveUid(mLiveUid); - RongChatRoomClient.getInstance().joinChatRoom("g" + mLiveUid, -1, new IRongCoreCallback.OperationCallback() { @Override public void onSuccess() { @@ -109,11 +111,11 @@ public class SocketRyClient { mSocketHandler = null; } - public static class SocketHandler extends Handler { + public class SocketHandler extends Handler { - private static SocketMessageListener mListener; + private SocketMessageListener mListener; private LivePushRyViewHolder livePushRyViewHolder; - private static String mLiveUid; + private String mLiveUid; public SocketHandler(SocketMessageListener listener) { mListener = new WeakReference<>(listener).get(); @@ -428,7 +430,7 @@ public class SocketRyClient { LiveChatBean liveChatBean = new LiveChatBean(); liveChatBean.setType(LiveChatBean.RED_PACK); 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")); mListener.onRedPack(liveChatBean); break; @@ -623,7 +625,7 @@ public class SocketRyClient { } } - private static void buyGuardInSameRoom(JSONObject map) { + private void buyGuardInSameRoom(JSONObject map) { LiveBuyGuardMsgBean buyGuardMsgBean = new LiveBuyGuardMsgBean(); buyGuardMsgBean.setUid(map.getString("uid")); buyGuardMsgBean.setUserName(map.getString("ct")); @@ -633,7 +635,7 @@ public class SocketRyClient { mListener.onBuyGuard(buyGuardMsgBean); } - private static void buyGuardByNotify(JSONObject map) { + private void buyGuardByNotify(JSONObject map) { if (mLiveUid.equals(map.getString("liveuid"))) { buyGuardInSameRoom(map); //同一直播间,玩家自己开通,也能看到全服通知 @@ -666,7 +668,7 @@ public class SocketRyClient { } - private static void buyZuoJiByNotify(JSONObject map) { + private void buyZuoJiByNotify(JSONObject map) { LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); receiveGiftBean.setUserNiceName(map.getString("nickname")); 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(); receiveGiftBean.setUserNiceName(map.getString("nickname")); receiveGiftBean.setLiangName(map.getString("liangname")); @@ -683,7 +685,7 @@ public class SocketRyClient { mListener.onBuyLiangName(receiveGiftBean); } - private static void buyVipByNotify(JSONObject map) { + private void buyVipByNotify(JSONObject map) { LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); receiveGiftBean.setUserNiceName(map.getString("nicename")); receiveGiftBean.setVipName(map.getString("ct")); @@ -707,7 +709,7 @@ public class SocketRyClient { mListener.onBuyVip(receiveGiftBean); } - private static void sendActiveMsg(JSONObject map, SocketReceiveBean received) { + private void sendActiveMsg(JSONObject map, SocketReceiveBean received) { String msgtype = map.getString("msgtype"); if ("1".equals(msgtype)) {//新年大作战活动 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"); if ("2".equals(msgtype)) {//发言,点亮 if ("409002".equals(received.getRetcode())) { @@ -814,7 +816,7 @@ public class SocketRyClient { u.setDress(dressBean); 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.setNobleId(obj.getString("noble_id"));//貴族ID 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); receiveGiftBean.setAvatar(map.getString("uhead")); receiveGiftBean.setUserNiceName(map.getString("uname")); @@ -864,9 +866,9 @@ public class SocketRyClient { //聊天列表显示 玩家名 送 1 个 礼物名 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 { - 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); @@ -898,7 +900,7 @@ public class SocketRyClient { } } - private static void xydComplete(JSONObject map) { + private void xydComplete(JSONObject map) { LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean(); receiveGiftBean.setAvatar(map.getString("uhead") + ""); receiveGiftBean.setUserNiceName(map.getString("uname")); @@ -927,16 +929,16 @@ public class SocketRyClient { chatBean.setGuardType(map.getInteger("guard_type")); } 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 { - 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); } // 玩家自己送礼物 - private static void sendGiftInSameRoom(JSONObject map) { + private void sendGiftInSameRoom(JSONObject map) { LiveReceiveGiftBean receiveGiftBean = JSON.parseObject(map.getString("ct"), LiveReceiveGiftBean.class); receiveGiftBean.setAvatar(map.getString("uhead") + ""); receiveGiftBean.setUserNiceName(map.getString("uname")); @@ -967,9 +969,9 @@ public class SocketRyClient { chatBean.setGuardType(map.getInteger("guard_type")); } 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 { - 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(); bean.setContent(content); 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(); bean.setContent(content); 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"); switch (action) { case 1://主播收到观众连麦的申请 @@ -1087,7 +1089,7 @@ public class SocketRyClient { * * @param map */ - private static void processLinkMicAnchor(JSONObject map) { + private void processLinkMicAnchor(JSONObject map) { int action = map.getIntValue("action"); switch (action) { case 1://收到其他主播连麦的邀请的回调 @@ -1126,7 +1128,7 @@ public class SocketRyClient { * * @param map */ - private static void processAnchorLinkMicPk(JSONObject map) { + private void processAnchorLinkMicPk(JSONObject map) { int action = map.getIntValue("action"); Log.i("Socket", "action = " + action + " json = " + map.toString()); diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java index 8dd1edea5..843b8a089 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -43,7 +43,6 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.StringUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.bean.LiveChatBean; @@ -147,7 +146,7 @@ public class LiveTextRender { * 幸运天使 */ 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()); int unameIndexOf = msg.indexOf(msgModel.getUserName()); int giftIndexOf = msg.indexOf(msgModel.getGiftName()); @@ -164,7 +163,7 @@ public class LiveTextRender { * 幸运100%活动 */ 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()); int unameIndexOf = msg.indexOf(msgModel.getUserName()); int giftIndexOf = msg.indexOf(msgModel.getGiftName()); @@ -553,7 +552,7 @@ public class LiveTextRender { if (textView != null) { - getLiveLevelImage(context, bean.getLevel(), false,new ImgLoader.DrawableCallback() { + getLiveLevelImage(context, bean.getLevel(), false, new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { SpannableStringBuilder builder = createPrefix(drawable, bean); @@ -774,7 +773,7 @@ public class LiveTextRender { public SpannableStringBuilder renderGiftInfo2(String giftName) { 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; int index1 = s1.length(); builder.append(content); @@ -784,8 +783,8 @@ public class LiveTextRender { public SpannableStringBuilder renderGiftInfo(int giftCount, String giftName) { SpannableStringBuilder builder = new SpannableStringBuilder(); - String s1 =WordUtil.getString(R.string.live_send_gift_1); - String s2 =WordUtil.getString(R.string.live_send_gift_2) + giftName; + String s1 = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_1); + String s2 = CommonAppContext.sInstance.getBaseContext().getString(R.string.live_send_gift_2) + giftName; String content = s1 + giftCount + s2; int index1 = s1.length(); int index2 = index1 + String.valueOf(giftCount).length(); @@ -823,7 +822,7 @@ public class LiveTextRender { } 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; builder.append(s); int index2 = s.length(); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 7b8c24976..ec5f3a44d 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -59,7 +59,6 @@ import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.live.R; @@ -360,7 +359,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.clearChat(); mLiveRoomViewHolder.releaseGift(); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); - mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); + mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext); if (mLiveLinkMicPresenter != null) { mLiveLinkMicPresenter.setSocketClient(mSocketClient); } @@ -1781,7 +1780,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } else { if (code == 1008) {//余额不足 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() { @Override public void onConfirmClick(Dialog dialog, String content) { diff --git a/video/src/main/java/com/yunbao/video/bean/VideoCommentBean.java b/video/src/main/java/com/yunbao/video/bean/VideoCommentBean.java index ce1c10d45..ca07c669e 100644 --- a/video/src/main/java/com/yunbao/video/bean/VideoCommentBean.java +++ b/video/src/main/java/com/yunbao/video/bean/VideoCommentBean.java @@ -5,6 +5,7 @@ import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; +import com.yunbao.common.CommonAppContext; import com.yunbao.common.bean.UserBean; import com.yunbao.common.utils.WordUtil; import com.yunbao.video.R; @@ -18,7 +19,7 @@ import java.util.List; 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 mUid;