add[声望升级-自動PK,直接PK]
This commit is contained in:
parent
abfd15f751
commit
73414f3349
@ -719,7 +719,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
@Override
|
||||
public void onLinkMicPkApply(UserBean u, String stream, int forwhat) {
|
||||
//主播直播间实现此逻辑
|
||||
|
||||
L.eSw("onLinkMicPkApply----------------------------------------------");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.yunbao.live.event;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/3/25.
|
||||
*/
|
||||
|
||||
public class LivePKRightUserInfoEvent {
|
||||
String uid;
|
||||
String uHead;
|
||||
String uName;
|
||||
|
||||
public LivePKRightUserInfoEvent() {
|
||||
}
|
||||
|
||||
public LivePKRightUserInfoEvent(String uid, String uHead, String uName) {
|
||||
this.uid = uid;
|
||||
this.uHead = uHead;
|
||||
this.uName = uName;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getuHead() {
|
||||
return uHead;
|
||||
}
|
||||
|
||||
public void setuHead(String uHead) {
|
||||
this.uHead = uHead;
|
||||
}
|
||||
|
||||
public String getuName() {
|
||||
return uName;
|
||||
}
|
||||
|
||||
public void setuName(String uName) {
|
||||
this.uName = uName;
|
||||
}
|
||||
}
|
@ -66,6 +66,8 @@ import com.yunbao.live.bean.DrPkbean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.custom.ProgressTextView;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveOpenSuccessEvent;
|
||||
import com.yunbao.live.event.LivePKRightUserInfoEvent;
|
||||
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketRyLinkMicPkUtil;
|
||||
@ -617,6 +619,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
private void isPK(UserBean bean) {
|
||||
EventBus.getDefault().post(new AnchorInfoEvent(false, bean.getId(), bean.getUserNiceName(), bean.getAvatar()));
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
|
||||
@ -1330,11 +1333,15 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
textPkName1 = detailsView1.findViewById(R.id.text_pk_name1);
|
||||
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
livePushRyViewHolder.dr1_preview.addView(detailsView1);
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout1.setVisibility(View.GONE);
|
||||
linearGrade1.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
public void setPkUserInfoView(UserBean userBean){
|
||||
|
||||
}
|
||||
|
||||
//多人PK接受申请画 加入副房间
|
||||
public void dRjoinOtherRoom(UserBean u) {
|
||||
setMyDrPkDetailsView();
|
||||
@ -1380,7 +1387,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
imageGrade2.setTag(String.valueOf(drPkbeanList.get(0).getId()));
|
||||
textPkName2.setText(drPkbeanList.get(0).getUser_nicename());
|
||||
livePushRyViewHolder.dr2_preview.addView(detailsView2);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout2.setVisibility(View.GONE);
|
||||
linearGrade2.setVisibility(View.GONE);
|
||||
} else if (j == 1) {
|
||||
L.eSw("j == 1:" + j);
|
||||
@ -1396,7 +1403,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
imageGrade4.setTag(String.valueOf(drPkbeanList.get(1).getId()));
|
||||
textPkName4.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout4.setVisibility(View.GONE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
} else if (j == 2) {
|
||||
L.eSw("j == 2:" + j);
|
||||
@ -1413,7 +1420,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
imageGrade4.setTag(String.valueOf(drPkbeanList.get(2).getId()));
|
||||
textPkName4.setText(drPkbeanList.get(2).getUser_nicename());
|
||||
livePushRyViewHolder.dr4_preview.addView(detailsView4);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout4.setVisibility(View.GONE);
|
||||
linearGrade4.setVisibility(View.GONE);
|
||||
|
||||
if (detailsView3 != null) {
|
||||
@ -1428,7 +1435,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
imageGrade3.setTag(String.valueOf(drPkbeanList.get(1).getId()));
|
||||
textPkName3.setText(drPkbeanList.get(1).getUser_nicename());
|
||||
livePushRyViewHolder.dr3_preview.addView(detailsView3);
|
||||
detailsLinearLayout3.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout3.setVisibility(View.GONE);
|
||||
linearGrade3.setVisibility(View.GONE);
|
||||
|
||||
|
||||
@ -2155,6 +2162,10 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
int pkScoreSize = pkScores.size();
|
||||
if (pkScoreSize == 3) {
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
|
||||
linearGrade1.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.VISIBLE);
|
||||
linearGrade4.setVisibility(View.VISIBLE);
|
||||
@ -2230,6 +2241,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
} else {
|
||||
String userID3 = (String) imageGrade3.getTag();
|
||||
|
||||
detailsLinearLayout1.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout2.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout3.setVisibility(View.VISIBLE);
|
||||
detailsLinearLayout4.setVisibility(View.VISIBLE);
|
||||
|
||||
linearGrade1.setVisibility(View.VISIBLE);
|
||||
linearGrade2.setVisibility(View.VISIBLE);
|
||||
linearGrade3.setVisibility(View.VISIBLE);
|
||||
|
@ -2,6 +2,7 @@ package com.yunbao.live.socket;
|
||||
|
||||
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
|
||||
import static com.blankj.utilcode.util.ViewUtils.runOnUiThread;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
|
||||
import static com.yunbao.common.Constants.isAnchor;
|
||||
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
|
||||
@ -89,9 +90,13 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.agora.beautyapi.faceunity.agora.SWManager;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.IRongCoreCallback;
|
||||
import io.rong.imlib.IRongCoreEnum;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.chatroom.base.RongChatRoomClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class SocketRyClient {
|
||||
|
||||
@ -1283,7 +1288,8 @@ public class SocketRyClient {
|
||||
u.setId(map.getString("uid"));
|
||||
u.setUserNiceName(map.getString("pkname"));
|
||||
u.setAvatar(map.getString("pkhead"));
|
||||
mListener.onLinkMicPkApply(u, map.getString("stream"), 1);
|
||||
u.setRandomPk("11".equals(map.getString("msgtype")));
|
||||
mListener.onLinkMicPkApply(u, map.getString("stream"), "11".equals(map.getString("msgtype"))?2:1);
|
||||
break;
|
||||
case 2://收到对方主播PK回调
|
||||
L.eSw("收到对方主播PK回调");
|
||||
@ -1293,6 +1299,8 @@ public class SocketRyClient {
|
||||
if (livePushRyViewHolder != null) {
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setId(map.getString("uid"));
|
||||
userBean.setAvatar(map.getString("pkhead"));
|
||||
userBean.setUserNiceName(map.getString("pkname"));
|
||||
livePushRyViewHolder.setAnPkRtc(userBean);
|
||||
}
|
||||
break;
|
||||
@ -1339,7 +1347,38 @@ public class SocketRyClient {
|
||||
}
|
||||
break;
|
||||
case 10://系统发起PK回调
|
||||
JSONObject msg1 = new JSONObject();
|
||||
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", CommonAppConfig.getInstance().getUid())
|
||||
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.create();
|
||||
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(map.getString("uid"), 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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*JSONObject msg1 = new JSONObject();
|
||||
msg1.put("type", "autoLivePK");
|
||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||
@ -1377,7 +1416,7 @@ public class SocketRyClient {
|
||||
ToastUtil.show("invite " + map.getString("uid") + " lose :" + rtcErrorCode);
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
@ -58,6 +59,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.bean.DrPkbean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -93,6 +95,10 @@ import cn.rongcloud.rtc.base.RCRTCStreamType;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import cn.rongcloud.rtc.core.RendererCommon;
|
||||
import io.agora.beautyapi.faceunity.agora.SWAuManager;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@ -1066,6 +1072,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
//将当前主播画面换个画布展示
|
||||
String pkUid = (String) event.getObject();
|
||||
setPkView(pkUid);
|
||||
|
||||
} else if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_PK_END) {
|
||||
String pkUid = (String) event.getObject();
|
||||
//endpk(pkUid);
|
||||
@ -1085,7 +1092,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
joinLiveMic();
|
||||
return;
|
||||
}
|
||||
RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
|
||||
/*RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
|
||||
// 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO
|
||||
.setRoomType(RCRTCRoomType.LIVE_AUDIO_VIDEO).setLiveRole(RCRTCLiveRole.AUDIENCE).build();
|
||||
RCRTCEngine.getInstance().joinRoom(LiveActivity.mLiveUid, roomConfig, new IRCRTCResultDataCallback<RCRTCRoom>() {
|
||||
@ -1120,7 +1127,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
}
|
||||
|
@ -589,6 +589,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
}
|
||||
|
||||
public void setAnPkRtc(UserBean u) {
|
||||
EventBus.getDefault().post(new AnchorInfoEvent(false, u.getId(), u.getUserNiceName(), u.getAvatar()));
|
||||
if (swManager != null && u != null) {
|
||||
//将多人pk画面屏蔽
|
||||
dr_pk_view.setVisibility(View.GONE);
|
||||
@ -617,8 +618,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
||||
.param("action", 4)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("pkuid", u.getId())
|
||||
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.create();
|
||||
|
||||
@ -646,6 +648,8 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mLiveRyLinkMicPkPresenter.setPkUserInfoView(u);
|
||||
}
|
||||
|
||||
private int currentPosition = 0;
|
||||
|
@ -181,6 +181,7 @@ import com.yunbao.live.dialog.ReceiveRendPacketPopup;
|
||||
import com.yunbao.live.dialog.ResultRendPacketPopup;
|
||||
import com.yunbao.live.event.LiveAnchorEvent;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LivePKRightUserInfoEvent;
|
||||
import com.yunbao.live.presenter.LiveDanmuPresenter;
|
||||
import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
|
||||
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
|
||||
@ -3037,6 +3038,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
public boolean pkHandler = true;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void setOtherInfo(LivePKRightUserInfoEvent livePKRightUserInfoEvent){
|
||||
setOtherInfo(livePKRightUserInfoEvent.getUid(),livePKRightUserInfoEvent.getuHead(),livePKRightUserInfoEvent.getuName());
|
||||
}
|
||||
|
||||
//左上角显示对方主播头像及昵称
|
||||
public void setOtherInfo(String touids, String url, String name) {
|
||||
if (!pkHandler) {
|
||||
|
@ -114,12 +114,32 @@
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/pk_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="270dp"
|
||||
android:layout_marginTop="130dp">
|
||||
<com.yunbao.live.custom.MyFrameLayout4
|
||||
android:id="@+id/left_container"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
<com.yunbao.live.custom.MyFrameLayout4
|
||||
android:id="@+id/right_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/goto_room_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="27dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="122dp"
|
||||
android:layout_marginTop="135dp"
|
||||
android:layout_marginRight="9dp"
|
||||
android:background="@drawable/bg_live_other_ico"
|
||||
android:gravity="center"
|
||||
@ -155,25 +175,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/pk_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="270dp"
|
||||
android:layout_marginTop="130dp">
|
||||
<com.yunbao.live.custom.MyFrameLayout4
|
||||
android:id="@+id/left_container"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
<com.yunbao.live.custom.MyFrameLayout4
|
||||
android:id="@+id/right_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_close"
|
||||
|
Loading…
Reference in New Issue
Block a user