修复:
1:开播闪屏问题 2:游戏房消息重复(或不显示) 3:模拟器或部分机型滑动声网直播间会白屏问题 4:PK条在平板模式下显示太高问题 5:PK没断开能收到其他人邀请的问题
This commit is contained in:
parent
6eba9558e1
commit
b41bd3b89b
@ -143,6 +143,9 @@ public class RandomPkManager {
|
||||
.randomPK(new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (debugUid != null) {
|
||||
pkUid = data = debugUid;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(data);//检测返回的data是否为数字uid,不是的话开始下一轮
|
||||
} catch (Exception e) {
|
||||
@ -152,9 +155,8 @@ public class RandomPkManager {
|
||||
return;
|
||||
}
|
||||
pkUid = data;
|
||||
if (debugUid != null) {
|
||||
pkUid = data = debugUid;
|
||||
}
|
||||
|
||||
ToastUtil.showDebug("随机PK:"+pkUid+"|"+data);
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onStartPK(data);
|
||||
}
|
||||
|
@ -4,20 +4,20 @@ ext {
|
||||
buildToolsVersion: "29.0.2",
|
||||
minSdkVersion : 21,
|
||||
targetSdkVersion : 33,
|
||||
versionCode : 676,
|
||||
versionName : "6.6.9"
|
||||
versionCode : 678,
|
||||
versionName : "6.7.0"
|
||||
]
|
||||
manifestPlaceholders = [
|
||||
//正式、
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
// 测试
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")),
|
||||
|
||||
//百度语音识别
|
||||
|
||||
swReleaseModel : true, //true声网正式服 false测试服
|
||||
swReleaseModel : true, //true 声网正式服 false 测试服
|
||||
|
||||
baiduAppId : "23774720",
|
||||
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB",
|
||||
|
@ -169,6 +169,10 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
|
||||
public static boolean isSw;
|
||||
|
||||
public static boolean PKing = false;
|
||||
public static int isDRPK = 0;
|
||||
public static int DRPKing = -1; //-1 未发起多人PK 0 多人PK前 1 多人PK中 2多人PK后
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
@ -170,8 +170,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
private int mReqCount;
|
||||
private boolean mPaused;
|
||||
String mBeautySdkType;
|
||||
public static int isDRPK = 0;
|
||||
public static boolean PKing = false;
|
||||
public static int pk_nub;
|
||||
public static int backIndex = 0;//0=未判断,1=已判断
|
||||
private FaceManager manager;
|
||||
|
@ -165,9 +165,8 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
private int mReqCount;
|
||||
private boolean mPaused;
|
||||
String mBeautySdkType;
|
||||
public static int isDRPK = 0;
|
||||
public static int DRPKing = -1; //-1 未发起多人PK 0 多人PK前 1 多人PK中 2多人PK后
|
||||
public static boolean PKing = false;
|
||||
|
||||
|
||||
public static int pk_nub;
|
||||
public static int backIndex = 0;//0=未判断,1=已判断
|
||||
private FaceManager manager;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -10,6 +11,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
@ -18,6 +21,8 @@ import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
@ -134,61 +139,82 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
||||
return;
|
||||
}
|
||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||
//检查自己是不是在PK中
|
||||
LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
//非0认为未开通连麦权限
|
||||
if (code != 0) {
|
||||
if (mDrPkNum == -1) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
||||
} else {
|
||||
ToastUtil.show("invite " + bean.getUserNiceName() + " successful");
|
||||
}
|
||||
mOnItemClickListener.onItemClick(bean, -1);
|
||||
if(mContext instanceof LiveSwAnchorActivity){
|
||||
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
false);
|
||||
}else{
|
||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mDrPkNum <= 0) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("多人次數已用完");
|
||||
} else {
|
||||
ToastUtil.show("Multiple times have been used up");
|
||||
}
|
||||
return;
|
||||
}
|
||||
yaoqing.put(bean.getId(), bean.getId());
|
||||
if (yaoqing.size() < 5) {
|
||||
if(mContext instanceof LiveSwAnchorActivity){
|
||||
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||
}else{
|
||||
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people");
|
||||
}
|
||||
if (freePkRecyclerListener != null) {
|
||||
freePkRecyclerListener.onClose();
|
||||
}
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请
|
||||
|
||||
} else {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("請先關閉語音連麥");
|
||||
} else {
|
||||
ToastUtil.show("Please disable the voice connection first");
|
||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
//非0认为未开通连麦权限
|
||||
if (code != 0) {
|
||||
if (mDrPkNum == -1) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功");
|
||||
} else {
|
||||
ToastUtil.show("invite " + bean.getUserNiceName() + " successful");
|
||||
}
|
||||
mOnItemClickListener.onItemClick(bean, -1);
|
||||
if(mContext instanceof LiveSwAnchorActivity){
|
||||
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
false);
|
||||
}else{
|
||||
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mDrPkNum <= 0) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("多人次數已用完");
|
||||
} else {
|
||||
ToastUtil.show("Multiple times have been used up");
|
||||
}
|
||||
return;
|
||||
}
|
||||
yaoqing.put(bean.getId(), bean.getId());
|
||||
if (yaoqing.size() < 5) {
|
||||
if(mContext instanceof LiveSwAnchorActivity){
|
||||
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||
}else{
|
||||
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people");
|
||||
}
|
||||
if (freePkRecyclerListener != null) {
|
||||
freePkRecyclerListener.onClose();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("請先關閉語音連麥");
|
||||
} else {
|
||||
ToastUtil.show("Please disable the voice connection first");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("請先關閉PK");
|
||||
} else {
|
||||
ToastUtil.show("Please disable the PK");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
mFollow.setOnClickListener(v -> {
|
||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||
|
@ -0,0 +1,160 @@
|
||||
package com.yunbao.live.presenter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
|
||||
public abstract class AbsLinkMicPkPresenter {
|
||||
private boolean isSw = false;
|
||||
protected boolean mIsPk;//是否已经Pk了
|
||||
public static String mPkUid;//正在Pk的对方主播的uid
|
||||
public static String oldmPkUid;//正在Pk的对方主播的uid
|
||||
public boolean mIsPkEnd;//pk是否结束,进入惩罚时间
|
||||
private static boolean init = false;
|
||||
|
||||
public AbsLinkMicPkPresenter(boolean isSw) {
|
||||
this.isSw = isSw;
|
||||
}
|
||||
|
||||
public static String mApplyUid;//正在申请Pk的主播的uid
|
||||
protected String mApplyUrl;//正在申请Pk的主播的头像
|
||||
protected String mApplyNmae;//正在申请Pk的主播的名字
|
||||
protected boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
||||
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的多人PK申请的回调
|
||||
*/
|
||||
public void onLinkDRMicPkApply(UserBean u) {
|
||||
Log.e("ry", "多人收到");
|
||||
showDRApplyDialogTmp(u);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调
|
||||
*/
|
||||
public void onLinkMicPkApply(UserBean u, String stream, int by) {
|
||||
Log.e("ry", u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
mApplyUid = u.getId();
|
||||
mApplyUrl = u.getAvatar();
|
||||
mApplyNmae = u.getUserNiceName();
|
||||
if (by != 1) {
|
||||
if (mIsApplyDialogShow == false) {
|
||||
if (u.isRandomPk()) {
|
||||
showPkDialogTmp(u);
|
||||
} else {
|
||||
showApplyDialogTmp(u);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isPKTmp(u);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkPK(OnItemClickListener<Boolean> onItemClickListener) {
|
||||
LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (TextUtils.equals(obj.getString("ispk"), "1")) {
|
||||
onItemClickListener.onItemClick(true, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
onItemClickListener.onItemClick(false, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void showDRApplyDialogTmp(UserBean u) {
|
||||
checkPK((bean, position) -> {
|
||||
if(bean){
|
||||
onDRPkRefuse(u);
|
||||
return;
|
||||
}
|
||||
showDRApplyDialog(u);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void showApplyDialogTmp(UserBean u) {
|
||||
checkPK((bean, position) -> {
|
||||
if(bean){
|
||||
onPkRefuse(u);
|
||||
return;
|
||||
}
|
||||
showApplyDialog(u);
|
||||
});
|
||||
}
|
||||
|
||||
protected void showPkDialogTmp(UserBean u) {
|
||||
checkPK((bean, position) -> {
|
||||
if(bean){
|
||||
onPkRefuse(u);
|
||||
return;
|
||||
}
|
||||
showPkDialog(u);
|
||||
});
|
||||
}
|
||||
|
||||
protected void isPKTmp(UserBean u) {
|
||||
isPK(u);
|
||||
}
|
||||
|
||||
protected void onDRPkApplyTmp(UserBean u) {
|
||||
onDRPkApply(u);
|
||||
}
|
||||
|
||||
protected void onDRPkTimeoutTmp(UserBean u) {
|
||||
onDRPkTimeout(u);
|
||||
}
|
||||
|
||||
protected void onDRPkRefuseTmp(UserBean u) {
|
||||
onDRPkRefuse(u);
|
||||
}
|
||||
|
||||
protected void onPkApplyTmp(UserBean u) {
|
||||
onPkApply(u);
|
||||
}
|
||||
|
||||
protected void onPkTimeoutTmp(UserBean u) {
|
||||
onPkTimeout(u);
|
||||
}
|
||||
|
||||
protected void onPkRefuseTmp(UserBean u) {
|
||||
onPkRefuse(u);
|
||||
}
|
||||
|
||||
|
||||
protected abstract void showDRApplyDialog(UserBean u);//多人PK弹窗
|
||||
|
||||
protected abstract void showApplyDialog(UserBean u);//PK弹窗
|
||||
|
||||
protected abstract void showPkDialog(UserBean u);//随机PK弹框
|
||||
|
||||
protected abstract void isPK(UserBean bean);
|
||||
|
||||
protected abstract void onDRPkApply(UserBean u);
|
||||
|
||||
protected abstract void onDRPkTimeout(UserBean u);
|
||||
|
||||
protected abstract void onDRPkRefuse(UserBean u);
|
||||
|
||||
protected abstract void onPkApply(UserBean u);
|
||||
|
||||
protected abstract void onPkTimeout(UserBean u);
|
||||
|
||||
protected abstract void onPkRefuse(UserBean u);
|
||||
|
||||
}
|
@ -111,7 +111,7 @@ import io.rong.message.TextMessage;
|
||||
* 主播与主播PK逻辑
|
||||
*/
|
||||
|
||||
public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
private static final int WHAT_PK_WAIT_RECEIVE = 0;//收到pk申请等待 what
|
||||
private static final int WHAT_PK_WAIT_SEND = 1;//发送pk申请等待 what
|
||||
@ -125,17 +125,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
private boolean mIsAnchor;//自己是否是主播
|
||||
private SocketRyClient mSocketRyClient;
|
||||
private ViewGroup mPkContainer;
|
||||
private boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
||||
|
||||
private boolean mAcceptPk;//是否接受连麦
|
||||
private boolean mIsPk;//是否已经Pk了
|
||||
public static String mApplyUid;//正在申请Pk的主播的uid
|
||||
private String mApplyUrl;//正在申请Pk的主播的头像
|
||||
private String mApplyNmae;//正在申请Pk的主播的名字
|
||||
private String mApplyStream;//正在申请Pk的主播的stream
|
||||
private String mLiveUid;//自己主播的uid
|
||||
private String mUrl;//主播的头像
|
||||
public static String mPkUid;//正在Pk的对方主播的uid
|
||||
public static String oldmPkUid;//正在Pk的对方主播的uid
|
||||
private ProgressTextView mLinkMicWaitProgress;
|
||||
private int mPkWaitCount;//Pk弹窗等待倒计时Live
|
||||
private int mPkTimeCount;//pk时间
|
||||
@ -144,7 +138,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
private LiveLinkMicPkViewHolder mLiveLinkMicPkViewHolder;
|
||||
private String mPkTimeString1;
|
||||
private String mPkTimeString2;
|
||||
private boolean mIsPkEnd;//pk是否结束,进入惩罚时间
|
||||
private boolean mPkSend;//pk请求是否已经发送
|
||||
private int mPkSendWaitCount;//发送pk请求后的等待时间
|
||||
private String mSelfStream;
|
||||
@ -214,6 +207,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
};
|
||||
|
||||
public LiveRyLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) {
|
||||
super(false);
|
||||
mContext = context;
|
||||
mIsAnchor = isAnchor;
|
||||
mRoot = root;
|
||||
@ -254,6 +248,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
public LiveRyLinkMicPkPresenter(Context context, LivePushRyViewHolder linkMicViewHolder, boolean isAnchor, View root) {
|
||||
super(false);
|
||||
mContext = context;
|
||||
mIsAnchor = isAnchor;
|
||||
mRoot = root;
|
||||
@ -516,14 +511,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的多人PK申请的回调
|
||||
*/
|
||||
public void onLinkDRMicPkApply(UserBean u) {
|
||||
Log.e("ry", "多人收到");
|
||||
showDRApplyDialog(u);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的多人PK申请同意了的回调
|
||||
*/
|
||||
@ -660,26 +647,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调
|
||||
*/
|
||||
public void onLinkMicPkApply(UserBean u, String stream, int by) {
|
||||
Log.e("ry", u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
mApplyUid = u.getId();
|
||||
mApplyUrl = u.getAvatar();
|
||||
mApplyNmae = u.getUserNiceName();
|
||||
if (by != 1) {
|
||||
if (mIsApplyDialogShow == false) {
|
||||
if (u.isRandomPk()) {
|
||||
showPkDialog(u);
|
||||
} else {
|
||||
showApplyDialog(u);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isPK(u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主播与主播PK PK主播发过来的已经接受
|
||||
@ -829,7 +797,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
}
|
||||
|
||||
private void isPK(UserBean bean) {
|
||||
@Override
|
||||
protected void isPK(UserBean bean) {
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
|
||||
@ -964,6 +933,312 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkApply(UserBean u) {
|
||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("pkuid", u.getId())
|
||||
.params("type", "1")
|
||||
.params("sign", "1")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.i("多人PK", "1code = " + code + ", msgs = " + msgs + ", info = " + Arrays.deepToString(info) + " mApplyUid = " + mApplyUid);
|
||||
HttpClient.getInstance().get("live.getdrnum", "live.getdrnum")
|
||||
.execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length > 0) {
|
||||
|
||||
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||
boolean agree = true;
|
||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||
ToastUtil.show("多人PK次数已用完");
|
||||
agree = false;
|
||||
}
|
||||
boolean finalAgree = agree;
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, agree, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (finalAgree == true) {
|
||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("roomid", u.getId())
|
||||
.execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LIVE_DRPK)
|
||||
.param("action", 10)
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.create();
|
||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
if (info.length == 0) {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
JSONArray users = obj.getJSONArray("userlist");
|
||||
|
||||
//添加水印
|
||||
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
|
||||
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
|
||||
dRjoinOtherRoom(u.getId(), 1);
|
||||
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
JSONObject user = users.getJSONObject(i);
|
||||
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
||||
/**
|
||||
* 向指定用户发送跨房间连麦请求
|
||||
* <P>
|
||||
* 1: inviterAutoMix为true时:
|
||||
*
|
||||
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||
*
|
||||
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||
*
|
||||
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||
* <P/>
|
||||
*/
|
||||
IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
ToastUtil.show("接受失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
|
||||
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}});*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkTimeout(UserBean u) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + mApplyUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkRefuse(UserBean u) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkApply(UserBean u) {
|
||||
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPKTmp(u);
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkTimeout(UserBean u) {
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + u.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkRefuse(UserBean u) {
|
||||
onPkTimeoutTmp(u);
|
||||
}
|
||||
|
||||
//与用户连麦
|
||||
public void setUserMic(String liveid) {
|
||||
JSONObject msg1 = new JSONObject();
|
||||
@ -1032,7 +1307,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 显示申请PK的弹窗
|
||||
*/
|
||||
private void showApplyDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showApplyDialog(UserBean u) {
|
||||
mIsApplyDialogShow = true;
|
||||
mAcceptPk = false;
|
||||
View v = LayoutInflater.from(mContext).inflate(R.layout.dialog_link_mic_pk_wait, null);
|
||||
@ -1050,63 +1326,10 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
|
||||
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPK(u);
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}}});
|
||||
onPkApplyTmp(u);
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + u.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onPkTimeoutTmp(u);
|
||||
|
||||
}
|
||||
mApplyUid = null;
|
||||
@ -1260,7 +1483,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 随机PK拒绝对话框
|
||||
*/
|
||||
public void showPkDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showPkDialog(UserBean u) {
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setHtmlCode(Html.fromHtml(
|
||||
"<font color='#999999' size='12'>有人向您发起PK请求。</font><br/>" +
|
||||
@ -1333,7 +1557,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
|
||||
void apply() {
|
||||
isPK(u);
|
||||
isPKTmp(u);
|
||||
}
|
||||
})
|
||||
.build().show();
|
||||
@ -1388,7 +1612,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 显示申请多人PK的弹窗
|
||||
*/
|
||||
private void showDRApplyDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showDRApplyDialog(UserBean u) {
|
||||
mApplyUid = u.getId();
|
||||
mIsApplyDialogShow = true;
|
||||
mAcceptPk = false;
|
||||
@ -1407,236 +1632,14 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("pkuid", u.getId())
|
||||
.params("type", "1")
|
||||
.params("sign", "1")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.i("多人PK", "1code = " + code + ", msgs = " + msgs + ", info = " + Arrays.deepToString(info) + " mApplyUid = " + mApplyUid);
|
||||
HttpClient.getInstance().get("live.getdrnum", "live.getdrnum")
|
||||
.execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length > 0) {
|
||||
|
||||
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||
boolean agree = true;
|
||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||
ToastUtil.show("多人PK次数已用完");
|
||||
agree = false;
|
||||
}
|
||||
boolean finalAgree = agree;
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, agree, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (finalAgree == true) {
|
||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("roomid", u.getId())
|
||||
.execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LIVE_DRPK)
|
||||
.param("action", 10)
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.create();
|
||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
if (info.length == 0) {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
JSONArray users = obj.getJSONArray("userlist");
|
||||
|
||||
//添加水印
|
||||
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
|
||||
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
|
||||
dRjoinOtherRoom(u.getId(), 1);
|
||||
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
JSONObject user = users.getJSONObject(i);
|
||||
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) {
|
||||
if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) {
|
||||
/**
|
||||
* 向指定用户发送跨房间连麦请求
|
||||
* <P>
|
||||
* 1: inviterAutoMix为true时:
|
||||
*
|
||||
* 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||
*
|
||||
* 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||
*
|
||||
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||
* <P/>
|
||||
*/
|
||||
IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
ToastUtil.show("接受失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
|
||||
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}});*/
|
||||
onDRPkApplyTmp(u);
|
||||
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + mApplyUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onDRPkTimeoutTmp(u);
|
||||
|
||||
} else {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
.param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onDRPkRefuseTmp(u);
|
||||
}
|
||||
mApplyUid = null;
|
||||
mApplyStream = null;
|
||||
@ -2541,7 +2544,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
String pkTime = StringUtil.getDurationText(time * 1000);
|
||||
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime));
|
||||
mPkTimeCount = time;
|
||||
if (time>0){
|
||||
if (time > 0) {
|
||||
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
||||
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||
mHandler.sendEmptyMessage(WHAT_PK_TIME2);
|
||||
|
@ -107,7 +107,7 @@ import io.rong.message.TextMessage;
|
||||
* 主播与主播PK逻辑
|
||||
*/
|
||||
|
||||
public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
private static final int WHAT_PK_WAIT_RECEIVE = 0;//收到pk申请等待 what
|
||||
private static final int WHAT_PK_WAIT_SEND = 1;//发送pk申请等待 what
|
||||
@ -123,15 +123,11 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
private ViewGroup mPkContainer;
|
||||
private boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
||||
private boolean mAcceptPk;//是否接受连麦
|
||||
private boolean mIsPk;//是否已经Pk了
|
||||
public static String mApplyUid;//正在申请Pk的主播的uid
|
||||
private String mApplyUrl;//正在申请Pk的主播的头像
|
||||
private String mApplyNmae;//正在申请Pk的主播的名字
|
||||
private String mApplyStream;//正在申请Pk的主播的stream
|
||||
private String mLiveUid;//自己主播的uid
|
||||
private String mUrl;//主播的头像
|
||||
public static String mPkUid;//正在Pk的对方主播的uid
|
||||
public static String oldmPkUid;//正在Pk的对方主播的uid
|
||||
private ProgressTextView mLinkMicWaitProgress;
|
||||
private int mPkWaitCount;//Pk弹窗等待倒计时Live
|
||||
private int mPkTimeCount;//pk时间
|
||||
@ -140,7 +136,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
private LiveLinkMicPkViewHolder mLiveLinkMicPkViewHolder;
|
||||
private String mPkTimeString1;
|
||||
private String mPkTimeString2;
|
||||
private boolean mIsPkEnd;//pk是否结束,进入惩罚时间
|
||||
|
||||
private boolean mPkSend;//pk请求是否已经发送
|
||||
private int mPkSendWaitCount;//发送pk请求后的等待时间
|
||||
private String mSelfStream;
|
||||
@ -169,6 +165,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
public LiveSwLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) {
|
||||
super(true);
|
||||
mContext = context;
|
||||
mIsAnchor = isAnchor;
|
||||
mRoot = root;
|
||||
@ -209,6 +206,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
public LiveSwLinkMicPkPresenter(Context context, LivePushSwViewHolder linkMicViewHolder, boolean isAnchor, View root) {
|
||||
super(true);
|
||||
mContext = context;
|
||||
mIsAnchor = isAnchor;
|
||||
mRoot = root;
|
||||
@ -456,13 +454,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的多人PK申请的回调
|
||||
*/
|
||||
public void onLinkDRMicPkApply(UserBean u) {
|
||||
Log.e("ry", "多人收到");
|
||||
showDRApplyDialog(u);
|
||||
}
|
||||
|
||||
public void onLinkDRMicPkQuit(String uid) {
|
||||
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() {
|
||||
@ -560,18 +551,17 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
for (int k = 0; k < pkScores.size(); k++) {
|
||||
JSONObject score = pkScores.getJSONObject(k);
|
||||
String userID = score.getString("id");
|
||||
if(userID.equals(uid)){
|
||||
if (userID.equals(uid)) {
|
||||
removeUid = k;
|
||||
}
|
||||
}
|
||||
pkScores.remove(removeUid);
|
||||
upDataPkScore(pkScores,"-1",0,false);
|
||||
upDataPkScore(pkScores, "-1", 0, false);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SWManager.get().setDrPkNumClarity(drPkbeans.size());
|
||||
if (drPkbeans.size() == 1) {
|
||||
mLiveAnchorViewHolder.closeEndPkBt();
|
||||
@ -619,30 +609,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mLiveAnchorViewHolder.showEndPkBt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调
|
||||
*/
|
||||
public void onLinkMicPkApply(UserBean u, String stream, int by) {
|
||||
Log.e("ry", u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
mApplyUid = u.getId();
|
||||
mApplyUrl = u.getAvatar();
|
||||
mApplyNmae = u.getUserNiceName();
|
||||
if (by != 1) {
|
||||
Log.e("ry", "1" + u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
if (mIsApplyDialogShow == false) {
|
||||
if (u.isRandomPk()) {
|
||||
Log.e("ry", "2" + u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
showPkDialog(u);
|
||||
} else {
|
||||
Log.e("ry", "3" + u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
showApplyDialog(u);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("ry", "4" + u.getUserNiceName() + "单人收到" + u.getAvatar());
|
||||
isPK(u);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播与主播PK PK主播发过来的已经接受
|
||||
@ -658,7 +624,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void isPK(UserBean bean) {
|
||||
@Override
|
||||
protected void isPK(UserBean bean) {
|
||||
EventBus.getDefault().post(new AnchorInfoEvent(false, bean.getId(), bean.getUserNiceName(), bean.getAvatar()));
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
@ -720,10 +687,313 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkApply(UserBean u) {
|
||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive").params("uid", CommonAppConfig.getInstance().getUid()).params("pkuid", u.getId()).params("type", "1").params("sign", "1").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.i("多人PK", "1code = " + code + ", msgs = " + msgs + ", info = " + Arrays.deepToString(info) + " mApplyUid = " + mApplyUid);
|
||||
HttpClient.getInstance().get("live.getdrnum", "live.getdrnum").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length > 0) {
|
||||
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||
boolean agree = true;
|
||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||
ToastUtil.show("多人PK次数已用完");
|
||||
agree = false;
|
||||
}
|
||||
boolean finalAgree = agree;
|
||||
if (finalAgree) {
|
||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", u.getId()).execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
L.eSw("多人PK" + "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length == 0) {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
SWManager.get().setDrPkNumClarity(3);//加入成功后,将分别率设置为 VD_320x240
|
||||
//将自己从多人pk列表里剔除
|
||||
int removeIndex = -1;
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
if (removeIndex != -1) {
|
||||
drPkbeans.remove(removeIndex);
|
||||
L.eSw("将自己从多人pk列表里剔除" + new Gson().toJson(drPkbeans));
|
||||
}
|
||||
|
||||
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 2).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()).param("msgtype", 2).param("uid", drPkbeans.get(i).getId()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.create();
|
||||
L.eSw("uiduiduiduiduiduiduiduid" + drPkbeans.get(i).getId());
|
||||
String targetId = String.valueOf(drPkbeans.get(i).getId());
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
int index = livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
|
||||
|
||||
L.eSw("onLinkDRMicPkApplyOk(UserBean u)-点击接收 1 " + u.getUserNiceName());
|
||||
L.eSw("發送action = 2");
|
||||
|
||||
}
|
||||
|
||||
if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 3).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("msgtype", 3).param("uid", drPkbeans.get(i).getId()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName() );;
|
||||
msg1.create();
|
||||
L.eSw("發送給自己直播間" + drPkbeans.get(i).getId());
|
||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; //群聊
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!mApplyUid.equals(String.valueOf(drPkbeans.get(i).getId())) && !CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 3).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()).param("msgtype", 3).param("uid", drPkbeans.get(i).getId()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.create();
|
||||
L.eSw("發送給其他主播直播间" + drPkbeans.get(i).getId());
|
||||
String targetId = "g" + drPkbeans.get(i).getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; //群聊
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
dRjoinOtherRoom(u);
|
||||
//展示结束连麦按钮
|
||||
//设置多人PK 房主ROOM UID
|
||||
mLiveAnchorViewHolder.setDrpkRoomId(mApplyUid);
|
||||
mLiveAnchorViewHolder.showEndPkBt();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkTimeout(UserBean u) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + mApplyUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDRPkRefuse(UserBean u) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkApply(UserBean u) {
|
||||
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPKTmp(u);
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkTimeout(UserBean u) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
|
||||
msg1.create();
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + u.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPkRefuse(UserBean u) {
|
||||
onPkTimeoutTmp(u);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示申请PK的弹窗
|
||||
*/
|
||||
private void showApplyDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showApplyDialog(UserBean u) {
|
||||
mIsApplyDialogShow = true;
|
||||
mAcceptPk = false;
|
||||
View v = LayoutInflater.from(mContext).inflate(R.layout.dialog_link_mic_pk_wait, null);
|
||||
@ -741,50 +1011,10 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPK(u);
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
onPkApplyTmp(u);
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
|
||||
msg1.create();
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + u.getId());
|
||||
}
|
||||
});
|
||||
onPkTimeoutTmp(u);
|
||||
}
|
||||
mApplyUid = null;
|
||||
mApplyStream = null;
|
||||
@ -803,7 +1033,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
private String TAG = "多人PK";
|
||||
|
||||
|
||||
public void editPkRoom(String uid){
|
||||
public void editPkRoom(String uid) {
|
||||
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), uid);
|
||||
}
|
||||
|
||||
@ -852,7 +1082,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 随机PK拒绝对话框
|
||||
*/
|
||||
public void showPkDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showPkDialog(UserBean u) {
|
||||
new DialogUitl.Builder(mContext).setHtmlCode(Html.fromHtml("<font color='#999999' size='12'>有人向您发起PK请求。</font><br/>" + "<font color='#FB4F4F' size='12'>若拒绝PK,将会10分钟内不会再收到任何随机PK请求。</font>")).setConfirmString("接受").setCancelString("拒絕").setView(R.layout.dialog_live_random_pk).setSimpleCallbackView(new DialogUitl.SimpleCallbackView() {
|
||||
boolean clickCancel = false;
|
||||
String titleVal;
|
||||
@ -914,7 +1145,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
|
||||
void apply() {
|
||||
isPK(u);
|
||||
isPKTmp(u);
|
||||
}
|
||||
}).build().show();
|
||||
}
|
||||
@ -968,7 +1199,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 显示申请多人PK的弹窗
|
||||
*/
|
||||
private void showDRApplyDialog(UserBean u) {
|
||||
@Override
|
||||
protected void showDRApplyDialog(UserBean u) {
|
||||
mApplyUid = u.getId();
|
||||
mIsApplyDialogShow = true;
|
||||
mAcceptPk = false;
|
||||
@ -987,245 +1219,13 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive").params("uid", CommonAppConfig.getInstance().getUid()).params("pkuid", u.getId()).params("type", "1").params("sign", "1").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.i("多人PK", "1code = " + code + ", msgs = " + msgs + ", info = " + Arrays.deepToString(info) + " mApplyUid = " + mApplyUid);
|
||||
HttpClient.getInstance().get("live.getdrnum", "live.getdrnum").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length > 0) {
|
||||
JSONObject datas = JSONObject.parseObject(info[0]);
|
||||
boolean agree = true;
|
||||
if (datas.getIntValue("pk_num_day") <= 0) {
|
||||
ToastUtil.show("多人PK次数已用完");
|
||||
agree = false;
|
||||
}
|
||||
boolean finalAgree = agree;
|
||||
if (finalAgree) {
|
||||
HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", u.getId()).execute(new HttpCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
L.eSw("多人PK" + "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
|
||||
if (info.length == 0) {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
SWManager.get().setDrPkNumClarity(3);//加入成功后,将分别率设置为 VD_320x240
|
||||
//将自己从多人pk列表里剔除
|
||||
int removeIndex = -1;
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
if (removeIndex != -1) {
|
||||
drPkbeans.remove(removeIndex);
|
||||
L.eSw("将自己从多人pk列表里剔除" + new Gson().toJson(drPkbeans));
|
||||
}
|
||||
|
||||
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
|
||||
for (int i = 0; i < drPkbeans.size(); i++) {
|
||||
if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 2).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()).param("msgtype", 2).param("uid", drPkbeans.get(i).getId()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.create();
|
||||
L.eSw("uiduiduiduiduiduiduiduid" + drPkbeans.get(i).getId());
|
||||
String targetId = String.valueOf(drPkbeans.get(i).getId());
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
int index = livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
|
||||
|
||||
L.eSw("onLinkDRMicPkApplyOk(UserBean u)-点击接收 1 " + u.getUserNiceName());
|
||||
L.eSw("發送action = 2");
|
||||
|
||||
}
|
||||
|
||||
if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 3).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("msgtype", 3).param("uid", drPkbeans.get(i).getId()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName() );;
|
||||
msg1.create();
|
||||
L.eSw("發送給自己直播間" + drPkbeans.get(i).getId());
|
||||
String targetId = "g" + CommonAppConfig.getInstance().getUid();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; //群聊
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!mApplyUid.equals(String.valueOf(drPkbeans.get(i).getId())) && !CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 3).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()).param("msgtype", 3).param("uid", drPkbeans.get(i).getId()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.create();
|
||||
L.eSw("發送給其他主播直播间" + drPkbeans.get(i).getId());
|
||||
String targetId = "g" + drPkbeans.get(i).getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; //群聊
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
dRjoinOtherRoom(u);
|
||||
//展示结束连麦按钮
|
||||
//设置多人PK 房主ROOM UID
|
||||
mLiveAnchorViewHolder.setDrpkRoomId(mApplyUid);
|
||||
mLiveAnchorViewHolder.showEndPkBt();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
onDRPkApplyTmp(u);
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + mApplyUid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onDRPkTimeoutTmp(u);
|
||||
|
||||
} else {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
String targetId = u.getId();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
if (SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
onDRPkRefuseTmp(u);
|
||||
}
|
||||
mApplyUid = null;
|
||||
mApplyStream = null;
|
||||
@ -1285,76 +1285,76 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
private void setDrPkUserInfoView(List<DrPkbean> drPkbeanList) {
|
||||
L.eSw("setDrPkUserInfoView" + new Gson().toJson(drPkbeanList));
|
||||
for (int j = 0; j < drPkbeanList.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(drPkbeanList.get(0).getId()));
|
||||
textPkName2.setText(drPkbeanList.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(drPkbeanList.get(1).getId()));
|
||||
textPkName4.setText(drPkbeanList.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);
|
||||
for (int j = 0; j < drPkbeanList.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(drPkbeanList.get(0).getId()));
|
||||
textPkName2.setText(drPkbeanList.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(drPkbeanList.get(1).getId()));
|
||||
textPkName4.setText(drPkbeanList.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(drPkbeanList.get(2).getId()));
|
||||
textPkName4.setText(drPkbeanList.get(2).getUser_nicename());
|
||||
livePushSwViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.GONE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
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(drPkbeanList.get(2).getId()));
|
||||
textPkName4.setText(drPkbeanList.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(drPkbeanList.get(1).getId()));
|
||||
textPkName3.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushSwViewHolder.dr3_preview.addView(detailsView3);
|
||||
detailsLinearLayout3.setVisibility(View.GONE);
|
||||
linearGrade3.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(drPkbeanList.get(1).getId()));
|
||||
textPkName3.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushSwViewHolder.dr3_preview.addView(detailsView3);
|
||||
detailsLinearLayout3.setVisibility(View.GONE);
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
}
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
|
||||
}
|
||||
}
|
||||
L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList));
|
||||
|
||||
}
|
||||
@ -1694,14 +1694,14 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
/**
|
||||
* 更新Pk分数
|
||||
*/
|
||||
public void upDataPkScore(JSONArray pkScores, String uid, int time,boolean isShowTimeTitle) {
|
||||
public void upDataPkScore(JSONArray pkScores, String uid, int time, boolean isShowTimeTitle) {
|
||||
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 &&isShowTimeTitle) {
|
||||
if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE && isShowTimeTitle) {
|
||||
mHandler.removeMessages(WHAT_PK_TIME2);
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushSwViewHolder.timeTitle.getLayoutParams();
|
||||
layoutParams.topMargin = DpUtil.dp2px(123);
|
||||
@ -1795,7 +1795,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(pkScoreSize == 4){
|
||||
} else if (pkScoreSize == 4) {
|
||||
String userID3 = (String) imageGrade3.getTag();
|
||||
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
@ -1899,7 +1899,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
|
||||
@ -1972,7 +1972,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME2, getNextSecondTime());
|
||||
}
|
||||
} else {
|
||||
if(DRPKing!=-1){
|
||||
if (DRPKing != -1) {
|
||||
mLiveAnchorViewHolder.showEndPkBt();
|
||||
}
|
||||
livePushSwViewHolder.timeTitle.setVisibility(View.GONE);
|
||||
|
@ -218,6 +218,8 @@ import pl.droidsonroids.gif.GifImageView;
|
||||
*/
|
||||
public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickListener {
|
||||
|
||||
private static final int PK_LINE_HEIGHT = (960 + DpUtil.dp2px(65));//单人PK席位高度线
|
||||
private static final int PK_BOTTOM = ScreenDimenUtil.getInstance().getScreenWdith() / 2;
|
||||
public static Context Contexts;
|
||||
private int mOffsetY;
|
||||
private ViewGroup mRoot;
|
||||
@ -1728,8 +1730,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
layoutParams.topMargin = DpUtil.dp2px(190);
|
||||
dragonImmediateParticipationTime.setLayoutParams(layoutParams);
|
||||
}
|
||||
if(mContext instanceof LiveRyAnchorActivity ||mContext instanceof LiveSwAnchorActivity){
|
||||
if (dragonImmediateParticipationTime.getVisibility() == View.GONE ) {
|
||||
if (mContext instanceof LiveRyAnchorActivity || mContext instanceof LiveSwAnchorActivity) {
|
||||
if (dragonImmediateParticipationTime.getVisibility() == View.GONE) {
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) redPacket.getLayoutParams();
|
||||
layoutParams.topMargin = DpUtil.dp2px(110);
|
||||
redPacket.setLayoutParams(layoutParams);
|
||||
@ -1751,7 +1753,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
redSchedule.setText(stringBuffer.toString());
|
||||
openRedPacket.setText(String.format(mContext.getString(R.string.open_red_packet), mRedPacketModel.getRedPacketCount() + ""));
|
||||
}
|
||||
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && (mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity)) {
|
||||
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && (mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity)) {
|
||||
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
|
||||
anchorTimeHandler.post(anchorTimeRunnable);
|
||||
}
|
||||
@ -1763,7 +1765,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
|
||||
if (!(mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity)) {
|
||||
if (!(mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity)) {
|
||||
LiveNetManager.get(mContext).redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<RedPacketInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(RedPacketInfoModel data) {
|
||||
@ -1789,7 +1791,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2761,7 +2762,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
|
||||
params.height = mScreenWdith * 720 / 1120;
|
||||
params.height = mScreenWdith * 720 / PK_LINE_HEIGHT;
|
||||
//params.bottomMargin = (mScreenWdith * 720 / 960);
|
||||
lt_pk_line.requestLayout();
|
||||
|
||||
lt_pk_line.setVisibility(View.VISIBLE);
|
||||
@ -2819,7 +2821,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
|
||||
params.height = mScreenWdith * 720 / 1120;
|
||||
params.height = mScreenWdith * 720 / PK_LINE_HEIGHT;
|
||||
//params.bottomMargin=(mScreenWdith * 720 / 960);
|
||||
lt_pk_line.requestLayout();
|
||||
|
||||
lt_pk_line.setVisibility(View.VISIBLE);
|
||||
@ -2959,7 +2962,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
bundle.putString("toUid", toUid);
|
||||
bundle.putInt("isAttention", isAttention);
|
||||
bundle.putBoolean("isLive", isAnchor);
|
||||
bundle.putBoolean("SBW", !(mContext instanceof LiveSwAnchorActivity ||mContext instanceof LiveRyAnchorActivity ));
|
||||
bundle.putBoolean("SBW", !(mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity));
|
||||
giftWallDialog.setArguments(bundle);
|
||||
giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog");
|
||||
|
||||
@ -3324,7 +3327,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
//直播间 粉丝排行榜
|
||||
openMedalRankWindow();
|
||||
} else if (i == R.id.btn_guard) {
|
||||
((LiveActivity) mContext).openNewGuardListWindow((mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity ));
|
||||
((LiveActivity) mContext).openNewGuardListWindow((mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity));
|
||||
} else if (i == R.id.btn_red_pack) {
|
||||
((LiveActivity) mContext).openRedPackListWindow();
|
||||
|
||||
@ -3332,13 +3335,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
((LiveActivity) mContext).openPrizePoolWindow();
|
||||
} else if (i == R.id.user_more) {
|
||||
MobclickAgent.onEvent(mContext, "live_room_audience_list", "直播间上面点观众列表按钮");
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity);
|
||||
} else if (i == R.id.hot_btn) {
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity);
|
||||
|
||||
} else if (i == R.id.noble_seat) {
|
||||
MobclickAgent.onEvent(mContext, "live_room_noble", "贵族按钮");
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity);
|
||||
} else if (i == R.id.btn_close) {
|
||||
// if (sudGameMin!=null&&sudGameMin.getVisibility()==View.VISIBLE) {
|
||||
// new XPopup.Builder(mContext)
|
||||
@ -3371,7 +3374,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
} else if (i == R.id.user_guard) {
|
||||
MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮");
|
||||
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
|
||||
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity);
|
||||
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity);
|
||||
}
|
||||
if (i == R.id.lt_trickery) {
|
||||
showTrickeryDialog();
|
||||
@ -3396,7 +3399,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* @param in 展示的view
|
||||
*/
|
||||
private void changeMsgView(View out, View in) {
|
||||
if (mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity) {
|
||||
if (mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity) {
|
||||
return;
|
||||
}
|
||||
if (in.getVisibility() == View.VISIBLE) {
|
||||
@ -4749,7 +4752,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
lt_trickster_salvation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mContext instanceof LiveSwAnchorActivity||mContext instanceof LiveRyAnchorActivity) {
|
||||
if (mContext instanceof LiveSwAnchorActivity || mContext instanceof LiveRyAnchorActivity) {
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}
|
||||
@ -5360,7 +5363,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
if (pkScores.size() == 2) {
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
} else if(pkScores.size()==3){
|
||||
} else if (pkScores.size() == 3) {
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
}
|
||||
for (int i = 0; i < pkScores.size(); i++) {
|
||||
|
@ -1493,6 +1493,7 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/lt_pk_line"
|
||||
android:layout_width="match_parent"
|
||||
tools:visibility="visible"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/live_top"
|
||||
android:visibility="gone">
|
||||
|
Loading…
Reference in New Issue
Block a user