fix[声望升级-修复BUG]

This commit is contained in:
Martin 2024-05-31 20:59:16 +08:00
parent efa698ebfa
commit c4d378daba
9 changed files with 1002 additions and 945 deletions

View File

@ -343,7 +343,7 @@ public class RandomPkManager {
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
//ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
}
});
}

View File

@ -165,6 +165,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
private boolean mPaused;
String mBeautySdkType;
public static int isDRPK = 0;
public static int DRPKing = 0; // 0 多人PK前 1 多人PK中 2多人PK后
public static boolean PKing = false;
public static int pk_nub;
public static int backIndex = 0;//0=未判断1=已判断
@ -405,6 +406,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
LiveSwLinkMicPkPresenter.mApplyUid = CommonAppConfig.getInstance().getUid();
btn_start_dr_pk.setVisibility(View.VISIBLE);
// dr_pk_view.setVisibility(View.VISIBLE);
L.eSw("ac2222222222222222222");
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LIVE_DRPK)
.param("action", 9)
@ -872,6 +874,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
MicUserManager.get().removeAllMicUserList();
PKing = false;
isDRPK = 0;
DRPKing = 0;
endLive();
RandomPkManager.getInstance().release();
}
@ -1345,7 +1348,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString());
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
//ToastUtil.show(errorCode.code + ":" + errorCode.msg);
}
});
} else {

View File

@ -3,6 +3,7 @@ package com.yunbao.live.presenter;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing;
import static com.yunbao.live.activity.LiveSwAnchorActivity.PKing;
import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK;
import static com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder;
@ -158,6 +159,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
private List<DrPkbean> drPkbeans = new ArrayList<>();
private JSONArray pkScores; //PK分数
public LiveSwLinkMicPkPresenter setDRInitiator(boolean DRInitiator) {
this.DRInitiator = DRInitiator;
return this;
@ -475,6 +478,98 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
}
}
if (DRPKing == 1) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
setMyDrPkDetailsView();
for (int j = 0; j < drPkbeans.size(); j++) {
if (j == 0) {
L.eSw("j == 0" + j);
//设置多人PK数据
if (detailsView2 != null) {
livePushSwViewHolder.dr2_preview.removeView(detailsView2);
}
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
imageGrade2.setTag(String.valueOf(drPkbeans.get(0).getId()));
textPkName2.setText(drPkbeans.get(0).getUser_nicename());
livePushSwViewHolder.dr2_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.GONE);
linearGrade2.setVisibility(View.GONE);
} else if (j == 1) {
L.eSw("j == 1" + j);
if (detailsView4 != null) {
livePushSwViewHolder.dr4_preview.removeView(detailsView4);
}
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
imageGrade4.setTag(String.valueOf(drPkbeans.get(1).getId()));
textPkName4.setText(drPkbeans.get(1).getUser_nicename());
livePushSwViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.GONE);
linearGrade4.setVisibility(View.GONE);
} else if (j == 2) {
L.eSw("j == 2" + j);
if (detailsView4 != null) {
livePushSwViewHolder.dr4_preview.removeView(detailsView4);
}
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
imageGrade4.setTag(String.valueOf(drPkbeans.get(2).getId()));
textPkName4.setText(drPkbeans.get(2).getUser_nicename());
livePushSwViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.GONE);
linearGrade4.setVisibility(View.GONE);
if (detailsView3 != null) {
livePushSwViewHolder.dr3_preview.removeView(detailsView3);
}
detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
imageGrade3.setTag(String.valueOf(drPkbeans.get(1).getId()));
textPkName3.setText(drPkbeans.get(1).getUser_nicename());
livePushSwViewHolder.dr3_preview.addView(detailsView3);
detailsLinearLayout3.setVisibility(View.GONE);
linearGrade3.setVisibility(View.GONE);
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
}
}
int removeUid = 0;
for (int k = 0; k < pkScores.size(); k++) {
JSONObject score = pkScores.getJSONObject(k);
String userID = score.getString("id");
if(userID.equals(uid)){
removeUid = k;
}
}
pkScores.remove(removeUid);
upDataPkScore(pkScores,"-1",0);
}
}, 1000);
}
SWManager.get().setDrPkNumClarity(drPkbeans.size());
if (drPkbeans.size() == 1) {
mLiveAnchorViewHolder.closeEndPkBt();
@ -520,7 +615,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
dRjoinOtherRoom(u);
//展示结束连麦按钮
mLiveAnchorViewHolder.showEndPkBt();
mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid());
}
/**
@ -578,6 +672,9 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
/*---------------------------------------------------------------- */
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 2) //回复PK申请 2
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", bean.getId()).param("uid", CommonAppConfig.getInstance().getUid()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
if (bean.isRandomPk()) {
msg1.param("random_pk", "1");
}
if (RandomPkManager.getInstance().isRankModel()) {
L.eSw("排位赛");
msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png");
@ -711,6 +808,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0;
DRPKing = 1;
runOnUiThread(new Runnable() {
@Override
public void run() {
@ -1159,6 +1257,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
//多人PK接受申请画 加入副房间
public void dRjoinOtherRoom(UserBean u) {
L.eSw("dRjoinOtherRoom UserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBean ");
setMyDrPkDetailsView();
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() {
@Override
@ -1601,11 +1700,13 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
* 更新Pk分数
*/
public void upDataPkScore(JSONArray pkScores, String uid, int time) {
this.pkScores = pkScores;
L.eSw("更新Pk分数 upDataPkScore time:" + time + " " + pkScores);
String userID1 = (String) imageGrade1.getTag();
String userID2 = (String) imageGrade2.getTag();
String userID4 = (String) imageGrade4.getTag();
if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE) {
if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE &&!"-1".equals(uid)) {
mHandler.removeMessages(WHAT_PK_TIME2);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushSwViewHolder.timeTitle.getLayoutParams();
layoutParams.topMargin = DpUtil.dp2px(123);
@ -1699,7 +1800,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
}
}
}
} else {
} else if(pkScoreSize == 4){
String userID3 = (String) imageGrade3.getTag();
detailsLinearLayout1.setVisibility(View.VISIBLE);
@ -1803,6 +1904,61 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
}
}
}else{
detailsLinearLayout1.setVisibility(View.VISIBLE);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade1.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.VISIBLE);
//拿到原始数据
for (int i = 0; i < pkScores.size(); i++) {
JSONObject score = pkScores.getJSONObject(i);
String userID = score.getString("id");
long userScore = score.getLong("score");
if (TextUtils.equals(userID, userID1)) {
textGrade1.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade1);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade1);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade1);
break;
}
}
} else if (TextUtils.equals(userID, userID2)) {
textGrade2.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade2);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade2);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade2);
break;
}
}
}
}
}
}

View File

@ -3,6 +3,7 @@ package com.yunbao.live.socket;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK;
import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
import android.app.Activity;
@ -314,14 +315,12 @@ public class SocketSwClient {
mListener.onLinkDRMicPkApply(u);
} else if (action3 == 2) {
//收到对方同意多人PK邀请
if ("0".equals(map.getString("msgtype"))) {
return;
}
UserBean u = new UserBean();
// u.setUserNiceName(map.getString("uname"));
u.setId(map.getString("pkuid"));
L.eSw("action3 == 2:" + u.getId());
L.eSw("收到对方同意多人PK邀请");
DRPKing = 0;
mListener.onLinkDRMicPkApplyOk(u);
} else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) {
@ -333,6 +332,7 @@ public class SocketSwClient {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW));
}
DRPKing = 1;
} else if (action3 == 5) {//结束PK
// endDRGif();
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
@ -353,6 +353,7 @@ public class SocketSwClient {
LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
}*/
isDRPK = 1;
DRPKing = 0;
if (livePushSwViewHolder == null) {
if ("4".equals(map.getString("msgtype"))) {
return;
@ -1355,7 +1356,7 @@ public class SocketSwClient {
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid())
.param("msgtype", 2).param("uid", CommonAppConfig.getInstance().getUid())
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("is_auto ", "1")
.param("is_auto", "1")
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
msg1.create();

View File

@ -8,9 +8,11 @@ import android.content.Context;
import android.graphics.Color;
import android.media.AudioManager;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@ -224,7 +226,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null);
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
MicedUserManager.get().removeMiscUser(CommonAppConfig.getInstance().getUid());
MicedUserManager.get().removeMiscUser(CommonAppConfig.getInstance().getUid());
}
@Override
@ -238,17 +240,17 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
});
//进入主播房间
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken,liveUid, SWAuManager.getChannelName(liveUid));
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, liveUid, SWAuManager.getChannelName(liveUid));
}
@Override
public void removeLiveUid(String uid) {
//先结束PK
if(drMicUserList!=null){
if (drMicUserList != null) {
List<UserBean> tempList = new ArrayList<>();
int index = -1;
for (int i = 0; i <drMicUserList.size(); i++) {
if(!drMicUserList.get(i).getId().equals(uid)){
for (int i = 0; i < drMicUserList.size(); i++) {
if (!drMicUserList.get(i).getId().equals(uid)) {
tempList.add(drMicUserList.get(i));
}
}
@ -356,6 +358,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
if (detailsView1 != null) {
dr1_preview.removeView(detailsView1);
}
}
/**
@ -415,10 +418,11 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
});
}
@Override
public void endLiveMic() {
L.eSw("endLiveMic");
if(swAuManager!=null){
if (swAuManager != null) {
swAuManager.setMicAn(false);
userJoinLinkMic = false;
MicStatusManager.getInstance().clear();
@ -891,7 +895,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
if ("UsertoRY".equals(str)) {
//todo 新增dis监听
if (isShow||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
if (isShow || MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShow = true;
@ -911,7 +915,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
});
} else if ("inviteMic".equals(str)) {
if (isShowInvitation||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
if (isShowInvitation || MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShowInvitation = true;
@ -926,20 +930,20 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext).setContent(content).setTitle(mLiveBean.getUserNiceName()).setConfirmString(confirm).setCancelString(cancel).setView(R.layout.dialog_live_mic_invite).setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
String[] permissions;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
} else {
permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO};
String[] permissions;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
} else {
permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO};
}
LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
L.eSw("将自己设置成给主播,和主播连麦");
joinLiveMic();
isShowInvitation = false;
}
LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
L.eSw("将自己设置成给主播,和主播连麦");
joinLiveMic();
isShowInvitation = false;
}
});
});
}
@Override
@ -963,7 +967,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
}
public void endLiveMicUser(){
public void endLiveMicUser() {
endLiveMic();
}

View File

@ -197,7 +197,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
btn_close.setVisibility(View.GONE);//隐藏连麦按钮
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closeButtonGone();
L.eSw("ac333333333333333333333");
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid());
seed_msg.create();
Log.i("seed", seed_msg.mResult.toString());

View File

@ -394,7 +394,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
}
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw);
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);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
@ -957,7 +957,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks();
}
if(mLivePlayViewHolder!=null){
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.stopPlay2();
mLiveRoomViewHolder.cancelAllAnim();
}
@ -987,7 +987,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.release();
mLiveRyLinkMicPkPresenter = null;
}
if(mLiveSwLinkMicPkPresenter!=null){
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.clearData();
mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null;
@ -1031,7 +1031,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
EventBus.getDefault()
.post(new LiveFloatEvent()
.setmLiveBean(mLiveBean)
.setmLiveSDK(isSw?2:mLiveSDK)
.setmLiveSDK(isSw ? 2 : mLiveSDK)
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal));
}
@ -1170,8 +1170,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
if(isSw){
if(mLivePlayViewHolder!=null){
if (isSw) {
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.endLiveMic();
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
.params("roomid", liveID)
@ -1189,7 +1189,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
}
}
}else{
} else {
if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
return;
}
@ -1277,15 +1277,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mFirstConnectSocket) {
mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if(isSw){
if (isSw) {
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
}else{
} else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
}
}
if(isSw){
if (isSw) {
SocketSwChatUtil.getFakeFans(mLiveBean.getUid());
}else{
} else {
SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
}
}
@ -1735,8 +1735,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onLinkDRMicPkQuit(String uid) {
L.eSw("onLinkDRMicPkQuit:"+uid);
L.eSw("onLinkDRMicPkQuit:" + uid);
mLivePlayViewHolder.removeLiveUid(uid);
int removeUid = 0;
for (int k = 0; k < pkScores.size(); k++) {
JSONObject score = pkScores.getJSONObject(k);
String userID = score.getString("id");
if (userID.equals(uid)) {
removeUid = k;
}
}
pkScores.remove(removeUid);
upDataPkScore(pkScores, -1);
}
/**
@ -2166,9 +2176,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮");
mLighted = true;
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if(isSw){
if (isSw) {
SocketSwChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}else{
} else {
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}
}
@ -2228,9 +2238,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 更新主播映票数
*/
public void sendUpdateVotesMessage() {
if(isSw){
if (isSw) {
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}else{
} else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}
}
@ -2354,6 +2364,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mViewPager.setCanScroll(enableScroll);
}
public JSONArray pkScores;
/**
* 用户端多人Pk
*
@ -2362,6 +2374,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
*/
public void upDataPkScore(JSONArray pkScores, int time) {
L.eSw("upDataPkScore" + time);
this.pkScores = pkScores;
if (mLiveRoomViewHolder != null) {
String liveId = mLiveBean.getUid();
JSONObject liveModel = null;
@ -2376,8 +2389,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
pkScores.remove(index);
pkScores.add(0, liveModel);
mLiveRoomViewHolder.upDataPkScore(pkScores, time);
mLivePlayViewHolder.claerDrPkInfoView();
if (time == -1) {
mLiveRoomViewHolder.upDataPkScore(pkScores);
} else {
mLiveRoomViewHolder.upDataPkScore(pkScores, time);
mLivePlayViewHolder.claerDrPkInfoView();
}
setPkStatus(true);
}
//通知心愿单位置换地方

View File

@ -49,7 +49,7 @@
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_height="280dp"
android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4
@ -69,7 +69,7 @@
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_height="280dp"
android:layout_marginTop="130dp"
android:orientation="horizontal"
android:visibility="gone">