add[声望升级-AB面]

This commit is contained in:
Martin 2024-05-18 18:27:38 +08:00
parent 6a4ac35203
commit 0b218157d2
12 changed files with 1052 additions and 115 deletions

View File

@ -50,6 +50,7 @@ import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.live.socket.SocketReceiveBean; import com.yunbao.live.socket.SocketReceiveBean;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient; import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager; import com.yunbao.live.views.PortraitLiveManager;
@ -198,7 +199,7 @@ public class AppContext extends CommonAppContext {
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() { RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
@Override @Override
public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) { public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) {
Log.e("wewe", message.getConversationType() + "112121"); Log.e("wewe", message.getConversationType() + "112121 "+message.getContent());
MessageIMManager.get(sInstance).getSystemForRongcloud(message); MessageIMManager.get(sInstance).getSystemForRongcloud(message);
//融云直播间聊天 //融云直播间聊天
Message msg = Message.obtain(); Message msg = Message.obtain();
@ -209,6 +210,25 @@ public class AppContext extends CommonAppContext {
if (content.getContent().contains("_method_")) { if (content.getContent().contains("_method_")) {
msg.obj = content.getContent(); msg.obj = content.getContent();
//观众页面 //观众页面
if(SocketRyClient.mSocketHandler!=null){
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketRyClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
JSONObject map = received.getMsg().getJSONObject(0);
sendStartAnchorLive(map);
} else if (message.getTargetId().contains("v")) {
String contentJson = ((TextMessage) message.getContent()).getContent();
Log.e("wewe", contentJson);
SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class);
Bus.get().post(sudGameSocketImEvent);
}
//主播页面
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.sendMessage(msg);
}
}
if(SocketSwClient.mSocketHandler!=null){
if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) { if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketSwClient.mSocketHandler.sendMessage(msg); SocketSwClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知 } else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
@ -225,7 +245,7 @@ public class AppContext extends CommonAppContext {
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) { if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.sendMessage(msg); SocketSwClient.mSocketHandler.sendMessage(msg);
} }
}
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
} }

View File

@ -88,6 +88,7 @@ import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener; import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwChatUtil;
import com.yunbao.live.socket.SocketSwClient; import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.utils.LoadDian9TuUtil; import com.yunbao.live.utils.LoadDian9TuUtil;
import com.yunbao.live.views.AbsLiveViewHolder; import com.yunbao.live.views.AbsLiveViewHolder;
@ -166,7 +167,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>(); protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
protected LiveMicAnchorDialogFragment.OnMicListener micListener = null; protected LiveMicAnchorDialogFragment.OnMicListener micListener = null;
public boolean isSw; public static boolean isSw;
@Override @Override
protected void main() { protected void main() {
@ -241,13 +242,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
// if (isRy == false) { // if (isRy == false) {
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); // SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// } else { // } else {
if(isSw){
SocketSwChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
}else{
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
}
// } // }
} }
// if (isRy == false) { // if (isRy == false) {
// SocketChatUtil.getFakeFans(mLiveUid); // SocketChatUtil.getFakeFans(mLiveUid);
// } else { // } else {
if(isSw){
SocketSwChatUtil.getFakeFans(mLiveUid);
}else{
SocketRyChatUtil.getFakeFans(mLiveUid); SocketRyChatUtil.getFakeFans(mLiveUid);
}
// } // }
} }
} }
@ -1004,7 +1014,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
onCoinChanged(coin); onCoinChanged(coin);
} }
String[] data = new String[]{obj.getString("barragetoken")}; String[] data = new String[]{obj.getString("barragetoken")};
if(isSw){
SocketSwChatUtil.sendDanmuMessage(mLiveUid, contents, obj.getIntValue("level_fans"));
}else{
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents, obj.getIntValue("level_fans")); SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents, obj.getIntValue("level_fans"));
}
} else if (code == 1001) { } else if (code == 1001) {
DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() {
@Override @Override
@ -1038,16 +1052,45 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
} }
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if(isSw){
SocketSwChatUtil.sendChatMessage(mLiveUid, content, IMLoginManager.get(mContext).getUserInfo().anchorUserType(), mSocketUserType, guardType, atUserID, atUserName);
}else{
SocketRyChatUtil.sendChatMessage(mLiveUid, content, IMLoginManager.get(mContext).getUserInfo().anchorUserType(), mSocketUserType, guardType, atUserID, atUserName); SocketRyChatUtil.sendChatMessage(mLiveUid, content, IMLoginManager.get(mContext).getUserInfo().anchorUserType(), mSocketUserType, guardType, atUserID, atUserName);
}
}
/**
* 系统 消息 融云
*/
public static void sendSystemMessageSw(String content) {
if(isSw){
SocketSwChatUtil.sendSystemMessage(mLiveUid, content);
}else{
SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
}
}
/**
* 系统 消息 声网
*/
public static void sendSystemMessageRy(String content) {
if(isSw){
SocketSwChatUtil.sendSystemMessage(mLiveUid, content);
}else{
SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
}
} }
/** /**
* 系统 消息 * 系统 消息
*/ */
public static void sendSystemMessage(String content) { public void sendSystemMessage(String content) {
if(isSw){
SocketSwChatUtil.sendSystemMessage(mLiveUid, content);
}else{
SocketRyChatUtil.sendSystemMessage(mLiveUid, content); SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
} }
}
/** /**
@ -1055,7 +1098,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) { public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) {
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if(isSw){
SocketSwChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
}else{
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by); SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
}
} }
@ -1063,65 +1110,104 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 主播或管理员踢人 * 主播或管理员踢人
*/ */
public void kickUser(String toUid, String toName) { public void kickUser(String toUid, String toName) {
if(isSw){
SocketSwChatUtil.sendKickMessage(mLiveUid, toUid, toName);
}else{
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName); SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
} }
}
/** /**
* 禁言 * 禁言
*/ */
public void setShutUp(String toUid, String toName, int type) { public void setShutUp(String toUid, String toName, int type) {
if(isSw){
SocketSwChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
}else{
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type); SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
} }
}
/** /**
* 期限禁言 * 期限禁言
*/ */
public void setShutUp(String toUid, String toName, int type, int time) { public void setShutUp(String toUid, String toName, int type, int time) {
if(isSw){
SocketSwChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type, time);
}else{
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type, time); SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type, time);
} }
}
/** /**
* 设置或取消管理员消息 * 设置或取消管理员消息
*/ */
public void sendSetAdminMessage(int action, String toUid, String toName) { public void sendSetAdminMessage(int action, String toUid, String toName) {
if(isSw){
SocketSwChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
}else{
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName); SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
} }
}
/** /**
* 超管关闭直播间 * 超管关闭直播间
*/ */
public void superCloseRoom() { public void superCloseRoom() {
if(isSw){
SocketSwChatUtil.superCloseRoom(mLiveUid);
}else{
SocketRyChatUtil.superCloseRoom(mLiveUid); SocketRyChatUtil.superCloseRoom(mLiveUid);
} }
}
/** /**
* 更新主播映票数 * 更新主播映票数
*/ */
public void sendUpdateVotesMessage(int deltaVal) { public void sendUpdateVotesMessage(int deltaVal) {
if(isSw){
SocketSwChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
}else{
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal); SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
} }
}
/** /**
* 发送购买守护成功消息 * 发送购买守护成功消息
*/ */
public void sendBuyGuardMessage(String votes, int guardNum, int guardType) { public void sendBuyGuardMessage(String votes, int guardNum, int guardType) {
if(isSw){
SocketSwChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
}else{
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType); SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
} }
}
public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) { public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) {
if (guardType != 1) { if (guardType != 1) {
if(isSw){
SocketSwChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
}else{
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId); SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
} }
} }
}
/** /**
* 发送发红包成功消息 * 发送发红包成功消息
*/ */
public void sendRedPackMessage() { public void sendRedPackMessage() {
if(isSw){
SocketSwChatUtil.sendRedPackMessage(mLiveUid);
}else{
SocketRyChatUtil.sendRedPackMessage(mLiveUid); SocketRyChatUtil.sendRedPackMessage(mLiveUid);
} }
}
/** /**
@ -1707,7 +1793,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
micListener = fragment.getMicListener(); micListener = fragment.getMicListener();
fragment.setMicQueueList(mMicQueueList); fragment.setMicQueueList(mMicQueueList);
fragment.setAudienceList(mAudienceList); fragment.setAudienceList(mAudienceList);
if(isSw){
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment"); fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
}else{
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
}
} }
/** /**

View File

@ -471,7 +471,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
} }
mLiveReadyViewHolder = null; mLiveReadyViewHolder = null;
if (mLiveRoomViewHolder == null) { if (mLiveRoomViewHolder == null) {
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager(),false);
mLiveRoomViewHolder.addToParent(); mLiveRoomViewHolder.addToParent();
mLiveRoomViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder.subscribeActivityLifeCycle();
mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000); mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000);

View File

@ -104,10 +104,8 @@ import com.yunbao.live.music.LiveMusicDialogFragment;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LiveMusicViewHolder; import com.yunbao.live.views.LiveMusicViewHolder;
@ -554,7 +552,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(BitmapUtil.getInstance().convertMirror(resource), rect); boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(BitmapUtil.getInstance().convertMirror(resource), rect);
sendSystemMessage(mContext.getString(R.string.live_anchor_leave)); sendSystemMessageRy(mContext.getString(R.string.live_anchor_leave));
} }
@Override @Override
@ -567,7 +565,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
leave_img.setVisibility(View.GONE); leave_img.setVisibility(View.GONE);
// 清除水印 // 清除水印
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect); boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect);
sendSystemMessage(mContext.getString(R.string.live_anchor_come_back)); sendSystemMessageRy(mContext.getString(R.string.live_anchor_come_back));
} }
HttpClient.getInstance().get("Live.isLeave", "Live.isLeave") HttpClient.getInstance().get("Live.isLeave", "Live.isLeave")
@ -788,7 +786,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
mLiveReadyViewHolder = null; mLiveReadyViewHolder = null;
if (mLiveRoomViewHolder == null) { if (mLiveRoomViewHolder == null) {
mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager(),isSw);
mLiveRoomViewHolder.setManager(manager); mLiveRoomViewHolder.setManager(manager);
mLiveRoomViewHolder.addToParent(); mLiveRoomViewHolder.addToParent();
mLiveRoomViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder.subscribeActivityLifeCycle();
@ -974,7 +972,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
JSONObject datas = obj.getJSONObject("data"); JSONObject datas = obj.getJSONObject("data");
try { try {
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketSwClient); SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -1060,8 +1058,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLivePushViewHolder = null; mLivePushViewHolder = null;
mLiveLinkMicPresenter = null; mLiveLinkMicPresenter = null;
//断开socket //断开socket
if (mSocketSwClient != null) { if (mSocketRyClient != null) {
mSocketSwClient.disConnect(); mSocketRyClient.disConnect();
} }
super.release(); super.release();
} }
@ -1891,8 +1889,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }

View File

@ -101,7 +101,7 @@ import com.yunbao.live.music.LiveMusicDialogFragment;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter; import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketSwChatUtil;
import com.yunbao.live.socket.SocketSwClient; import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
@ -536,7 +536,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(BitmapUtil.getInstance().convertMirror(resource), rect); boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(BitmapUtil.getInstance().convertMirror(resource), rect);
sendSystemMessage(mContext.getString(R.string.live_anchor_leave)); sendSystemMessageSw(mContext.getString(R.string.live_anchor_leave));
} }
@Override @Override
@ -549,7 +549,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
leave_img.setVisibility(View.GONE); leave_img.setVisibility(View.GONE);
// 清除水印 // 清除水印
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect); boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect);
sendSystemMessage(mContext.getString(R.string.live_anchor_come_back)); sendSystemMessageSw(mContext.getString(R.string.live_anchor_come_back));
} }
HttpClient.getInstance().get("Live.isLeave", "Live.isLeave") HttpClient.getInstance().get("Live.isLeave", "Live.isLeave")
@ -770,7 +770,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
mLiveReadyViewHolder = null; mLiveReadyViewHolder = null;
if (mLiveRoomViewHolder == null) { if (mLiveRoomViewHolder == null) {
mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager(),isSw);
mLiveRoomViewHolder.setManager(manager); mLiveRoomViewHolder.setManager(manager);
mLiveRoomViewHolder.addToParent(); mLiveRoomViewHolder.addToParent();
mLiveRoomViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder.subscribeActivityLifeCycle();
@ -956,7 +956,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
JSONObject datas = obj.getJSONObject("data"); JSONObject datas = obj.getJSONObject("data");
try { try {
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketSwClient); SocketSwChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -47,6 +47,8 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.bean.ImpressBean; import com.yunbao.live.bean.ImpressBean;
import com.yunbao.live.custom.MyTextView; import com.yunbao.live.custom.MyTextView;
import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LiveTextRender;
@ -551,8 +553,7 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View
mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable);
} }
if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播
((LiveActivity) mContext).sendSystemMessage( ((LiveActivity) mContext).sendSystemMessage(CommonAppConfig.getInstance().getUserBean().getUserNiceName() + mContext.getString(R.string.live_follow_anchor));
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + mContext.getString(R.string.live_follow_anchor));
} }
} }
}; };

View File

@ -34,7 +34,7 @@ import io.rong.message.TextMessage;
public class SocketRyChatUtil { public class SocketRyChatUtil {
//关闭直播 //关闭直播
public static void closeLive(final String votes, final String length, final String nums, final String mLiveUid, SocketSwClient client) { public static void closeLive(final String votes, final String length, final String nums, final String mLiveUid) {
UserBean u = CommonAppConfig.getInstance().getUserBean(); UserBean u = CommonAppConfig.getInstance().getUserBean();
final SocketSendBean msg = new SocketSendBean() final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_LIVE_END) .param("_method_", Constants.SOCKET_LIVE_END)
@ -64,8 +64,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) if (SocketRyClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
@Override @Override
@ -128,8 +128,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
LiveNetManager.get(CommonAppContext.sInstance) LiveNetManager.get(CommonAppContext.sInstance)
.addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() { .addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@ -214,8 +214,8 @@ public class SocketRyChatUtil {
} }
} }
}); });
if (SocketSwClient.mSocketHandler != null) if (SocketRyClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
@Override @Override
@ -263,8 +263,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -400,8 +400,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -470,8 +470,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -517,8 +517,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -554,8 +554,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -597,8 +597,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) if (SocketRyClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
@Override @Override
@ -634,8 +634,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -674,8 +674,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }
@ -778,8 +778,8 @@ public class SocketRyChatUtil {
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
Log.i("tx", "发送成功"); Log.i("tx", "发送成功");
if (SocketSwClient.mSocketHandler != null) { if (SocketRyClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
} }
} }

View File

@ -0,0 +1,793 @@
package com.yunbao.live.socket;
import android.util.Log;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
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.activity.LiveActivity;
import org.greenrobot.eventbus.EventBus;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
/**
* Created by cxf on 2018/10/9.
* 直播间发言
*/
public class SocketSwChatUtil {
//关闭直播
public static void closeLive(final String votes, final String length, final String nums, final String mLiveUid) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_LIVE_END)
.param("action", 18)
.param("msgtype", 1)
.param("equipment", "app")
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("length", length)
.param("votes", votes)
.param("nums", nums)
.param("roomnum", u.getId())
.param("ct", "直播关闭");
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 发言
*/
public static void sendChatMessage(String mLiveUid, String content, boolean isAnchor, int userType, int guardType, String atUserID, String atUserName) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
IMLoginModel model = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo();
if (u == null) {
return;
}
final SocketSendBean msg =
new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_MSG)
.param("action", 0)
.param("msgtype", 2)
.param("usertype", userType)
.param("isAnchor", isAnchor ? 1 : 0)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("bubble", u.getDress().getBubble())
.param("medal_honor", u.getMedal_no_display_src())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("uid", u.getId())
.param("liangname", u.getGoodName())
.param("vip_type", u.getVip().getType())
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType())
.param("medal_name", u.getMedalName())
.param("medal_level", model.getMedalLevel())
.param("good_num", u.getGoodnum())
.param("ct", content)
.param("noble_id", String.valueOf(model.getNobleId()))
.param("contentColor", String.valueOf(model.getContentColor()))
.param("startColor", String.valueOf(model.getStartColor()))
.param("endColor", String.valueOf(model.getEndColor()))
.param("atUserName", String.valueOf(atUserName))
.param("atUserID", String.valueOf(atUserID));
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
LiveNetManager.get(CommonAppContext.sInstance)
.addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
}
@Override
public void onError(String error) {
}
});
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString());
if (errorCode.code == 23408) {
ToastUtil.show(WordUtil.isNewZh() ? "您已被禁言" : "You have been banned");
} else {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" + errorCode.code : "I'm sorry! An error occurred" + errorCode.code);
}
}
});
}
/**
* 点亮
*/
public static void sendLightMessage(final String mLiveUid, int heart, int guardType) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_MSG)
.param("action", 0)
.param("msgtype", 2)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("liangname", u.getGoodName())
.param("vip_type", u.getVip().getType())
.param("medal_honor", u.getMedal_no_display_src())
.param("heart", heart)
.param("bubble", u.getDress().getBubble())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType())
.param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel())
.param("good_num", u.getGoodnum())
.param("ct", WordUtil.getNewString(R.string.live_lighted));
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
LiveHttpUtil.sendZAN(mLiveUid + "", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
EventBus.getDefault().post("stop_svga_new_user_double");
}
});
LiveHttpUtil.setFrontTask("illumine", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
EventBus.getDefault().post("stop_svga_new_user_double1");
}
}
});
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 发送弹幕消息
*/
public static void sendDanmuMessage(String mLiveUid, String danmuToken) {
sendDanmuMessage(mLiveUid, danmuToken, 0);
}
public static void sendDanmuMessage(String mLiveUid, String danmuToken, int fansLevel) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_BARRAGE)
.param("action", 7)
.param("msgtype", 1)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("uhead", u.getAvatar())
.param("fansLevel", fansLevel)
.param("ct", danmuToken);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString());
if (errorCode.code == 23408) {
ToastUtil.show(WordUtil.isNewZh() ? "您已被禁言" : "You have been banned");
} else {
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
}
}
});
}
/**
* 发送礼物消息
*/
public static void sendGiftMessage(int giftType, String giftToken, String liveUid, int guard_type, String by) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_GIFT)
.param("action", 0)
.param("msgtype", 1)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("uhead", u.getAvatar())
.param("evensend", giftType)
.param("liangname", u.getGoodName())
.param("vip_type", u.getVip().getType())
.param("ct", giftToken)
.param("bubble", u.getDress().getBubble())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel())
.param("guard_type", guard_type + "")
.param("medal_honor", u.getMedal_no_display_src())
.param("good_num", u.getGoodnum())
.param("roomnum", liveUid);
msg.create();
LiveHttpUtil.sendGiftMsg(by, liveUid, msg.mResult.toString(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
Log.i("tag", "禮物im");
}
});
}
/**
* 发送礼物消息 增加主播名字
*/
public static void sendGiftMessage(int giftType, String giftToken, String liveUid, String ancherName, int guard_type, String by) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SEND_GIFT)
.param("action", 0)
.param("msgtype", 1)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("uhead", u.getAvatar())
.param("evensend", giftType)
.param("liangname", u.getGoodName())
.param("vip_type", u.getVip().getType())
.param("bubble", u.getDress().getBubble())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("ct", giftToken)
.param("ancherName", ancherName)
.param("medal_name", u.getMedalName())
.param("medal_level", u.getMedalLevel())
.param("guard_type", guard_type + "")
.param("medal_honor", u.getMedal_no_display_src())
.param("good_num", u.getGoodnum())
.param("roomnum", liveUid);
msg.create();
LiveHttpUtil.sendGiftMsg(by, liveUid, msg.mResult.toString(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
Log.i("tag", "禮物im");
}
});
}
/**
* 主播或管理员 踢人
*/
public static void sendKickMessage(String mLiveUid, String toUid, String toName) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_KICK)
.param("action", 2)
.param("msgtype", 4)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("touid", toUid)
.param("toname", toName)
.param("ct", toName + "被踢出房間(Kicked out of the room)");
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 主播或管理员 禁言
*/
public static void sendShutUpMessage(String mLiveUid, String toUid, String toName, int type) {
sendShutUpMessage(mLiveUid, toUid, toName, type, 0);
}
/**
* 主播或管理员 禁言
*
* @param time 禁言时间 1~60
*/
public static void sendShutUpMessage(String mLiveUid, String toUid, String toName, int type, int time) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
String ct = "";
switch (type) {
case 0:
ct = "被永久禁言(Forbidden forever)";
break;
case 1:
ct = "被本場禁言(Forbidden by this scene)";
break;
case 2:
ct = String.format("被禁言%s分鐘", time + "") + "(" + String.format("Forbidden by %s min", time + "") + ")";
break;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SHUT_UP)
.param("action", 1)
.param("msgtype", 4)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("touid", toUid)
.param("toname", toName)
.param("time", time)
.param("ct", toName + ct);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 设置或取消管理员消息
*/
public static void sendSetAdminMessage(String mLiveUid, int action, String toUid, String toName) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
String s = action == 1 ? "被設為管理員(Set as Administrator)" : "被取消管理員(Cancelled administrator)";
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SET_ADMIN)
.param("action", action)
.param("msgtype", 1)
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("touid", toUid)
.param("toname", toName)
.param("ct", toName + " " + s);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 超管关闭直播间
*/
public static void superCloseRoom(String mLiveUid) {
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_STOP_LIVE)
.param("action", 19)
.param("msgtype", 1)
.param("ct", "");
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 发系统消息
*/
public static void sendSystemMessage(String mLiveUid, String content) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SYSTEM)
.param("action", 13)
.param("msgtype", 4)
.param("level", u.getLevel())
.param("uname", u.getUserNiceName())
.param("uid", u.getId())
.param("ct", content);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 获取僵尸粉
*/
public static void getFakeFans(String mLiveUid) {
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_FAKE_FANS)
.param("action", "")
.param("msgtype", "");
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 更新主播映票数
*/
public static void sendUpdateVotesMessage(String mLiveUid, int votes, int first) {
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_UPDATE_VOTES)
.param("action", 1)
.param("msgtype", 26)
.param("votes", votes)
.param("uid", CommonAppConfig.getInstance().getUid())
.param("isfirst", first)
.param("ct", "");
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 更新主播映票数
*/
public static void sendUpdateVotesMessage(String mLiveUid, int votes) {
sendUpdateVotesMessage(mLiveUid, votes, 0);
}
/**
* 发送购买守护成功消息
*/
public static void sendBuyGuardMessage(String mLiveUid, String votes, int guardNum, int guardType) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_BUY_GUARD)
.param("action", 0)
.param("msgtype", 0)
.param("uid", u.getId())
.param("bubble", u.getDress().getBubble())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("uname", u.getUserNiceName())
.param("uhead", u.getAvatar())
.param("votestotal", votes)
.param("guard_nums", guardNum)
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType());
msg.create();
}
public static void sendBuyGuardMessage2(String mLiveUid, String votes, int guardNum,
int guardType, String ancherName, String liveId) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_BUY_GUARD)
.param("action", 0)
.param("msgtype", 0)
.param("uid", u.getId())
.param("uname", u.getUserNiceName())
.param("uhead", u.getAvatar())
.param("votestotal", votes)
.param("guard_nums", guardNum)
.param("ancherName", ancherName)
.param("liveuid", liveId)
.param("bubble", u.getDress().getBubble())
.param("medal", u.getDress().getMedal())
.param("medal_new", u.getDress().getMedal_new())
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType());
msg.create();
}
/**
* 发送发红包成功消息
*/
public static void sendRedPackMessage(String mLiveUid) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_RED_PACK)
.param("action", 0)
.param("msgtype", 0)
.param("uid", u.getId())
.param("uname", u.getUserNiceName())
.param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
);
msg.create();
String targetId = "g" + mLiveUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
}

View File

@ -34,7 +34,8 @@ import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveChooseClassActivity; import com.yunbao.live.activity.LiveChooseClassActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.adapter.LiveReadyShareAdapter; import com.yunbao.live.adapter.LiveReadyShareAdapter;
import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.LiveRoomTypeBean;
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment; import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
@ -123,7 +124,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
@Override @Override
public void beforeCamera() { public void beforeCamera() {
((LiveSwAnchorActivity) mContext).beforeCamera(); ((LiveRyAnchorActivity) mContext).beforeCamera();
} }
@Override @Override
@ -218,8 +219,8 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
public void openWishListWindow() { public void openWishListWindow() {
LiveWishListDialogFragment fragment = new LiveWishListDialogFragment(); LiveWishListDialogFragment fragment = new LiveWishListDialogFragment();
if (mContext instanceof LiveSwAnchorActivity){ if (mContext instanceof LiveRyAnchorActivity){
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "RY"); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
} }
} }
@ -281,14 +282,14 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 切换镜头 * 切换镜头
*/ */
private void toggleCamera() { private void toggleCamera() {
((LiveSwAnchorActivity) mContext).toggleCamera(); ((LiveRyAnchorActivity) mContext).toggleCamera();
} }
/** /**
* 关闭 * 关闭
*/ */
private void close() { private void close() {
((LiveSwAnchorActivity) mContext).endLives(); ((LiveRyAnchorActivity) mContext).endLives();
} }
/** /**
@ -309,7 +310,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 设置美颜 * 设置美颜
*/ */
private void beauty() { private void beauty() {
((LiveSwAnchorActivity) mContext).beauty(); ((LiveRyAnchorActivity) mContext).beauty();
// Intent intent = new Intent(mContext, Beauty360Activity3.class); // Intent intent = new Intent(mContext, Beauty360Activity3.class);
// mContext.startActivity(intent); // mContext.startActivity(intent);
@ -324,7 +325,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
LiveRoomTypeDialogFragment fragment = new LiveRoomTypeDialogFragment(); LiveRoomTypeDialogFragment fragment = new LiveRoomTypeDialogFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setCallback(mLiveTypeCallback); fragment.setCallback(mLiveTypeCallback);
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment"); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
} }
/** /**
@ -398,7 +399,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
mLiveTimeCoin = coin; mLiveTimeCoin = coin;
} }
}); });
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment"); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment");
} }
public void hide() { public void hide() {
@ -418,7 +419,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 点击开始直播按钮 * 点击开始直播按钮
*/ */
private void startLive() { private void startLive() {
boolean startPreview = ((LiveSwAnchorActivity) mContext).isStartPreview(); boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
// if (!startPreview) { // if (!startPreview) {
// ToastUtil.show(R.string.please_wait); // ToastUtil.show(R.string.please_wait);
// return; // return;
@ -480,7 +481,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
final CommonAppConfig appConfig = CommonAppConfig.getInstance(); final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean(); UserBean u = appConfig.getUserBean();
((LiveSwAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal); ((LiveRyAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
// //
// RongChatRoomClient.getInstance().joinChatRoom("g" + appConfig.getUid(), -1, new IRongCoreCallback.OperationCallback() { // RongChatRoomClient.getInstance().joinChatRoom("g" + appConfig.getUid(), -1, new IRongCoreCallback.OperationCallback() {
// @Override // @Override

View File

@ -148,6 +148,7 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity; import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity; import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.adapter.LiveChatAdapter; import com.yunbao.live.adapter.LiveChatAdapter;
@ -399,6 +400,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private View quick_gift_reminder; private View quick_gift_reminder;
private int guardType = 0; private int guardType = 0;
private static boolean isSw;
public LiveRoomViewHolder setGuardType(int guardType) { public LiveRoomViewHolder setGuardType(int guardType) {
this.guardType = guardType; this.guardType = guardType;
return this; return this;
@ -545,8 +548,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager,boolean isSw) {
super(context, parentView); super(context, parentView);
this.isSw =isSw;
Contexts = context; Contexts = context;
this.forAct = forActivity; this.forAct = forActivity;
// this.isRy = isRys; // this.isRy = isRys;
@ -3607,8 +3611,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void callback(Integer isAttention) { public void callback(Integer isAttention) {
if (isAttention == 1) { if (isAttention == 1) {
LiveActivity.sendSystemMessage( if(isSw){
LiveActivity.sendSystemMessageSw(
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor)); CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor));
}else{
LiveActivity.sendSystemMessageRy(
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor));
}
} }
} }
}); });
@ -3676,16 +3685,32 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (isStayRoomfive) { if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext); showFollowDialog(mNameText, mAvatarUrl, mContext);
} else { } else {
if(mContext instanceof LiveSwAnchorActivity){
LiveSwAnchorActivity.backIndex = 1; LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed(); ((LiveSwAnchorActivity) mContext).onBackPressed();
}else{
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} }
} else { } else {
if(mContext instanceof LiveSwAnchorActivity){
LiveSwAnchorActivity.backIndex = 1; LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed(); ((LiveSwAnchorActivity) mContext).onBackPressed();
}else{
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} }
} else { } else {
if(mContext instanceof LiveSwAnchorActivity){
LiveSwAnchorActivity.backIndex = 1; LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed(); ((LiveSwAnchorActivity) mContext).onBackPressed();
}else{
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} }
} }
} }

View File

@ -174,7 +174,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
if (yaoqing.size() < 3) { if (yaoqing.size() < 3) {
if (PKing == false) { if (PKing == false) {
((LiveSwAnchorActivity) mContext).openLinkMicAnchorWindow(true); ((LiveRyAnchorActivity) mContext).openLinkMicAnchorWindow(true);
} else { } else {
ToastUtil.show(WordUtil.isNewZh() ? "您已在PK中" : "You are already in the PK"); ToastUtil.show(WordUtil.isNewZh() ? "您已在PK中" : "You are already in the PK");
} }
@ -242,7 +242,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
* 关闭直播 * 关闭直播
*/ */
private void close() { private void close() {
((LiveSwAnchorActivity) mContext).closeLive(); ((LiveRyAnchorActivity) mContext).closeLive();
} }
@Override @Override
@ -258,12 +258,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
if (mBtnFunction != null) { if (mBtnFunction != null) {
mBtnFunction.setImageDrawable(mDrawable1); mBtnFunction.setImageDrawable(mDrawable1);
} }
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).showFunctionDialog();
}else{
((LiveRyAnchorActivity) mContext).showFunctionDialog(); ((LiveRyAnchorActivity) mContext).showFunctionDialog();
} }
}
/** /**
* 设置功能按钮变暗 * 设置功能按钮变暗
@ -295,7 +291,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
* 发起主播连麦pk * 发起主播连麦pk
*/ */
private void applyLinkMicPk() { private void applyLinkMicPk() {
((LiveSwAnchorActivity) mContext).applyLinkMicPk(); ((LiveRyAnchorActivity) mContext).applyLinkMicPk();
} }
public void setLinkMicEnable(boolean linkMicEnable) { public void setLinkMicEnable(boolean linkMicEnable) {

View File

@ -110,6 +110,7 @@ import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener; import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwChatUtil;
import com.yunbao.live.socket.SocketSwClient; import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
@ -393,7 +394,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
} }
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid()); mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw);
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer); mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
@ -1240,14 +1241,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mFirstConnectSocket) { if (!mFirstConnectSocket) {
mFirstConnectSocket = true; mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if(isSw){
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
}else{
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
} }
}
if(isSw){
SocketSwChatUtil.getFakeFans(mLiveBean.getUid());
}else{
SocketRyChatUtil.getFakeFans(mLiveBean.getUid()); SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
} }
} }
} }
}
@Override @Override
public void onDisConnect() { public void onDisConnect() {
@ -2117,8 +2124,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮"); MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮");
mLighted = true; mLighted = true;
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if(isSw){
SocketSwChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}else{
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType); SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.playLightAnim(); mLiveRoomViewHolder.playLightAnim();
@ -2176,9 +2186,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 更新主播映票数 * 更新主播映票数
*/ */
public void sendUpdateVotesMessage() { public void sendUpdateVotesMessage() {
if(isSw){
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}else{
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}
} }
public void onFollowEvent(FollowEvent e) { public void onFollowEvent(FollowEvent e) {