多人Pk开播

This commit is contained in:
18401019693 2022-12-07 17:59:10 +08:00
parent ec59fce097
commit 7ebd935eba
19 changed files with 926 additions and 237 deletions

View File

@ -78,7 +78,6 @@
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<!-- Android11新增 --> <!-- Android11新增 -->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />--> <!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />--> <!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->

View File

@ -965,4 +965,10 @@
<string name="more_settings" translatable="false">更多設置</string> <string name="more_settings" translatable="false">更多設置</string>
<string name="moer">查看更多</string> <string name="moer">查看更多</string>
<string name="gift_way">礼物正在获取中...</string> <string name="gift_way">礼物正在获取中...</string>
<string name="start_pk">開始PK</string>
<string name="number_of_remaining_times">剩餘次數:%s</string>
<string name="confirmed_to_proceed">是否確認進行多人PK確認後扣除1點次數當日剩餘次數: %s</string>
<string name="invite_anchor">邀請\n主播</string>
<string name="end_pk">結束\nPK</string>
<string name="pk_time">時間 %s</string>
</resources> </resources>

View File

@ -4,8 +4,8 @@ ext {
buildToolsVersion: "28.0.3", buildToolsVersion: "28.0.3",
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 31, targetSdkVersion : 31,
versionCode : 310, versionCode : 311,
versionName : "6.4.5" versionName : "6.4.6"
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
@ -27,6 +27,6 @@ ext {
// true表示谷歌支付 false // true表示谷歌支付 false
isGooglePlay : false, isGooglePlay : false,
// //
isUploadLog : true isUploadLog : false
] ]
} }

View File

@ -4,8 +4,6 @@ import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE; import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE; import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk;
@ -22,7 +20,6 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -41,6 +38,8 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MicUserBean;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.NotCancelableDialog; import com.yunbao.common.dialog.NotCancelableDialog;
import com.yunbao.common.event.LoginInvalidEvent; import com.yunbao.common.event.LoginInvalidEvent;
@ -48,16 +47,14 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
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.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.BitmapUtil; import com.yunbao.common.utils.BitmapUtil;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DateFormatUtil; import com.yunbao.common.utils.DateFormatUtil;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.LogUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.MicStatusManager;
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;
@ -66,10 +63,7 @@ import com.yunbao.live.R;
import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MicUserBean;
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment; import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment; import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
import com.yunbao.live.dialog.LiveNewWishListDialogFragment; import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
@ -86,7 +80,6 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LiveMusicViewHolder; import com.yunbao.live.views.LiveMusicViewHolder;
import com.yunbao.live.views.LiveNewReadyRyViewHolder; import com.yunbao.live.views.LiveNewReadyRyViewHolder;
@ -98,9 +91,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.TreeMap;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
@ -260,8 +251,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (code == 0) { if (code == 0) {
JSONObject obj = JSONObject.parseObject(info[0]); JSONObject obj = JSONObject.parseObject(info[0]);
pk_nub = Integer.valueOf(obj.getString("pk_num_day")); pk_nub = Integer.valueOf(obj.getString("pk_num_day"));
btn_dr_pk_nub.setText("剩餘次數:" + pk_nub);
DialogUitl.showSimpleDialog(mContext, "是否確認進行多人PK確認後扣除1點次數當日剩餘次數" + pk_nub, btn_dr_pk_nub.setText(String.format(getString(R.string.number_of_remaining_times), String.valueOf(pk_nub)));
DialogUitl.showSimpleDialog(mContext, String.format(getString(R.string.confirmed_to_proceed), String.valueOf(pk_nub)),
false, false,
new DialogUitl.SimpleCallback2() { new DialogUitl.SimpleCallback2() {
@Override @Override
@ -275,7 +267,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (code == 0) { if (code == 0) {
btn_start_dr_pk.setVisibility(View.VISIBLE); btn_start_dr_pk.setVisibility(View.VISIBLE);
dr_pk_view.setVisibility(View.VISIBLE); // dr_pk_view.setVisibility(View.VISIBLE);
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LIVE_DRPK) .param("_method_", SOCKET_LIVE_DRPK)
.param("action", 9) .param("action", 9)
@ -295,18 +287,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
isDRPK = 1; isDRPK = 1;
btn_start_dr_pk_view.setVisibility(View.VISIBLE); btn_start_dr_pk_view.setVisibility(View.VISIBLE);
dr_pk_view.setVisibility(View.VISIBLE);
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1;
params.topMargin = DpUtil.dp2px(123);
dr_pk_view.setLayoutParams(params);
mPreView.setLayoutParams(params);
} }
@Override @Override
@ -651,7 +632,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.setSelfStream(mStream); mLiveRyLinkMicPkPresenter.setSelfStream(mStream);
} }
// }
//开始推流 //开始推流
if (mLivePushViewHolder != null) { if (mLivePushViewHolder != null) {
@ -1352,9 +1332,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.updataMicList(list); mLiveRoomViewHolder.updataMicList(list);
Log.i("多人连麦", "onOpenDrawer: "+list.size()); Log.i("多人连麦", "onOpenDrawer: " + list.size());
for (LinkMicUserBean userBean : list) { for (LinkMicUserBean userBean : list) {
Log.i("多人连麦", "u list: "+userBean.toString()); Log.i("多人连麦", "u list: " + userBean.toString());
} }
} }
break; break;
@ -1365,12 +1345,23 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
break; break;
case LINK_MIC_CLOSE: case LINK_MIC_CLOSE:
if(mLiveRoomViewHolder!=null){ if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.updataCleanMic(); mLiveRoomViewHolder.updataCleanMic();
} }
break; break;
case LEAVE_DR_ROOM:
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.leaveDRRoom();
}
break;
case LEAVE_PK_SCORE:
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.upDataPkScore(event.getPkScores(), event.getUid(), event.getTime());
}
break;
} }
} }
/** /**
* 检查指定直播间连麦人数 * 检查指定直播间连麦人数
* *

View File

@ -1,5 +1,6 @@
package com.yunbao.live.event; package com.yunbao.live.event;
import com.alibaba.fastjson.JSONArray;
import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.AiAutomaticSpeechModel;
import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendItemModel;
@ -23,6 +24,36 @@ public class LiveAudienceEvent extends BaseModel {
private AiAutomaticSpeechModel aiAutomaticSpeechModel;//机器人消息 private AiAutomaticSpeechModel aiAutomaticSpeechModel;//机器人消息
private boolean voicePress = false; private boolean voicePress = false;
private boolean isActivity = false;//是否展示趣味活动和增值权益 private boolean isActivity = false;//是否展示趣味活动和增值权益
private JSONArray pkScores;
private String uid;
private int time;
public JSONArray getPkScores() {
return pkScores;
}
public LiveAudienceEvent setPkScores(JSONArray pkScores) {
this.pkScores = pkScores;
return this;
}
public String getUid() {
return uid;
}
public LiveAudienceEvent setUid(String uid) {
this.uid = uid;
return this;
}
public int getTime() {
return time;
}
public LiveAudienceEvent setTime(int time) {
this.time = time;
return this;
}
public boolean isActivity() { public boolean isActivity() {
return isActivity; return isActivity;
@ -196,7 +227,8 @@ public class LiveAudienceEvent extends BaseModel {
LINK_MIC_CLOSE(43, "主播关闭连麦房"), LINK_MIC_CLOSE(43, "主播关闭连麦房"),
SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"), SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"),
SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"), SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"),
; LEAVE_DR_ROOM(44, "结束多人PK"),
LEAVE_PK_SCORE(45, "PK排名");
private int type; private int type;
private String name; private String name;

View File

@ -1,5 +1,14 @@
package com.yunbao.live.presenter; package com.yunbao.live.presenter;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -16,16 +25,23 @@ 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.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.tencent.trtc.TRTCCloud; import com.tencent.trtc.TRTCCloud;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
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.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
@ -38,12 +54,14 @@ import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.custom.ProgressTextView; import com.yunbao.live.custom.ProgressTextView;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketRyLinkMicPkUtil; import com.yunbao.live.socket.SocketRyLinkMicPkUtil;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.views.LiveLinkMicPkViewHolder; import com.yunbao.live.views.LiveLinkMicPkViewHolder;
import com.yunbao.live.views.LivePushRyViewHolder; import com.yunbao.live.views.LivePushRyViewHolder;
import com.yunbao.live.views.LiveRoomPlayViewHolder;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -69,21 +87,6 @@ import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage; import io.rong.message.TextMessage;
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.leave;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1;
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import org.greenrobot.eventbus.EventBus;
//import cn.rongcloud.rtc.jni.video.RCRect; //import cn.rongcloud.rtc.jni.video.RCRect;
/** /**
@ -129,7 +132,14 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
private String mSelfStream; private String mSelfStream;
private int mPkTimeFromServer; private int mPkTimeFromServer;
public static TRTCCloud mTRTCCloud1; public static TRTCCloud mTRTCCloud1;
private View detailsView1, detailsView2, detailsView3, detailsView4;
private LinearLayout detailsLinearLayout1, detailsLinearLayout2, detailsLinearLayout3, detailsLinearLayout4;
private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4;
private TextView textPkName1, textPkName2, textPkName3, textPkName4;
private TextView textGrade1, textGrade2, textGrade3, textGrade4;
private ImageView imageGrade1, imageGrade2, imageGrade3, imageGrade4;
public LivePushRyViewHolder livePushRyViewHolder;
public static List<RCRTCInputStream> inputStreamList = new ArrayList<>(); public static List<RCRTCInputStream> inputStreamList = new ArrayList<>();
public static List<RCRTCInputStream> inputStreamList1 = new ArrayList<>(); public static List<RCRTCInputStream> inputStreamList1 = new ArrayList<>();
@ -179,7 +189,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
}; };
public LiveRyLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) { public LiveRyLinkMicPkPresenter(Context context, LiveRoomPlayViewHolder linkMicViewHolder, boolean isAnchor, View root) {
mContext = context; mContext = context;
mIsAnchor = isAnchor; mIsAnchor = isAnchor;
mRoot = root; mRoot = root;
@ -218,6 +228,46 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
public LiveRyLinkMicPkPresenter(Context context, LivePushRyViewHolder linkMicViewHolder, boolean isAnchor, View root) {
mContext = context;
mIsAnchor = isAnchor;
mRoot = root;
mPkContainer = linkMicViewHolder.getPkContainer();
livePushRyViewHolder = linkMicViewHolder;
mPkTimeString1 = "";
mPkTimeString2 = WordUtil.getString(R.string.live_pk_time_2);
//从本地取数据
String pkTime = CommonAppConfig.getInstance().getAnchorPkTime();
if (!pkTime.isEmpty()) {
try {
int time = Integer.parseInt(pkTime) * 60;
if (time > 0) {
PK_TIME_MAX = time;
}
} catch (Exception e) {
e.printStackTrace();
}
}
Log.d("PK_TIME_MAX", "" + PK_TIME_MAX);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case WHAT_PK_WAIT_RECEIVE:
onApplyPkWait();
break;
case WHAT_PK_WAIT_SEND:
onSendPkWait();
break;
case WHAT_PK_TIME:
changePkTime();
break;
}
}
};
}
public void setSocketRyClient(SocketRyClient SocketRyClient) { public void setSocketRyClient(SocketRyClient SocketRyClient) {
mSocketRyClient = SocketRyClient; mSocketRyClient = SocketRyClient;
} }
@ -310,8 +360,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1; params.weight = 1;
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
LivePushRyViewHolder.mPreView.setLayoutParams(params); livePushRyViewHolder.mPreView.setLayoutParams(params);
LivePushRyViewHolder.mPreView1.setLayoutParams(params); livePushRyViewHolder.mPreView1.setLayoutParams(params);
} }
Log.i("tts", s1); Log.i("tts", s1);
@ -463,35 +513,36 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(mContext); RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr1_preview.removeAllViews(); livePushRyViewHolder.mPreView1.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr1_preview.addView(remoteView); livePushRyViewHolder.mPreView1.addView(remoteView);
} else if (i == 2) { } else if (i == 2) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(mContext); // RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); // ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 // //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr2_preview.removeAllViews(); // LivePushRyViewHolder.dr2_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); // remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr2_preview.addView(remoteView); // LivePushRyViewHolder.dr2_preview.addView(remoteView);
} else if (i == 3) { } else if (i == 3) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(mContext); // RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); // ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 // //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr3_preview.removeAllViews(); // LivePushRyViewHolder.dr3_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); // remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr3_preview.addView(remoteView); // LivePushRyViewHolder.dr3_preview.addView(remoteView);
} else if (i == 4) { } else if (i == 4) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(mContext); // RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); // ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 // //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr4_preview.removeAllViews(); // LivePushRyViewHolder.dr4_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); // remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr4_preview.addView(remoteView); // LivePushRyViewHolder.dr4_preview.addView(remoteView);
} }
//如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅 //如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅
inputStreamList.add(stream); inputStreamList.add(stream);
@ -615,9 +666,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
// LivePushRyViewHolder.mPreView1.removeAllViews(); livePushRyViewHolder.mPreView1.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.mPreView1.addView(remoteView); livePushRyViewHolder.mPreView1.addView(remoteView);
} }
//如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅 //如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅
inputStreamList.add(stream); inputStreamList.add(stream);
@ -695,9 +746,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1; params.weight = 1;
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
LivePushRyViewHolder.mPreView.setLayoutParams(params); livePushRyViewHolder.mPreView.setLayoutParams(params);
LivePushRyViewHolder.mPreView1.setLayoutParams(params); livePushRyViewHolder.mPreView1.setLayoutParams(params);
LivePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE); livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LINK_MIC_PK) .param("_method_", SOCKET_LINK_MIC_PK)
@ -739,9 +790,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1; params.weight = 1;
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
LivePushRyViewHolder.mPreView.setLayoutParams(params); livePushRyViewHolder.mPreView.setLayoutParams(params);
LivePushRyViewHolder.mPreView1.setLayoutParams(params); livePushRyViewHolder.mPreView1.setLayoutParams(params);
mPreView1.setVisibility(View.VISIBLE); livePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
JSONObject msg1 = new JSONObject(); JSONObject msg1 = new JSONObject();
@ -768,9 +819,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
// LivePushRyViewHolder.mPreView1.removeAllViews(); livePushRyViewHolder.mPreView1.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.mPreView1.addView(remoteView); livePushRyViewHolder.mPreView1.addView(remoteView);
} }
//如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅 //如果要订阅所有远端用户的流保存所有流信息方便后面统一订阅
inputStreamList.add(stream); inputStreamList.add(stream);
@ -1070,7 +1121,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
/** /**
* 退出多人PK * 退出多人PK
*/ */
public static void leaveDRRoom() { public void leaveDRRoom() {
Log.e("ry", "退出多人OKKK" + inputStreamList.size()); Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0; isDRPK = 0;
for (int i = 0; i < inputStreamList.size(); i++) { for (int i = 0; i < inputStreamList.size(); i++) {
@ -1139,25 +1190,31 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
}); });
} }
} }
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { leaveHandler.post(leaveRunnable);
//恢复全屏画面
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.topMargin = 0;
mPreView.setLayoutParams(params);
dr_pk_view.setVisibility(View.GONE);
inputStreamList.clear();
inputStreamList1.clear();
//删除之前其他主播的画面
LivePushRyViewHolder.dr1_preview.removeAllViews();
LivePushRyViewHolder.dr2_preview.removeAllViews();
LivePushRyViewHolder.dr3_preview.removeAllViews();
LivePushRyViewHolder.dr4_preview.removeAllViews();
}
});
} }
private Handler leaveHandler = new Handler(Looper.getMainLooper());
private Runnable leaveRunnable = new Runnable() {
@Override
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);
inputStreamList.clear();
inputStreamList1.clear();
//删除之前其他主播的画面
livePushRyViewHolder.dr1_preview.removeAllViews();
livePushRyViewHolder.dr3_preview.removeAllViews();
livePushRyViewHolder.cameraPreview3.removeAllViews();
leaveHandler.removeCallbacks(leaveRunnable);
}
};
/** /**
* 显示申请多人PK的弹窗 * 显示申请多人PK的弹窗
*/ */
@ -1215,7 +1272,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
Log.i("多人PK","code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LIVE_DRPK) .param("_method_", SOCKET_LIVE_DRPK)
@ -1246,17 +1303,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
Log.e("ry", "发送失敗"); Log.e("ry", "发送失敗");
} }
}); });
if(info.length==0){ if (info.length == 0) {
return; return;
} }
JSONObject obj = JSONObject.parseObject(info[0]); JSONObject obj = JSONObject.parseObject(info[0]);
JSONArray users = obj.getJSONArray("userlist"); 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); dRjoinOtherRoom(u.getId(), 1);
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);
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表"); Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
@ -1417,15 +1469,28 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
//把多人PK的View显示出来 //把多人PK的View显示出来
if (dr_pk_view.getVisibility() == View.GONE) { if (livePushRyViewHolder.dr_pk_view.getVisibility() == View.GONE) {
ScreenDimenUtil util = ScreenDimenUtil.getInstance(); ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1; params.weight = 1;
params.topMargin = DpUtil.dp2px(123); params.topMargin = DpUtil.dp2px(123);
dr_pk_view.setLayoutParams(params); livePushRyViewHolder.dr_pk_view.setLayoutParams(params);
mPreView.setLayoutParams(params); livePushRyViewHolder.camera.setLayoutParams(params);
dr_pk_view.setVisibility(View.VISIBLE); 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);
} }
Log.e("ry", "多人接受成功" + mApplyUid); Log.e("ry", "多人接受成功" + mApplyUid);
@ -1438,37 +1503,99 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
Log.e("ry", i + "收到" + stream.getMediaType() + "实打实打算" + rcrtcOtherRoom.getRemoteUsers().get(i).getUserId()); Log.e("ry", i + "收到" + stream.getMediaType() + "实打实打算" + rcrtcOtherRoom.getRemoteUsers().get(i).getUserId());
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
if (inputStreamList.size() == 0) { if (inputStreamList.size() == 0) {
livePushRyViewHolder.dr1_preview.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr1_preview.removeAllViews(); livePushRyViewHolder.dr1_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr1_preview.addView(remoteView); livePushRyViewHolder.dr1_preview.addView(remoteView);
LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
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(uid));
textPkName2.setText(data.getUserNicename());
livePushRyViewHolder.dr1_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} else if (inputStreamList.size() == 1) { } else if (inputStreamList.size() == 1) {
livePushRyViewHolder.dr3_preview.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr2_preview.removeAllViews(); livePushRyViewHolder.dr3_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr2_preview.addView(remoteView); livePushRyViewHolder.dr3_preview.addView(remoteView);
LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
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(uid);
textPkName4.setText(data.getUserNicename());
livePushRyViewHolder.dr3_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} else if (inputStreamList.size() == 2) { } else if (inputStreamList.size() == 2) {
livePushRyViewHolder.cameraPreview3.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(mContext);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr3_preview.removeAllViews(); livePushRyViewHolder.cameraPreview3.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr3_preview.addView(remoteView); livePushRyViewHolder.cameraPreview3.addView(remoteView);
} else if (inputStreamList.size() == 3) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 LiveNetManager.get(mContext).getLiveInfo(uid, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); @Override
((RCRTCVideoInputStream) stream).setVideoView(remoteView); public void onSuccess(LiveInfoModel data) {
//todo 本demo只演示添加1个远端用户的视图 detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
LivePushRyViewHolder.dr4_preview.removeAllViews(); detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
remoteView.setScalingType(SCALE_ASPECT_FILL); linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
LivePushRyViewHolder.dr4_preview.addView(remoteView); textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
imageGrade3.setTag(uid);
textPkName3.setText(data.getUserNicename());
livePushRyViewHolder.cameraPreview3.addView(detailsView3);
detailsLinearLayout3.setVisibility(View.VISIBLE);
linearGrade3.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} }
inputStreamList.add(stream); inputStreamList.add(stream);
} }
@ -1534,6 +1661,31 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener);
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
if (livePushRyViewHolder.dr_pk_view.getVisibility() == View.GONE) {
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
params.weight = 1;
params.topMargin = DpUtil.dp2px(123);
livePushRyViewHolder.dr_pk_view.setLayoutParams(params);
livePushRyViewHolder.camera.setLayoutParams(params);
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);
}
//遍历远端用户列表 //遍历远端用户列表
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
//遍历远端用户发布的资源列表 //遍历远端用户发布的资源列表
@ -1541,37 +1693,96 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
Log.e("ry111", stream.getMediaType() + ""); Log.e("ry111", stream.getMediaType() + "");
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
if (inputStreamList.size() == 0) { if (inputStreamList.size() == 0) {
livePushRyViewHolder.dr1_preview.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr1_preview.removeAllViews(); livePushRyViewHolder.dr1_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr1_preview.addView(remoteView); livePushRyViewHolder.dr1_preview.addView(remoteView);
LiveNetManager.get(mContext).getLiveInfo(u, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
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(u));
textPkName2.setText(data.getUserNicename());
livePushRyViewHolder.dr1_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} else if (inputStreamList.size() == 1) { } else if (inputStreamList.size() == 1) {
livePushRyViewHolder.dr3_preview.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr2_preview.removeAllViews(); livePushRyViewHolder.dr3_preview.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr2_preview.addView(remoteView); livePushRyViewHolder.dr3_preview.addView(remoteView);
LiveNetManager.get(mContext).getLiveInfo(u, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
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(u);
textPkName4.setText(data.getUserNicename());
livePushRyViewHolder.dr3_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} else if (inputStreamList.size() == 2) { } else if (inputStreamList.size() == 2) {
livePushRyViewHolder.cameraPreview3.setVisibility(View.VISIBLE);
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
//todo 本demo只演示添加1个远端用户的视图 //todo 本demo只演示添加1个远端用户的视图
LivePushRyViewHolder.dr3_preview.removeAllViews(); livePushRyViewHolder.cameraPreview3.removeAllViews();
remoteView.setScalingType(SCALE_ASPECT_FILL); remoteView.setScalingType(SCALE_ASPECT_FILL);
LivePushRyViewHolder.dr3_preview.addView(remoteView); livePushRyViewHolder.cameraPreview3.addView(remoteView);
} else if (inputStreamList.size() == 3) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 LiveNetManager.get(mContext).getLiveInfo(u, new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); @Override
((RCRTCVideoInputStream) stream).setVideoView(remoteView); public void onSuccess(LiveInfoModel data) {
//todo 本demo只演示添加1个远端用户的视图 detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
LivePushRyViewHolder.dr4_preview.removeAllViews(); detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
remoteView.setScalingType(SCALE_ASPECT_FILL); linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
LivePushRyViewHolder.dr4_preview.addView(remoteView); textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
imageGrade3.setTag(u);
textPkName3.setText(data.getUserNicename());
livePushRyViewHolder.cameraPreview3.addView(detailsView3);
detailsLinearLayout3.setVisibility(View.VISIBLE);
linearGrade3.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
} }
inputStreamList.add(stream); inputStreamList.add(stream);
@ -1679,8 +1890,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
videoLayout2.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video videoLayout2.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video
videoLayout2.setX(480); //X 坐标 videoLayout2.setX(480); //X 坐标
videoLayout2.setY(0); //Y 坐标 videoLayout2.setY(0); //Y 坐标
videoLayout2.setWidth(240); // 视频窗口的宽 videoLayout2.setWidth(480); // 视频窗口的宽
videoLayout2.setHeight(360); // 视频窗口的高 videoLayout2.setHeight(720); // 视频窗口的高
Log.e("ttt1112", "0" + "VS" + streams.get(i).getUserId()); Log.e("ttt1112", "0" + "VS" + streams.get(i).getUserId());
} else if (i == 1) { } else if (i == 1) {
//user3的视频流 //user3的视频流
@ -2061,4 +2272,196 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
public void setSelfStream(String selfStream) { public void setSelfStream(String selfStream) {
mSelfStream = selfStream; mSelfStream = selfStream;
} }
/**
* 更新Pk分数
*/
public void upDataPkScore(JSONArray pkScores, String uid, int time) {
String userID1 = (String) imageGrade1.getTag();
String userID2 = (String) imageGrade2.getTag();
String userID4 = (String) imageGrade4.getTag();
if (livePushRyViewHolder.timeTitle.getVisibility() == View.GONE) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushRyViewHolder.timeTitle.getLayoutParams();
layoutParams.topMargin = DpUtil.dp2px(123);
livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams);
livePushRyViewHolder.timeTitle.setVisibility(View.VISIBLE);
}
int pkScoreSize = pkScores.size();
if (pkScoreSize == 3) {
linearGrade1.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.VISIBLE);
//拿到原始数据
for (int i = 0; i < pkScores.size(); i++) {
JSONObject score = pkScores.getJSONObject(i);
String userID = score.getString("id");
long userScore = score.getLong("score");
if (TextUtils.equals(userID, userID1)) {
textGrade1.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade1);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade1);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade1);
break;
}
}
} else if (TextUtils.equals(userID, userID2)) {
textGrade2.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade2);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade2);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade2);
break;
}
}
} else if (TextUtils.equals(userID, userID4)) {
textGrade4.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade4);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade4);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade4);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade4);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade4);
break;
}
}
}
}
} else {
String userID3 = (String) imageGrade3.getTag();
linearGrade1.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.VISIBLE);
linearGrade3.setVisibility(View.VISIBLE);
linearGrade4.setVisibility(View.VISIBLE);
//拿到原始数据
for (int i = 0; i < pkScores.size(); i++) {
JSONObject score = pkScores.getJSONObject(i);
String userID = score.getString("id");
long userScore = score.getLong("score");
if (TextUtils.equals(userID, userID1)) {
textGrade1.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade1);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade1);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade1);
break;
}
}
} else if (TextUtils.equals(userID, userID2)) {
textGrade2.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade2);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade2);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade2);
break;
}
}
} else if (TextUtils.equals(userID, userID4)) {
textGrade4.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade4);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade4);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade4);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade4);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade4);
break;
}
}
} else if (TextUtils.equals(userID, userID3)) {
textGrade3.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade3);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade3);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade3);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade3);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade3);
break;
}
}
}
}
}
}
} }

View File

@ -3,8 +3,6 @@ package com.yunbao.live.socket;
import static com.blankj.utilcode.util.SnackbarUtils.dismiss; import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.blankj.utilcode.util.ViewUtils.runOnUiThread; import static com.blankj.utilcode.util.ViewUtils.runOnUiThread;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
@ -19,7 +17,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; 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.google.gson.reflect.TypeToken;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -278,15 +275,20 @@ public class SocketRyClient {
} }
//收到对方同意多人PK邀请 //收到对方同意多人PK邀请
else if (action3 == 2) { else if (action3 == 2) {
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"));
mListener.onLinkDRMicPkApplyOk(u); // mListener.onLinkDRMicPkApplyOk(u);
} else if (action3 == 6) { } else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
} }
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time")); // LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time"));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE)
.setPkScores(map.getJSONArray("userlist"))
.setUid(mLiveUid)
.setTime(map.getIntValue("drpk_time")));
if (livePushRyViewHolder == null) { if (livePushRyViewHolder == null) {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); // LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
@ -298,11 +300,10 @@ public class SocketRyClient {
// endDRGif(); // endDRGif();
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
if (LiveRyAnchorActivity.mLiveAnchorViewHolder != null) { if (LiveRyAnchorActivity.mLiveAnchorViewHolder != null) {
dr_pk_view.setVisibility(View.GONE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
params.topMargin = 0; params.topMargin = 0;
LivePushRyViewHolder.mPreView.setLayoutParams(params); Bus.get().post(new LiveAudienceEvent()
leaveDRRoom(); .setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
isDRPK = 0; isDRPK = 0;
} else { } else {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); // LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
@ -912,7 +913,12 @@ public class SocketRyClient {
mListener.onSendGift(receiveGiftBean); mListener.onSendGift(receiveGiftBean);
} }
if (map.getIntValue("drpk_status") == 1) { if (map.getIntValue("drpk_status") == 1) {
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, 0); Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE)
.setPkScores(map.getJSONArray("userlist"))
.setUid(mLiveUid)
.setTime(0));
// LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, 0);
} }
} }
@ -1058,16 +1064,16 @@ public class SocketRyClient {
break; break;
case 5://PK时候断开连麦的回调 case 5://PK时候断开连麦的回调
if (rtcRoom != null) { if (rtcRoom != null) {
if (LivePushRyViewHolder.mPreView1 != null) { // if (LivePushRyViewHolder.mPreView1 != null) {
LivePushRyViewHolder.mPreView1.removeAllViews(); // LivePushRyViewHolder.mPreView1.removeAllViews();
LivePushRyViewHolder.mPreView1.setVisibility(View.GONE); // LivePushRyViewHolder.mPreView1.setVisibility(View.GONE);
isDRPK = 0; // isDRPK = 0;
leaveDRRoom(); // leaveDRRoom();
} // }
LivePushRyViewHolder.btn_close.setVisibility(View.GONE); LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
params.topMargin = 0; params.topMargin = 0;
LivePushRyViewHolder.mPreView.setLayoutParams(params); // LivePushRyViewHolder.mPreView.setLayoutParams(params);
//断开连麦 //断开连麦
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
.execute(new HttpCallback() { .execute(new HttpCallback() {

View File

@ -8,22 +8,16 @@ import android.view.animation.Animation;
import android.view.animation.ScaleAnimation; import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.interfaces.ILivePushViewHolder; import com.yunbao.live.interfaces.ILivePushViewHolder;
import com.yunbao.live.interfaces.LivePushListener; import com.yunbao.live.interfaces.LivePushListener;
import cn.qqtheme.framework.util.ScreenUtils;
public class AbsRyLivePushViewHolder extends AbsViewHolder implements ILivePushViewHolder { public class AbsRyLivePushViewHolder extends AbsViewHolder implements ILivePushViewHolder {
@ -38,9 +32,10 @@ public class AbsRyLivePushViewHolder extends AbsViewHolder implements ILivePushV
protected ViewGroup mLeftContainer; protected ViewGroup mLeftContainer;
protected ViewGroup mRightContainer; protected ViewGroup mRightContainer;
protected ViewGroup mPkContainer; protected ViewGroup mPkContainer;
public static FrameLayout mPreView,mPreView1,dr1_preview,dr2_preview,dr3_preview,dr4_preview; public FrameLayout mPreView, mPreView1, cameraPreview3, dr1_preview, dr2_preview, dr3_preview, dr4_preview;
public static ImageView leave; public ImageView leave;
protected boolean mOpenCamera;//是否选择了相机 protected boolean mOpenCamera;//是否选择了相机
public LinearLayout camera;
//倒计时 //倒计时
protected TextView mCountDownText; protected TextView mCountDownText;
@ -67,7 +62,7 @@ public class AbsRyLivePushViewHolder extends AbsViewHolder implements ILivePushV
mRightContainer = (ViewGroup) findViewById(R.id.right_container); mRightContainer = (ViewGroup) findViewById(R.id.right_container);
mPkContainer = (ViewGroup) findViewById(R.id.pk_container); mPkContainer = (ViewGroup) findViewById(R.id.pk_container);
mCameraFront = true; mCameraFront = true;
String mBeautySdkType= CommonAppConfig.getInstance().getBeautySdkType(); String mBeautySdkType = CommonAppConfig.getInstance().getBeautySdkType();
} }
@ -208,7 +203,7 @@ public class AbsRyLivePushViewHolder extends AbsViewHolder implements ILivePushV
} }
public boolean isFlashOpen(){ public boolean isFlashOpen() {
return mFlashOpen; return mFlashOpen;
} }

View File

@ -5,7 +5,6 @@ import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter; import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER; import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER;
import android.app.Dialog; import android.app.Dialog;
@ -89,11 +88,12 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public TencentTRTCBeautyManager tencentTRTCBeautyManager; public TencentTRTCBeautyManager tencentTRTCBeautyManager;
public static Context contexts; public static Context contexts;
public static TextView btn_close; public static TextView btn_close;
public static LinearLayout dr_pk_view; public LinearLayout dr_pk_view;
public static RCRTCRoom rtcRoom; public static RCRTCRoom rtcRoom;
public static RCRTCLiveInfo rcrtcLiveInfo; public static RCRTCLiveInfo rcrtcLiveInfo;
private ViewGroup liveActivityContainer; private ViewGroup liveActivityContainer;
public FrameLayout timeTitle;
public LivePushRyViewHolder(Context context, ViewGroup parentView) { public LivePushRyViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -315,7 +315,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
@Override @Override
public void onFinishOtherRoom(String roomId, String userId) { public void onFinishOtherRoom(String roomId, String userId) {
super.onFinishOtherRoom(roomId, userId); super.onFinishOtherRoom(roomId, userId);
leaveDRRoom(); if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.leaveDRRoom();
}
} }
/** /**
@ -332,14 +334,18 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public void init() { public void init() {
super.init(); super.init();
mPreView = (FrameLayout) findViewById(R.id.camera_preview); mPreView = (FrameLayout) findViewById(R.id.camera_preview);
camera = (LinearLayout) findViewById(R.id.camera);
mPreView1 = (FrameLayout) findViewById(R.id.camera_preview1); mPreView1 = (FrameLayout) findViewById(R.id.camera_preview1);
cameraPreview3 = (FrameLayout) findViewById(R.id.camera_preview3);
dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview); dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview);
dr2_preview = (FrameLayout) findViewById(R.id.dr2_preview); dr2_preview = (FrameLayout) findViewById(R.id.dr2_preview);
dr3_preview = (FrameLayout) findViewById(R.id.dr3_preview); dr3_preview = (FrameLayout) findViewById(R.id.dr3_preview);
dr4_preview = (FrameLayout) findViewById(R.id.dr4_preview); dr4_preview = (FrameLayout) findViewById(R.id.dr4_preview);
leave = (ImageView) findViewById(R.id.leave); leave = (ImageView) findViewById(R.id.leave);
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view); dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
timeTitle = (FrameLayout) findViewById(R.id.time_title);
dr_pk_view.setVisibility(View.GONE); dr_pk_view.setVisibility(View.GONE);
cameraPreview3.setVisibility(View.GONE);
btn_close = (TextView) findViewById(R.id.btn_close); btn_close = (TextView) findViewById(R.id.btn_close);
mMainHandler = new Handler(Looper.getMainLooper()); mMainHandler = new Handler(Looper.getMainLooper());
btn_close.setOnClickListener(new View.OnClickListener() { btn_close.setOnClickListener(new View.OnClickListener() {

View File

@ -4,9 +4,7 @@ import static com.yunbao.live.activity.LiveActivity.mLiveUid;
import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing; import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing;
import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub; import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE; import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE; import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -143,7 +141,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
leaveDRRoom(); Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
PKing = false; PKing = false;
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#60000000" />
<corners android:radius="7.17dp" />
</shape>

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--左上-->
<LinearLayout
android:id="@+id/lin_pk1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/linear_grade1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.33dp"
android:layout_marginTop="4.67dp"
android:background="@drawable/background_pk_time"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_grade1"
android:layout_width="10.67dp"
android:layout_height="10.67dp"
android:layout_marginStart="2.67dp"
android:layout_marginTop="1.67dp"
android:layout_marginEnd="4.33dp"
android:layout_marginBottom="1.67dp"
android:src="@mipmap/icon_livepk_no1" />
<TextView
android:id="@+id/text_grade1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6.76dp"
android:text="000"
android:textColor="@color/white"
android:textSize="6.67sp" />
</LinearLayout>
<TextView
android:id="@+id/text_pk_name1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.33dp"
android:layout_marginTop="3.3dp"
android:background="@drawable/background_pk_time"
android:paddingStart="6dp"
android:paddingTop="4.33dp"
android:paddingEnd="6dp"
android:paddingBottom="4.33dp"
android:text="我方"
android:textColor="@color/white"
android:textSize="6sp" />
</LinearLayout>
<!--右上-->
<LinearLayout
android:id="@+id/lin_pk2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/linear_grade2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4.67dp"
android:layout_marginEnd="5.33dp"
android:background="@drawable/background_pk_time"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_grade2"
android:layout_width="10.67dp"
android:layout_height="10.67dp"
android:layout_marginStart="2.67dp"
android:layout_marginTop="1.67dp"
android:layout_marginEnd="4.33dp"
android:layout_marginBottom="1.67dp"
android:src="@mipmap/icon_livepk_no2" />
<TextView
android:id="@+id/text_grade2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6.76dp"
android:text="000"
android:textColor="@color/white"
android:textSize="6.67sp" />
</LinearLayout>
<TextView
android:id="@+id/text_pk_name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3.3dp"
android:layout_marginEnd="5.33dp"
android:background="@drawable/background_pk_time"
android:paddingStart="6dp"
android:paddingTop="4.33dp"
android:paddingEnd="6dp"
android:paddingBottom="4.33dp"
android:text="我方"
android:textColor="@color/white"
android:textSize="6sp" />
</LinearLayout>
<!--左下-->
<LinearLayout
android:id="@+id/lin_pk3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/text_pk_name3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.33dp"
android:layout_marginBottom="3.3dp"
android:background="@drawable/background_pk_time"
android:paddingStart="6dp"
android:paddingTop="4.33dp"
android:paddingEnd="6dp"
android:paddingBottom="4.33dp"
android:text="我方"
android:textColor="@color/white"
android:textSize="6sp" />
<LinearLayout
android:id="@+id/linear_grade3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.33dp"
android:layout_marginBottom="4.67dp"
android:background="@drawable/background_pk_time"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_grade3"
android:layout_width="10.67dp"
android:layout_height="10.67dp"
android:layout_marginStart="2.67dp"
android:layout_marginTop="1.67dp"
android:layout_marginEnd="4.33dp"
android:layout_marginBottom="1.67dp"
android:src="@mipmap/icon_livepk_no3" />
<TextView
android:id="@+id/text_grade3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6.76dp"
android:text="000"
android:textColor="@color/white"
android:textSize="6.67sp" />
</LinearLayout>
</LinearLayout>
<!--右下-->
<LinearLayout
android:id="@+id/lin_pk4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:gravity="end"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/text_pk_name4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5.33dp"
android:layout_marginBottom="3.3dp"
android:background="@drawable/background_pk_time"
android:paddingStart="6dp"
android:paddingTop="4.33dp"
android:paddingEnd="6dp"
android:paddingBottom="4.33dp"
android:text="我方"
android:textColor="@color/white"
android:textSize="6sp" />
<LinearLayout
android:id="@+id/linear_grade4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5.33dp"
android:layout_marginBottom="4.67dp"
android:background="@drawable/background_pk_time"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_grade4"
android:layout_width="10.67dp"
android:layout_height="10.67dp"
android:layout_marginStart="2.67dp"
android:layout_marginTop="1.67dp"
android:layout_marginEnd="4.33dp"
android:layout_marginBottom="1.67dp"
android:src="@mipmap/icon_livepk_no3" />
<TextView
android:id="@+id/text_grade4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6.76dp"
android:text="000"
android:textColor="@color/white"
android:textSize="6.67sp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -1,33 +1,49 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<FrameLayout <LinearLayout
android:id="@+id/camera_preview" android:id="@+id/camera"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/camera_preview3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/camera_preview1" android:id="@+id/camera_preview1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout android:id="@+id/dr_pk_view" <LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/camera_preview"
android:layout_marginTop="130dp" android:layout_marginTop="130dp"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -37,17 +53,17 @@
<FrameLayout <FrameLayout
android:id="@+id/dr1_preview" android:id="@+id/dr1_preview"
android:layout_width="100dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/live_icon_vacancy"/> android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
<FrameLayout <FrameLayout
android:id="@+id/dr2_preview" android:id="@+id/dr2_preview"
android:layout_width="100dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/live_icon_vacancy"/> android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout> </LinearLayout>
@ -59,24 +75,23 @@
<FrameLayout <FrameLayout
android:id="@+id/dr3_preview" android:id="@+id/dr3_preview"
android:layout_width="100dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"/> android:background="@mipmap/live_icon_vacancy" />
<FrameLayout <FrameLayout
android:id="@+id/dr4_preview" android:id="@+id/dr4_preview"
android:layout_width="100dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"/> android:background="@mipmap/live_icon_vacancy" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
@ -85,46 +100,40 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
android:visibility="gone"
android:id="@+id/layout_surface" android:id="@+id/layout_surface"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clickable="true" android:clickable="true"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<SurfaceView <SurfaceView
android:id="@+id/surface_view" android:id="@+id/surface_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
/>
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/pk_container" android:id="@+id/pk_container"
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_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="20dp" 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"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp" />
/>
</FrameLayout> </FrameLayout>
@ -133,27 +142,27 @@
android:id="@+id/small_container" android:id="@+id/small_container"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="120dp" android:layout_marginBottom="120dp"
app:mfl3_ratio="0.25" app:mfl3_ratio="0.25" />
/>
<TextView android:id="@+id/btn_close" <TextView
android:id="@+id/btn_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="5dp" android:layout_alignParentRight="true"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="120dp" android:layout_marginTop="120dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_alignParentRight="true" android:background="@drawable/background_dedede"
android:paddingLeft="8dp"
android:paddingTop="5dp"
android:paddingRight="8dp"
android:paddingBottom="5dp"
android:text="結束連麥" android:text="結束連麥"
android:textSize="13sp"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:visibility="gone" android:textSize="13sp"
android:background="@drawable/background_dedede"/> android:visibility="gone" />
<ImageView <ImageView
@ -161,7 +170,25 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@mipmap/zslk" android:src="@mipmap/zslk"
android:visibility="gone" android:visibility="gone" />
android:scaleType="centerCrop"/>
<FrameLayout
android:id="@+id/time_title"
android:layout_width="60dp"
android:layout_height="16.67dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/live_pk_time_bg"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/pk_time"
android:textColor="@color/white"
android:textSize="8sp" />
<!-- 详情-->
</FrameLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -36,7 +36,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="開始PK" android:text="@string/start_pk"
android:textColor="#ffffffff" android:textColor="#ffffffff"
android:textSize="12sp" /> android:textSize="12sp" />
@ -44,7 +44,7 @@
android:id="@+id/btn_dr_pk_nub" android:id="@+id/btn_dr_pk_nub"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="剩餘次數:0" android:text="@string/number_of_remaining_times"
android:textColor="#ffe1e1e1" android:textColor="#ffe1e1e1"
android:textSize="8sp" /> android:textSize="8sp" />
@ -67,8 +67,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="邀請 android:text="@string/invite_anchor"
主播"
android:textColor="#ffffffff" android:textColor="#ffffffff"
android:textSize="10sp" /> android:textSize="10sp" />
@ -87,8 +86,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="結束 android:text="@string/end_pk"
PK"
android:textColor="#ffb1b1b1" android:textColor="#ffb1b1b1"
android:textSize="10sp" /> android:textSize="10sp" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB