add[声望升级-单人pk,进入直播间逻辑,单人PK逻辑]

This commit is contained in:
Martin 2024-04-25 14:13:25 +08:00
parent 8228c45a4d
commit 9320d6c209
17 changed files with 579 additions and 236 deletions

View File

@ -90,7 +90,6 @@ public class SWAuManager extends BaseCacheManager {
mRtcEngine.setupRemoteVideo(videoCanvas); mRtcEngine.setupRemoteVideo(videoCanvas);
} }
/** /**
* 加入房间 * 加入房间
*/ */
@ -155,6 +154,65 @@ public class SWAuManager extends BaseCacheManager {
}); });
} }
/**
* PK-加入对方主播直播间
* @param strUid
* @param token
* @param toUid
* @param channelName
*/
public void joinChannelDrEx(FrameLayout frameLayout,String strUid, String token, String toUid, String channelName) {
int tempUid;
if (StringUtil.isEmpty(strUid)) {
tempUid = 0;
} else {
tempUid = Integer.parseInt(strUid);
}
// 创建 ChannelMediaOptions 对象并进行配置
ChannelMediaOptions options = new ChannelMediaOptions();
// 根据场景将用户角色设置为 AUDIENCE (观众)
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
options.autoSubscribeVideo = true;
options.autoSubscribeAudio = true;
options.publishMicrophoneTrack = false;
options.publishCameraTrack = false;
RtcConnection rtcConnection = new RtcConnection();
rtcConnection.channelId = channelName; //對方主播的頻道
rtcConnection.localUid = tempUid;//自己的ID
L.eSw("strUid:" + tempUid + "_token:" + token + "_channelName:" + channelName);
mRtcEngine.joinChannelEx(token, rtcConnection, options, new IRtcEngineEventHandler() {
@Override
public void onJoinChannelSuccess(String channel, int scUid, int elapsed) {
super.onJoinChannelSuccess(channel, scUid, elapsed);
L.eSw("onJoinChannelSuccess:" + channel + " uid " + scUid + " elapsed: " + elapsed);
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_FIT,Integer.parseInt(toUid));
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
}
});
}
@Override
public void onLeaveChannel(RtcStats stats) {
super.onLeaveChannel(stats);
}
@Override
public void onError(int err) {
super.onError(err);
L.eSw("onError:" + err);
}
});
}
/** /**
* 退出对方直播间 * 退出对方直播间
* @param uid 自己的ID * @param uid 自己的ID

View File

@ -134,6 +134,8 @@ public class SWManager extends BaseCacheManager {
faceUnityBeautyAPI.setupLocalVideo(surfaceView, Constants.RENDER_MODE_HIDDEN); faceUnityBeautyAPI.setupLocalVideo(surfaceView, Constants.RENDER_MODE_HIDDEN);
//faceUnityBeautyAPI.updateCameraConfig(new CameraConfig(MirrorMode.MIRROR_NONE,MirrorMode.MIRROR_NONE)); //faceUnityBeautyAPI.updateCameraConfig(new CameraConfig(MirrorMode.MIRROR_NONE,MirrorMode.MIRROR_NONE));
//mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid)); //mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid));
setEnableBeauty(true); //默认开启美颜
} }
public void setEnableBeauty(boolean flag){ public void setEnableBeauty(boolean flag){
@ -279,26 +281,6 @@ public class SWManager extends BaseCacheManager {
}); });
} }
/**
* 更新主播视图
* @param frameLayout
* @param channelName 對方直播間通道
* @param toUid 對方主播uid
*/
public void updateDrChannelView(FrameLayout frameLayout,String channelName,String toUid) {
mRtcEngine.setupLocalVideo(null);
RtcConnection rtcConnection = new RtcConnection();
rtcConnection.channelId = channelName; //對方主播的頻道
rtcConnection.localUid = Integer.parseInt(CommonAppConfig.getInstance().getUid());//自己的ID
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_FIT,Integer.parseInt(toUid));
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
}
/** /**
* PK-加入对方主播直播间 * PK-加入对方主播直播间

View File

@ -1000,6 +1000,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
//多人PK接受 //多人PK接受
@Override @Override
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk(UserBean u)");
if (mLiveLinkMicPkPresenter != null) { if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkDRMicPkApplyOk(u); mLiveLinkMicPkPresenter.onLinkDRMicPkApplyOk(u);
} }

View File

@ -31,6 +31,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView; import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.enums.PopupPosition;
@ -566,7 +567,9 @@ public class LiveAudienceActivity extends LiveActivity {
@Override @Override
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk:"+u.getId());
//多人PK 连麦
manager.getmLivePlayViewHolder().setDrMicInfo(u);
} }
@Override @Override
@ -1446,7 +1449,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (manager.getmLivePlayViewHolder() != null) { if (manager.getmLivePlayViewHolder() != null) {
manager.getmLivePlayViewHolder().setPkEndview(); manager.getmLivePlayViewHolder().setPkEndview();
manager.setPkStatus(false); manager.setPkStatus(false);
manager.mLivePlayViewHolder.endPk();
} }
if (manager != null) { if (manager != null) {
manager.removeDetailView(); manager.removeDetailView();

View File

@ -222,27 +222,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
Bus.getOn(this); Bus.getOn(this);
Intent intent = getIntent(); Intent intent = getIntent();
initFaceManager(); initFaceManager();
RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
@Override
public void onConnectionStats(StatusReport statusReport) {
//视频发送信息
for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
StatusBean statusBean = entry.getValue();
//获取userID
String userId = statusBean.uid;
//获取视频 宽x高@帧率
String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
//获取码率
long bitRate = statusBean.bitRate;
//丢包率
long lossRate = statusBean.packetLostRate;
//带宽
String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth;
// Log.e("网速和内存", "获取视频:" + resolution + " 丢包率:" + lossRate + " 带宽:" + googAvailableSendBandwidth);
}
}
});
leave_img = findViewById(R.id.leave_img); leave_img = findViewById(R.id.leave_img);
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG); mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -1452,6 +1431,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
//多人PK接受 //多人PK接受
@Override @Override
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk111111");
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApplyOk(u); mLiveRyLinkMicPkPresenter.onLinkDRMicPkApplyOk(u);
} }
@ -1712,7 +1692,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
break; break;
case DISCONNEXT_PK_TIME: case DISCONNEXT_PK_TIME:
if (mLivePushViewHolder != null) { if (mLivePushViewHolder != null) {
mLivePushViewHolder.changeToBig(); //mLivePushViewHolder.changeToBig();
mLivePushViewHolder.anchorClose();
mLiveRyLinkMicPkPresenter.leaveDRRoom(); mLiveRyLinkMicPkPresenter.leaveDRRoom();
} }
break; break;

View File

@ -29,6 +29,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
@ -357,6 +358,8 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
*/ */
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("public void onLinkDRMicPkApplyOk(UserBean u) {");
user.add(u); user.add(u);
Log.i("1111", "12222222a" + user.size()); Log.i("1111", "12222222a" + user.size());
mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud(); mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();

View File

@ -29,6 +29,7 @@ import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
@ -99,6 +100,7 @@ import cn.rongcloud.rtc.base.RCRTCMediaType;
import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RCRTCStream; import cn.rongcloud.rtc.base.RCRTCStream;
import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback; import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -515,9 +517,31 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 主播与主播PK 主播收到其他主播发过来的多人PK申请同意了的回调 * 主播与主播PK 主播收到其他主播发过来的多人PK申请同意了的回调
*/ */
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk(UserBean u) " + u.getUserNiceName());
int index = 0;
if (livePushRyViewHolder != null) { if (livePushRyViewHolder != null) {
livePushRyViewHolder.setAnDrPkRtc(String.valueOf(u.getId()), -1); livePushRyViewHolder.setAnDrPkRtc(String.valueOf(u.getId()), -1);
} }
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", CommonAppConfig.getInstance().getUid()).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);
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));
}
dRjoinOtherRoom(drPkbeans);
}
}
});
} }
/** /**
@ -815,79 +839,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
} }
}); });
livePushRyViewHolder.exitChannelDrPk(drPkbeans);
for (int i = 0; i < inputStreamList.size(); i++) { leaveHandler.removeCallbacks(leaveRunnable);
Log.e("ry", "退出多人ID" + inputStreamList.get(i).getUserId());
//退出副房间
RCRTCEngine.getInstance().leaveOtherRoom(inputStreamList.get(i).getUserId(), true, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
Log.e("ry", "退出多人成功");
}
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", "退出多人失败" + rtcErrorCode);
}
});
}
RCRTCMixConfig config = new RCRTCMixConfig();
RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig();
config.setMediaConfig(mediaConfig);
//视频输出配置
RCRTCMixConfig.MediaConfig.VideoConfig videoConfig = new RCRTCMixConfig.MediaConfig.VideoConfig();
mediaConfig.setVideoConfig(videoConfig);
//大流视频的输出参数
RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout normal = new RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout();
videoConfig.setVideoLayout(normal);
//推荐宽帧率参数值可以通过默认视频流的配置获取也可以根据实际需求来自定义设置
//如不设置宽高值则服务端将使用默认宽高 360 * 640
//:发布的视频分辨率为720 * 1280如果不设置则观众端看到的视频分辨率为 360 * 640,
//所以如果想让观众端看到的视频分辨率和发布视频分辨率一致则应从发布的视频流中获取分辨率配置并设置到 mediaConfig
RCRTCVideoStreamConfig defaultVideoConfig = RCRTCEngine.getInstance().getDefaultVideoStream().getVideoConfig();
int fps = defaultVideoConfig.getVideoFps().getFps();
int width = 720;
int height = 1280;
normal.setWidth(width); //视频宽
normal.setHeight(height); //视频高
normal.setFps(fps); //视频帧率
//2. 合流画布设置
//(请参照画布和声音配置示例代码)
//3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准)设置每个视频流小窗口的坐标及宽高
ArrayList<RCRTCMixConfig.CustomLayoutList.CustomLayout> list = new ArrayList<>();
config.setCustomLayouts(list);
//user1的视频流
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
list.add(videoLayout1);
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
videoLayout1.setX(0); //X 坐标
videoLayout1.setY(0); //Y 坐标
videoLayout1.setWidth(720); // 视频窗口的宽
videoLayout1.setHeight(1280); // 视频窗口的高
//2. 合流画布设置
if (rcrtcLiveInfo != null) {
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
Log.e("ry", "混成功15");
}
@Override
public void onFailed(RTCErrorCode errorCode) {
Log.e("ry", "混失败" + errorCode);
}
});
}
leaveHandler.post(leaveRunnable);
} }
private Handler leaveHandler = new Handler(Looper.getMainLooper()); private Handler leaveHandler = new Handler(Looper.getMainLooper());
@ -895,15 +848,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void run() { public void run() {
//恢复全屏画面 //恢复全屏画面
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.topMargin = 0;
livePushRyViewHolder.camera.setLayoutParams(params);
livePushRyViewHolder.dr_pk_view.setVisibility(View.GONE); livePushRyViewHolder.dr_pk_view.setVisibility(View.GONE);
inputStreamList.clear();
inputStreamList1.clear();
//删除之前其他主播的画面 //删除之前其他主播的画面
livePushRyViewHolder.dr1_preview.removeAllViews(); livePushRyViewHolder.dr1_preview.removeAllViews();
livePushRyViewHolder.dr2_preview.removeAllViews();
livePushRyViewHolder.dr3_preview.removeAllViews(); livePushRyViewHolder.dr3_preview.removeAllViews();
livePushRyViewHolder.dr4_preview.removeAllViews();
livePushRyViewHolder.cameraPreview3.removeAllViews(); livePushRyViewHolder.cameraPreview3.removeAllViews();
leaveHandler.removeCallbacks(leaveRunnable); leaveHandler.removeCallbacks(leaveRunnable);
livePushRyViewHolder.timeTitle.setVisibility(View.GONE); livePushRyViewHolder.timeTitle.setVisibility(View.GONE);
@ -1027,6 +977,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LiveNetManager.get(mContext).setBanRandomPK(null); LiveNetManager.get(mContext).setBanRandomPK(null);
} }
/** /**
* 显示申请多人PK的弹窗 * 显示申请多人PK的弹窗
*/ */
@ -1078,16 +1029,21 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
JSONObject obj = JSONObject.parseObject(info[0]); JSONObject obj = JSONObject.parseObject(info[0]);
drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class); drPkbeans = JSONObject.parseArray(obj.getString("userlist"), DrPkbean.class);
//将自己从多人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));
}
for (int i = 0; i < drPkbeans.size(); i++) { for (int i = 0; i < drPkbeans.size(); i++) {
if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) { if (!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeans.get(i).getId()))) {
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LIVE_DRPK).param("action", 2).param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", drPkbeans.get(i).getId()).param("uid", CommonAppConfig.getInstance().getUid()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
.param("_method_", SOCKET_LIVE_DRPK)
.param("action", 2)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", drPkbeans.get(i).getId())
.param("uid", CommonAppConfig.getInstance().getUid())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
msg1.create(); msg1.create();
String targetId = "g" + drPkbeans.get(i).getId(); String targetId = "g" + drPkbeans.get(i).getId();
@ -1114,12 +1070,13 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
ToastUtil.show(errorCode.code + ":" + errorCode.msg); ToastUtil.show(errorCode.code + ":" + errorCode.msg);
} }
}); });
//dRjoinOtherRoom(u.getId(), 1); //
livePushRyViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()),i+2); int index = livePushRyViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
L.eSw("onLinkDRMicPkApplyOk(UserBean u)-点击接收 " + u.getUserNiceName());
} }
} }
dRjoinOtherRoom(drPkbeans);
/*for (int i = 0; i < users.size(); i++) { /*for (int i = 0; i < users.size(); i++) {
JSONObject user = users.getJSONObject(i); JSONObject user = users.getJSONObject(i);
@ -1264,42 +1221,26 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
//多人PK接受申请画 加入副房间 //多人PK接受申请画 加入副房间
public void dRjoinOtherRoom(String uid, int i) { public void dRjoinOtherRoom(List<DrPkbean> drPkbeanList) {
Log.e("ry", uid + "洒洒" + i + "VVVV" + i); L.eSw("dRjoinOtherRoom:size:" + drPkbeanList.size() + " json " + new Gson().toJson(drPkbeanList));
mApplyUid = uid; if (drPkbeanList.size() == 1) {
/*new Handler(Looper.getMainLooper()).post(new Runnable() { String uid = String.valueOf(drPkbeanList.get(0).getId());
public void run() {
//把多人PK的View显示出来
if (livePushRyViewHolder.dr_pk_view.getVisibility() == View.GONE) {
livePushRyViewHolder.dr_pk_view.setVisibility(View.VISIBLE);
livePushRyViewHolder.dr1_preview.setVisibility(View.GONE);
livePushRyViewHolder.dr2_preview.setVisibility(View.GONE);
livePushRyViewHolder.dr3_preview.setVisibility(View.GONE);
livePushRyViewHolder.dr4_preview.setVisibility(View.GONE);
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
imageGrade1.setTag(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
livePushRyViewHolder.mPreView.addView(detailsView1);
detailsLinearLayout1.setVisibility(View.VISIBLE);
linearGrade1.setVisibility(View.GONE);
}
//设置多人PK数据 //设置多人PK数据
LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() { LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override @Override
public void onSuccess(LiveInfoModel data) { public void onSuccess(LiveInfoModel data) {
if(detailsView2!=null){
livePushRyViewHolder.dr2_preview.removeView(detailsView2);
}
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2); detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2); linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2); textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
imageGrade2 = detailsView2.findViewById(R.id.image_grade2); imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
textGrade2 = detailsView2.findViewById(R.id.text_grade2); textGrade2 = detailsView2.findViewById(R.id.text_grade2);
imageGrade2.setTag(String.valueOf(uid)); imageGrade2.setTag(uid);
textPkName2.setText(data.getUserNicename()); textPkName2.setText(data.getUserNicename());
livePushRyViewHolder.dr1_preview.addView(detailsView2); livePushRyViewHolder.dr2_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.VISIBLE); detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.GONE); linearGrade2.setVisibility(View.GONE);
} }
@ -1310,10 +1251,186 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
}); });
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
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);
linearGrade1.setVisibility(View.GONE);
Log.e("ry", "多人接受成功" + uid);
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
} else if (drPkbeanList.size() == 2) {
String uid1 = String.valueOf(drPkbeanList.get(0).getId());
String uid2 = String.valueOf(drPkbeanList.get(1).getId());
//设置多人PK数据
LiveNetManager.get(mContext).getLiveInfo(uid1, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
if(detailsView2!=null){
livePushRyViewHolder.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(uid1);
textPkName2.setText(data.getUserNicename());
livePushRyViewHolder.dr2_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
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);
linearGrade1.setVisibility(View.GONE);
LiveNetManager.get(mContext).getLiveInfo(uid2, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
if(detailsView4!=null){
livePushRyViewHolder.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(uid2);
textPkName4.setText(data.getUserNicename());
livePushRyViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.GONE);
L.eSw("第三个主播的名称 数据加载完成"+detailsLinearLayout4.getVisibility());
L.eSw("detailsLinearLayout4.getVisibility()"+detailsLinearLayout4.getVisibility());
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
} else if (drPkbeanList.size() == 3) {
String uid1 = String.valueOf(drPkbeanList.get(0).getId());
String uid2 = String.valueOf(drPkbeanList.get(1).getId());
String uid3 = String.valueOf(drPkbeanList.get(2).getId());
//设置多人PK数据
LiveNetManager.get(mContext).getLiveInfo(uid1, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
if(detailsView2!=null){
livePushRyViewHolder.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(uid1);
textPkName2.setText(data.getUserNicename());
livePushRyViewHolder.dr2_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.GONE);
L.eSw("detailsLinearLayout2.getVisibility()"+detailsLinearLayout2.getVisibility());
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
detailsView1 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout1 = detailsView1.findViewById(R.id.lin_pk1);
linearGrade1 = detailsView1.findViewById(R.id.linear_grade1);
imageGrade1 = detailsView1.findViewById(R.id.image_grade1);
textGrade1 = detailsView1.findViewById(R.id.text_grade1);
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);
linearGrade1.setVisibility(View.GONE);
LiveNetManager.get(mContext).getLiveInfo(uid2, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
if(detailsView2!=null){
livePushRyViewHolder.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(uid2);
textPkName3.setText(data.getUserNicename());
livePushRyViewHolder.dr3_preview.addView(detailsView3);
detailsLinearLayout3.setVisibility(View.VISIBLE);
linearGrade3.setVisibility(View.GONE);
L.eSw("detailsLinearLayout3.getVisibility()"+detailsLinearLayout3.getVisibility());
L.eSw("第三个主播的名称 数据加载完成");
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
LiveNetManager.get(mContext).getLiveInfo(uid3, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
if(detailsView4!=null){
livePushRyViewHolder.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(uid3);
textPkName4.setText(data.getUserNicename());
livePushRyViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.GONE);
L.eSw("detailsLinearLayout4.getVisibility()"+detailsLinearLayout4.getVisibility());
L.eSw("第四个主播的名称 数据加载完成");
}
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
Log.e("ry", "多人接受成功" + mApplyUid); Log.e("ry", "多人接受成功" + mApplyUid);
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success"); ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
} }
});*/
} }
/** /**
@ -2008,6 +2125,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 更新Pk分数 * 更新Pk分数
*/ */
public void upDataPkScore(JSONArray pkScores, String uid, int time) { public void upDataPkScore(JSONArray pkScores, String uid, int time) {
L.eSw("更新Pk分数 upDataPkScore time:" + time + " " + pkScores);
String userID1 = (String) imageGrade1.getTag(); String userID1 = (String) imageGrade1.getTag();
String userID2 = (String) imageGrade2.getTag(); String userID2 = (String) imageGrade2.getTag();
String userID4 = (String) imageGrade4.getTag(); String userID4 = (String) imageGrade4.getTag();
@ -2025,7 +2143,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
mHandler.sendEmptyMessage(WHAT_PK_TIME2); mHandler.sendEmptyMessage(WHAT_PK_TIME2);
} }
} }
int pkScoreSize = pkScores.size(); int pkScoreSize = pkScores.size();
if (pkScoreSize == 3) { if (pkScoreSize == 3) {

View File

@ -312,6 +312,7 @@ public class SocketRyClient {
UserBean u = new UserBean(); UserBean u = new UserBean();
// u.setUserNiceName(map.getString("uname")); // u.setUserNiceName(map.getString("uname"));
u.setId(map.getString("uid")); u.setId(map.getString("uid"));
L.eSw("action3 == 2:"+u.getId());
mListener.onLinkDRMicPkApplyOk(u); mListener.onLinkDRMicPkApplyOk(u);
} else if (action3 == 6) {//开始Pk } else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
@ -334,7 +335,6 @@ public class SocketRyClient {
} else { } else {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); // LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW)); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW));
} }
//創建了多人房間 //創建了多人房間
} else if (action3 == 3) { } else if (action3 == 3) {

View File

@ -11,15 +11,25 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.tencent.live2.V2TXLiveDef; import com.tencent.live2.V2TXLiveDef;
import com.tencent.live2.V2TXLivePlayer; import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.DrPkbean;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by cxf on 2018/10/10. * Created by cxf on 2018/10/10.
@ -48,7 +58,6 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
public static int landscape; //1h 2s public static int landscape; //1h 2s
public static Context contexts; public static Context contexts;
int screenWidth; // 屏幕宽像素480px int screenWidth; // 屏幕宽像素480px
int screenHeight; // 屏幕高像素800p int screenHeight; // 屏幕高像素800p
@ -254,6 +263,10 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
} }
} }
@Override
public void setDrMicInfo(UserBean u) {
}
@Override @Override
public void setLiveBeanLandscape(int landscape) { public void setLiveBeanLandscape(int landscape) {
LivePlayKsyViewHolder.landscape =landscape; LivePlayKsyViewHolder.landscape =landscape;

View File

@ -19,13 +19,16 @@ import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.video.VideoSize; import com.google.android.exoplayer2.video.VideoSize;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView; import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback; import com.lxj.xpopup.interfaces.XPopupCallback;
@ -33,6 +36,7 @@ import com.lzf.easyfloat.EasyFloat;
import com.lzy.okserver.OkDownload; import com.lzy.okserver.OkDownload;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.LiveFontSizeSettingDialog; import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
@ -51,6 +55,7 @@ import com.yunbao.common.views.LiveClarityCustomPopup;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -130,6 +135,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
SWAuManager swAuManager; SWAuManager swAuManager;
String liveUid; String liveUid;
private LinearLayout dr_pk_view;
private FrameLayout dr1_preview;
private FrameLayout dr2_preview;
private FrameLayout dr3_preview;
private FrameLayout dr4_preview;
public int getLandscape() { public int getLandscape() {
return landscape; return landscape;
} }
@ -175,6 +186,13 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
debugView = new TextView(mContext); debugView = new TextView(mContext);
debugView.setBackgroundColor(Color.WHITE); debugView.setBackgroundColor(Color.WHITE);
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview);
dr2_preview = (FrameLayout) findViewById(R.id.dr2_preview);
dr3_preview = (FrameLayout) findViewById(R.id.dr3_preview);
dr4_preview = (FrameLayout) findViewById(R.id.dr4_preview);
dr_pk_view.setVisibility(View.GONE);
} }
public void initSwEngine(String liveUid) { public void initSwEngine(String liveUid) {
@ -188,6 +206,80 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, SWAuManager.getChannelName(liveUid)); swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, SWAuManager.getChannelName(liveUid));
} }
/**
* 开启单人PK
* @param Uid
*/
public void setPkView(String Uid) {
swAuManager.updateMyChannelView((FrameLayout) mLeftContainer, Integer.parseInt(liveUid));
ry_view.removeAllViews();
//加入对方主播房间
swAuManager.setPkContainer1((FrameLayout) mRightContainer);
swAuManager.joinExRoomEx(Integer.parseInt(Uid), CommonAppConfig.SWToken, SWAuManager.getChannelName(Uid));
}
List<UserBean> drMicUserList = new ArrayList<>();
boolean isAdd = true;
@Override
public void setDrMicInfo(UserBean u) {
L.eSw("setDrMicInfo:"+u.getId()+" drMicUserList:"+new Gson().toJson(drMicUserList));
for (int i = 0; i <drMicUserList.size(); i++) {
if(u.getId().equals(drMicUserList.get(i).getId())){
isAdd = false;
}
}
//加载多人PK(连麦)主播视图
if(isAdd){
dr_pk_view.setVisibility(View.VISIBLE);
drMicUserList.add(u);
if(drMicUserList.size()==1){
ry_view.removeAllViews();
swAuManager.updateMyChannelView((FrameLayout) dr1_preview, Integer.parseInt(liveUid));
swAuManager.joinChannelDrEx(dr2_preview,CommonAppConfig.getInstance().getUid(),CommonAppConfig.SWToken, u.getId(),SWAuManager.getChannelName(u.getId()));
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.GONE);
}else if(drMicUserList.size()==2){
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.VISIBLE);
swAuManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(),CommonAppConfig.SWToken, u.getId(),SWAuManager.getChannelName(u.getId()));
}else if(drMicUserList.size()==3){
dr4_preview.setVisibility(View.VISIBLE);
swAuManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drMicUserList.get(1).getId());
swAuManager.joinChannelDrEx(dr3_preview,CommonAppConfig.getInstance().getUid(),CommonAppConfig.SWToken, drMicUserList.get(1).getId(),SWAuManager.getChannelName(drMicUserList.get(1).getId()));
swAuManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(),CommonAppConfig.SWToken, drMicUserList.get(2).getId(),SWAuManager.getChannelName(drMicUserList.get(2).getId()));
}
}
}
/**
* 退出单人pk
* @param pkUid
*/
public void endpk(String pkUid) {
swAuManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), SWAuManager.getChannelName(pkUid));
swAuManager.updateMyChannelView(ry_view, Integer.parseInt(liveUid));
mLeftContainer.removeAllViews();
mRightContainer.removeAllViews();
}
/**
* 退出所有连麦主播的房間
*/
public void endPk(){
dr_pk_view.setVisibility(View.GONE);
dr1_preview.removeAllViews();
dr2_preview.removeAllViews();
dr3_preview.removeAllViews();
dr4_preview.removeAllViews();
//退出所有连麦主播的房間
for (int i = 0; i <drMicUserList.size(); i++) {
swAuManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drMicUserList.get(i).getId());
}
//將當前主播畫面放大
swAuManager.updateMyChannelView((FrameLayout) ry_view, Integer.parseInt(liveUid));
}
@Override @Override
public void hideCover() { public void hideCover() {
// if (mCover != null) { // if (mCover != null) {
@ -414,11 +506,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public void setViewUP(int i) { public void setViewUP(int i) {
if (mVideoView == null) return; if (mVideoView == null) return;
Log.e("PK状态", "" + i); Log.e("PK状态", "" + i);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
params.height = vHeight;
params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top);
params.addRule(RelativeLayout.ALIGN_TOP);
mVideoView.requestLayout();
/*RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); /*RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams();
params1.height = vHeight; params1.height = vHeight;
@ -530,6 +618,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
// } // }
} }
public void removeDetailView() { public void removeDetailView() {
// if (detailsView != null) { // if (detailsView != null) {
// mVideoView.removeView(detailsView); // mVideoView.removeView(detailsView);
@ -859,22 +948,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}).showDialog(); }).showDialog();
} else if (event.getType() == LiveAudienceEvent.LiveAudienceType.PK_TWO_START) { } else if (event.getType() == LiveAudienceEvent.LiveAudienceType.PK_TWO_START) {
//将当前主播画面换个画布展示 //将当前主播画面换个画布展示
swAuManager.updateMyChannelView((FrameLayout) mLeftContainer, Integer.parseInt(liveUid));
ry_view.removeAllViews();
//加入对方主播房间
swAuManager.setPkContainer1((FrameLayout) mRightContainer);
String pkUid = (String) event.getObject(); String pkUid = (String) event.getObject();
swAuManager.joinExRoomEx(Integer.parseInt(pkUid), CommonAppConfig.SWToken, SWAuManager.getChannelName(pkUid)); setPkView(pkUid);
} else if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_PK_END) { } else if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_PK_END) {
String pkUid = (String) event.getObject(); String pkUid = (String) event.getObject();
swAuManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), SWAuManager.getChannelName(pkUid)); //endpk(pkUid);
swAuManager.updateMyChannelView(ry_view, Integer.parseInt(liveUid));
mLeftContainer.removeAllViews();
mRightContainer.removeAllViews();
} }
} }
/** /**
* 把观众转换成主播 * 把观众转换成主播
*/ */

View File

@ -18,6 +18,7 @@ import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ITXLivePlayListener; import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.TXLivePlayConfig; import com.tencent.rtmp.TXLivePlayConfig;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
@ -69,6 +70,11 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
} }
@Override
public void setDrMicInfo(UserBean u) {
}
@Override @Override
public void setLiveBeanLandscape(int landscape) { public void setLiveBeanLandscape(int landscape) {
} }

View File

@ -18,6 +18,7 @@ import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.TXLivePlayConfig; import com.tencent.rtmp.TXLivePlayConfig;
import com.tencent.rtmp.TXLivePlayer; import com.tencent.rtmp.TXLivePlayer;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
@ -66,6 +67,11 @@ public class LivePlayTxViewHolder_backup extends LiveRoomPlayViewHolder implemen
} }
@Override
public void setDrMicInfo(UserBean u) {
}
@Override @Override
public void setLiveBeanLandscape(int landscape) { public void setLiveBeanLandscape(int landscape) {

View File

@ -56,6 +56,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.http.LiveHttpConsts; import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
@ -284,7 +285,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), true, true, "LiveDRPK1", new IRCRTCResultCallback() { rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), true, true, "LiveDRPK1", new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(), 2); //mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(), 2);
} }
@Override @Override
@ -380,7 +381,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} else if (agree == true && extra.equals(SOCKET_LIVE_DRPK)) { } else if (agree == true && extra.equals(SOCKET_LIVE_DRPK)) {
mLiveRyLinkMicPkPresenter.onDRLinkMicToPk(inviteeRoomId); mLiveRyLinkMicPkPresenter.onDRLinkMicToPk(inviteeRoomId);
} else if (extra.equals("LiveDRPK1")) { } else if (extra.equals("LiveDRPK1")) {
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId, 3); //mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId, 3);
} else { } else {
Log.e("ry", extra); Log.e("ry", extra);
UserBean userBean1 = new UserBean(); UserBean userBean1 = new UserBean();
@ -575,6 +576,14 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
}); });
} }
public void exitChannelDrPk(List<DrPkbean> drPkbeanList){
for (int i = 0; i <drPkbeanList.size(); i++) {
if(!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeanList.get(i).getId()))){
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), String.valueOf(drPkbeanList.get(i).getId()));
}
}
SWManager.get().updateMyChannelView((FrameLayout) mBigContainer);
}
public void setAnPkRtc(UserBean u) { public void setAnPkRtc(UserBean u) {
if (swManager != null && u != null) { if (swManager != null && u != null) {
@ -582,9 +591,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
//将自己的渲染视图设置到 leftContainer //将自己的渲染视图设置到 leftContainer
swManager.updateMyChannelView((FrameLayout) mLeftContainer); swManager.updateMyChannelView((FrameLayout) mLeftContainer);
//清除 mBigContainer 中的渲染 //清除 mBigContainer 中的渲染
mBigContainer.removeAllViews(); mBigContainer.removeAllViews();
btn_close.setVisibility(View.VISIBLE); btn_close.setVisibility(View.VISIBLE);
//设置对方主播的渲染视图 设置到 rightContainer //设置对方主播的渲染视图 设置到 rightContainer
swManager.setPkContainer(mRightContainer); swManager.setPkContainer(mRightContainer);
@ -595,7 +604,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
private int currentPosition = 0; private int currentPosition = 0;
private String drpkUid3 = ""; private String drpkUid3 = "";
public void setAnDrPkRtc(String uid, int position) { public int setAnDrPkRtc(String uid, int position) {
FrameLayout frameLayout = null; FrameLayout frameLayout = null;
int temp= -1; int temp= -1;
if (swManager != null && !StringUtil.isEmpty(uid)) { if (swManager != null && !StringUtil.isEmpty(uid)) {
@ -621,11 +630,10 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
break; break;
case 4: case 4:
dr3_preview.setVisibility(View.VISIBLE); dr3_preview.setVisibility(View.VISIBLE);
//將f3->f4 f4->f3 //先退出这个主播的直播间在进入该直播间视图问题暂时找不到解决方案
dr3_preview.removeAllViews(); swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drpkUid3);
swManager.updateDrChannelView(dr3_preview,SWAuManager.getChannelName(drpkUid3),drpkUid3); swManager.joinChannelDrEx(dr3_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3));
dr4_preview.removeAllViews();
frameLayout = dr4_preview; frameLayout = dr4_preview;
break; break;
} }
@ -635,18 +643,23 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
mBigContainer.removeAllViews(); mBigContainer.removeAllViews();
} }
swManager.joinChannelDrEx(frameLayout,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid)); swManager.joinChannelDrEx(frameLayout,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
btn_close.setVisibility(View.VISIBLE);
dr_pk_view.setVisibility(View.VISIBLE); dr_pk_view.setVisibility(View.VISIBLE);
currentPosition = temp; currentPosition = temp;
} }
return currentPosition;
} }
public void anchorClose(){
swManager.updateMyChannelView((FrameLayout) mBigContainer); //用户主动断开连麦再退出画面
}
public void onLinkMicAnchorClose() { public void onLinkMicAnchorClose() {
swManager.updateMyChannelView((FrameLayout) mBigContainer); //swManager.updateMyChannelView((FrameLayout) mBigContainer); 用户主动断开连麦再退出画面
LivePushRyViewHolder.btn_close.setVisibility(View.GONE); //LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
} }
public void onLinkDRMicPkApply(UserBean userBean) { public void onLinkDRMicPkApply(UserBean userBean) {
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean); mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);

View File

@ -6,6 +6,7 @@ import android.view.ViewGroup;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
@ -70,6 +71,8 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public abstract void setPkEndview(); public abstract void setPkEndview();
public abstract void setDrMicInfo(UserBean u);
public abstract void setLiveBeanLandscape(int landscape); public abstract void setLiveBeanLandscape(int landscape);
public void setLiveBean(LiveBean data) { public void setLiveBean(LiveBean data) {
@ -79,6 +82,17 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public void setViewUP(int i) { public void setViewUP(int i) {
} }
public void setViewPkMic(int uid) {
}
public void setViewPk() {
}
public void setViewDrMic() {
}
public void setViewDrPk() {
}
public OnMicCallback getOnMicCallback() { public OnMicCallback getOnMicCallback() {
return onMicCallback; return onMicCallback;
} }

View File

@ -73,6 +73,7 @@ import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RandomUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
@ -84,6 +85,7 @@ import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.bean.LiveDanMuBean;
@ -150,7 +152,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//侧滑布局 //侧滑布局
// private DrawerLayout drawerLayout; // private DrawerLayout drawerLayout;
//直播间拆分布局 //直播间拆分布局
private LivePlayRyViewHolder mLivePlayViewHolder; public LivePlayRyViewHolder mLivePlayViewHolder;
//头部布局 //头部布局
public LiveRoomViewHolder mLiveRoomViewHolder; public LiveRoomViewHolder mLiveRoomViewHolder;
//底部布局 //底部布局
@ -641,16 +643,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
if (mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) { if (mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) {
//mLivePlayViewHolder.setViewUP(1);
mLivePlayViewHolder.setViewUP(1); mLivePlayViewHolder.setPkView(data.getEnterRoomInfo().getPkinfo().getPkuid());
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.pkHandler = false; mLiveRoomViewHolder.pkHandler = false;
} }
if (mLivePlayViewHolder != null && pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 if (mLivePlayViewHolder != null && pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
mLivePlayViewHolder.setViewUP(2); mLivePlayViewHolder.setPkView(data.getEnterRoomInfo().getPkinfo().getPkuid());
//pk排名数据 //pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
@ -662,7 +663,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveRoomViewHolder != null && pkInfo != null && pkInfo.containsKey("pkuid") && pkInfo.containsKey("pkuimg") && pkInfo.containsKey("pkuname")) { if (mLiveRoomViewHolder != null && pkInfo != null && pkInfo.containsKey("pkuid") && pkInfo.containsKey("pkuimg") && pkInfo.containsKey("pkuname")) {
mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname"));
} }
} }
}; };
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000); linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);
@ -676,7 +676,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.initPkRank(null); mLiveRoomViewHolder.initPkRank(null);
} }
if (mLivePlayViewHolder != null) { if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.setViewUP(3); //mLivePlayViewHolder.setViewUP(3);
mLivePlayViewHolder.setPkView(data.getEnterRoomInfo().getPkinfo().getPkuid());
} }
//pk排名数据 //pk排名数据
@ -693,7 +694,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.initPkRank(null); mLiveRoomViewHolder.initPkRank(null);
} }
if (mLivePlayViewHolder != null) { if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.setViewUP(4); JSONArray array = pkInfo.getJSONArray("userlist");
for (int j = 0; j < array.size(); j++) {
UserBean drPkbean = new UserBean();
JSONObject da = array.getJSONObject(j);
drPkbean.setId(String.valueOf(da.getIntValue("id")));
mLivePlayViewHolder.setDrMicInfo(drPkbean);
}
} }
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
@ -1561,7 +1568,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onLinkDRMicPkApplyOk(UserBean u) { public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk(UserBean u)PortraitLiveManager");
mLivePlayViewHolder.setDrMicInfo(u);
} }
@ -1627,6 +1635,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(landscape); mLivePlayViewHolder.setLiveBeanLandscape(landscape);
mLivePlayViewHolder.endpk(mPkUid);
} }
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setPkStatus(false); ((LiveAudienceActivity) mContext).setPkStatus(false);
@ -2153,6 +2162,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* @param time * @param time
*/ */
public void upDataPkScore(JSONArray pkScores, int time) { public void upDataPkScore(JSONArray pkScores, int time) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
String liveId = mLiveBean.getUid(); String liveId = mLiveBean.getUid();
JSONObject liveModel = null; JSONObject liveModel = null;

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root" android:id="@+id/root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -65,7 +66,61 @@
android:layout_marginBottom="20dp" /> android:layout_marginBottom="20dp" />
</FrameLayout> </FrameLayout>
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr1_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr3_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr2_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr4_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
</LinearLayout>
<com.yunbao.live.custom.MyFrameLayout3 <com.yunbao.live.custom.MyFrameLayout3
android:id="@+id/small_container" android:id="@+id/small_container"

View File

@ -43,7 +43,7 @@
android:layout_height="270dp" android:layout_height="270dp"
android:layout_marginTop="130dp" android:layout_marginTop="130dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible"> android:visibility="gone">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -160,13 +160,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="270dp" android:layout_height="270dp"
android:layout_marginTop="130dp"> android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4 <com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container" android:id="@+id/left_container"
android:layout_marginBottom="20dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="20dp" /> />
<com.yunbao.live.custom.MyFrameLayout4 <com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/right_container" android:id="@+id/right_container"
android:layout_width="0dp" android:layout_width="0dp"