diff --git a/config.gradle b/config.gradle index e4e02bc72..49107385a 100644 --- a/config.gradle +++ b/config.gradle @@ -10,9 +10,9 @@ ext { manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 590052024..a652e9beb 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -1359,6 +1359,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRyLinkMicPkPresenter.upDataPkScore(event.getPkScores(), event.getUid(), event.getTime()); } break; + case PK_TIME_COUNT: + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.endDRGif(); + } + break; } } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index ebc8a7017..3b37cdf07 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -227,8 +227,9 @@ public class LiveAudienceEvent extends BaseModel { LINK_MIC_CLOSE(43, "主播关闭连麦房"), SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"), SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"), - LEAVE_DR_ROOM(44, "结束多人PK"), - LEAVE_PK_SCORE(45, "PK排名"); + LEAVE_DR_ROOM(46, "结束多人PK"), + LEAVE_PK_SCORE(47, "PK排名"), + PK_TIME_COUNT(48, "多人PK结束"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 4a6b49f57..fbe9f509f 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -99,6 +99,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { private static final int WHAT_PK_WAIT_RECEIVE = 0;//收到pk申请等待 what private static final int WHAT_PK_WAIT_SEND = 1;//发送pk申请等待 what private static final int WHAT_PK_TIME = 2;//pk时间变化 what + private static final int WHAT_PK_TIME2 = 22;//pk时间变化 what private static final int LINK_MIC_COUNT_MAX = 10; private static int PK_TIME_MAX = 60 * 15;//pk时间 15分钟 private static final int PK_TIME_MAX_2 = 60;//惩罚时间 1分钟 @@ -222,6 +223,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { case WHAT_PK_TIME: changePkTime(); break; + } } }; @@ -259,8 +261,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { case WHAT_PK_WAIT_SEND: onSendPkWait(); break; - case WHAT_PK_TIME: - changePkTime(); + case WHAT_PK_TIME2: + pkCountdownTimer(); break; } } @@ -1211,7 +1213,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { livePushRyViewHolder.dr3_preview.removeAllViews(); livePushRyViewHolder.cameraPreview3.removeAllViews(); leaveHandler.removeCallbacks(leaveRunnable); - + livePushRyViewHolder.timeTitle.setVisibility(View.GONE); + livePushRyViewHolder.mPreView.removeView(detailsView1); } }; @@ -1255,92 +1258,92 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { public void onSuccess(int code, String msg, String[] info) { Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); JSONObject datas = JSONObject.parseObject(info[0]); - boolean agree=true; + boolean agree = true; if (datas.getIntValue("pk_num_day") <= 0) { ToastUtil.show("多人PK次数已用完"); - agree=false; + agree = false; } boolean finalAgree = agree; rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, agree, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() { @Override public void onSuccess() { - if(finalAgree == true){ - HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("roomid", u.getId()) - .execute(new HttpCallback() { + if (finalAgree == true) { + HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom") + .params("uid", CommonAppConfig.getInstance().getUid()) + .params("roomid", u.getId()) + .execute(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + @Override + public void onSuccess(int code, String msg, String[] info) { + Log.i("多人PK", "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); - final SocketSendBean msg1 = new SocketSendBean() - .param("_method_", SOCKET_LIVE_DRPK) - .param("action", 10) - .param("uid", CommonAppConfig.getInstance().getUid()); - msg1.create(); - String targetId = "g" + CommonAppConfig.getInstance().getUid(); - Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; - TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); - io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); + final SocketSendBean msg1 = new SocketSendBean() + .param("_method_", SOCKET_LIVE_DRPK) + .param("action", 10) + .param("uid", CommonAppConfig.getInstance().getUid()); + msg1.create(); + String targetId = "g" + CommonAppConfig.getInstance().getUid(); + Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; + TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); + io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { - @Override - public void onAttached(io.rong.imlib.model.Message message) { + RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(io.rong.imlib.model.Message message) { - } - - @Override - public void onSuccess(io.rong.imlib.model.Message message) { - Log.e("ry", "发送成功"); - if (SocketRyClient.mSocketHandler != null) { - SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + ""); } + + @Override + public void onSuccess(io.rong.imlib.model.Message message) { + Log.e("ry", "发送成功"); + if (SocketRyClient.mSocketHandler != null) { + SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + ""); + } + } + + @Override + public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { + Log.e("ry", "发送失敗"); + } + }); + if (info.length == 0) { + return; } + JSONObject obj = JSONObject.parseObject(info[0]); + JSONArray users = obj.getJSONArray("userlist"); + dRjoinOtherRoom(u.getId(), 1); + for (int i = 0; i < users.size(); i++) { + JSONObject user = users.getJSONObject(i); + Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表"); + if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) { + if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) { + /** + * 向指定用户发送跨房间连麦请求 + *

+ * 1: inviterAutoMix为true时: + * + * 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。 + * + * 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。 + * + * 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。 + *

+ */ + rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() { + @Override + public void onSuccess() { + } - @Override - public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { - Log.e("ry", "发送失敗"); - } - }); - if (info.length == 0) { - return; - } - JSONObject obj = JSONObject.parseObject(info[0]); - JSONArray users = obj.getJSONArray("userlist"); - dRjoinOtherRoom(u.getId(), 1); - for (int i = 0; i < users.size(); i++) { - JSONObject user = users.getJSONObject(i); - Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表"); - if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid())) { - if (!user.getString("id").equals(CommonAppConfig.getInstance().getUid()) && !user.getString("id").equals(u.getId())) { - /** - * 向指定用户发送跨房间连麦请求 - *

- * 1: inviterAutoMix为true时: - * - * 1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。 - * - * 1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。 - * - * 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。 - *

- */ - rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() { - @Override - public void onSuccess() { - } + @Override + public void onFailed(RTCErrorCode errorCode) { - @Override - public void onFailed(RTCErrorCode errorCode) { - - } - }); + } + }); + } } } } - } - }); + }); } } @@ -1842,7 +1845,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * @param streams 必须为视频流列表 * @return */ - public static RCRTCMixConfig create_Custom_MixConfig(boolean isCrop, List streams) { + private RCRTCMixConfig create_Custom_MixConfig(boolean isCrop, List streams) { + Log.e("视频合流", streams.toString()); + Log.e("视频合流", "视频长度:" + streams.size()); RCRTCMixConfig config = new RCRTCMixConfig(); //1. 设置自定义合流布局模式 config.setLayoutMode(RCRTCMixConfig.MixLayoutMode.CUSTOM); @@ -1870,62 +1875,92 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { //(请参照画布和声音配置示例代码) //3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准),设置每个视频流小窗口的坐标及宽高 ArrayList 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(480); // 视频窗口的宽 - videoLayout1.setHeight(720); // 视频窗口的高 - for (int i = 0; i < streams.size(); i++) { - Log.e("tttts,", "a" + i + "cccc" + streams.size()); - Log.e("tttts", streams.get(i).getUserId() + ""); - if (i == 0) { - //user2的视频流 - RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); - list.add(videoLayout2); - videoLayout2.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video - videoLayout2.setX(480); //X 坐标 - videoLayout2.setY(0); //Y 坐标 - videoLayout2.setWidth(480); // 视频窗口的宽 - videoLayout2.setHeight(720); // 视频窗口的高 - Log.e("ttt1112", "0" + "VS" + streams.get(i).getUserId()); - } else if (i == 1) { - //user3的视频流 - RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); - list.add(videoLayout3); - videoLayout3.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video - videoLayout3.setX(720); //X 坐标 - videoLayout3.setY(0); //Y 坐标 - videoLayout3.setWidth(240); // 视频窗口的宽 - videoLayout3.setHeight(360); // 视频窗口的高 - Log.e("ttt1112", "1" + "VS" + streams.get(i).getUserId()); + if (streams.size() == 1) { + //user1的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video + videoLayout1.setX(0); //X 坐标 + videoLayout1.setY(0); //Y 坐标 + videoLayout1.setWidth(480); // 视频窗口的宽 + videoLayout1.setHeight(720); // 视频窗口的高 + list.add(videoLayout1); - } else if (i == 2) { - //user3的视频流 - RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); - list.add(videoLayout4); - videoLayout4.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video - videoLayout4.setX(480); //X 坐标 - videoLayout4.setY(360); //Y 坐标 - videoLayout4.setWidth(240); // 视频窗口的宽 - videoLayout4.setHeight(360); // 视频窗口的高 - Log.e("ttt1112", "2" + "VS" + streams.get(i).getUserId()); - } else if (i == 3) { - //user3的视频流 - RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); - list.add(videoLayout4); - videoLayout4.setVideoStream(streams.get(i)); // RCRTCStream#MediaType 必须是Video - videoLayout4.setX(720); //X 坐标 - videoLayout4.setY(360); //Y 坐标 - videoLayout4.setWidth(240); // 视频窗口的宽 - videoLayout4.setHeight(360); // 视频窗口的高 - Log.e("ttt1112", "3" + "VS" + streams.get(i).getUserId()); - } + //user2的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video + videoLayout2.setX(480); //X 坐标 + videoLayout2.setY(0); //Y 坐标 + videoLayout2.setWidth(480); // 视频窗口的宽 + videoLayout2.setHeight(720); // 视频窗口的高 + list.add(videoLayout2); + + } else if (streams.size() == 2) { + //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(480); // 视频窗口的宽 + videoLayout1.setHeight(720); // 视频窗口的高 + + //user2的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video + videoLayout2.setX(480); //X 坐标 + videoLayout2.setY(0); //Y 坐标 + videoLayout2.setWidth(480); // 视频窗口的宽 + videoLayout2.setHeight(360); // 视频窗口的高 + list.add(videoLayout2); + + //user3的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout3.setVideoStream(streams.get(1)); // RCRTCStream#MediaType 必须是Video + videoLayout3.setX(480); //X 坐标 + videoLayout3.setY(360); //Y 坐标 + videoLayout3.setWidth(480); // 视频窗口的宽 + videoLayout3.setHeight(360); // 视频窗口的高 + list.add(videoLayout3); + + } else if (streams.size() == 3) { + //user1的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video + videoLayout1.setX(0); //X 坐标 + videoLayout1.setY(0); //Y 坐标 + videoLayout1.setWidth(480); // 视频窗口的宽 + videoLayout1.setHeight(720); // 视频窗口的高 + list.add(videoLayout1); + + //user2的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout2 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout2.setVideoStream(streams.get(0)); // RCRTCStream#MediaType 必须是Video + videoLayout2.setX(480); //X 坐标 + videoLayout2.setY(0); //Y 坐标 + videoLayout2.setWidth(480); // 视频窗口的宽 + videoLayout2.setHeight(360); // 视频窗口的高 + list.add(videoLayout2); + + //user3的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout3 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout3.setVideoStream(streams.get(1)); // RCRTCStream#MediaType 必须是Video + videoLayout3.setX(480); //X 坐标 + videoLayout3.setY(360); //Y 坐标 + videoLayout3.setWidth(480); // 视频窗口的宽 + videoLayout3.setHeight(360); // 视频窗口的高 + list.add(videoLayout3); + + //user3的视频流 + RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout4 = new RCRTCMixConfig.CustomLayoutList.CustomLayout(); + videoLayout4.setVideoStream(streams.get(2)); // RCRTCStream#MediaType 必须是Video + videoLayout4.setX(0); //X 坐标 + videoLayout4.setY(360); //Y 坐标 + videoLayout4.setWidth(480); // 视频窗口的宽 + videoLayout4.setHeight(360); // 视频窗口的高 + list.add(videoLayout4); } + config.setCustomLayouts(list); return config; } @@ -2285,6 +2320,10 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { layoutParams.topMargin = DpUtil.dp2px(123); livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams); livePushRyViewHolder.timeTitle.setVisibility(View.VISIBLE); + String pkTime = StringUtil.getDurationText(time * 1000); + livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime)); + mPkTimeCount = time; + pkCountdownTimer(); } int pkScoreSize = pkScores.size(); if (pkScoreSize == 3) { @@ -2464,4 +2503,28 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } + /** + * PK倒计时 + */ + private void pkCountdownTimer() { + + mPkTimeCount--; + if (mPkTimeCount > 0) {// + if (mHandler != null) { + String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); + livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); + mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME2, getNextSecondTime()); + } + } else { + livePushRyViewHolder.timeTitle.setVisibility(View.GONE); + if (mHandler != null) { + mHandler.removeCallbacksAndMessages(null); + } + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); +// endDRGif(); + } + } + + } diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 6c53de969..0d955fa57 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -428,7 +428,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } - public static void setViewUP(int i) { + public void setViewUP(int i) { if (mVideoView == null) return; Log.e("收", "整理" + i); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index 79bbe9d18..8841eac82 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -94,6 +94,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX private ViewGroup liveActivityContainer; public FrameLayout timeTitle; + public TextView textTime; public LivePushRyViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -344,6 +345,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX leave = (ImageView) findViewById(R.id.leave); dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view); timeTitle = (FrameLayout) findViewById(R.id.time_title); + textTime = (TextView) findViewById(R.id.text_time); dr_pk_view.setVisibility(View.GONE); cameraPreview3.setVisibility(View.GONE); btn_close = (TextView) findViewById(R.id.btn_close); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index d8b52023f..06f5f9a32 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -269,7 +269,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis static RoundedImageView mic_ico1; static RoundedImageView mic_ico2; - static GifImageView dr_pk_end_gif; + private GifImageView dr_pk_end_gif; private SVGAImageView gift_svga; public static Handler mHandler; @@ -442,11 +442,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); } - endDRGif(); +// endDRGif(); } } - public static void endDRGif() { + public void endDRGif() { + dr_pk_end_gif.setVisibility(View.VISIBLE); RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置 Glide.with(Contexts).asGif() .apply(options)//应用配置 diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 388557c48..9d63388ce 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -129,7 +129,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //侧滑布局 // private DrawerLayout drawerLayout; //直播间拆分布局 - private LiveRoomPlayViewHolder mLivePlayViewHolder; + private LivePlayRyViewHolder mLivePlayViewHolder; //头部布局 public LiveRoomViewHolder mLiveRoomViewHolder; //底部布局 @@ -480,16 +480,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) { mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull); } - } else { - if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) { - ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0); - } } } if (data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) { - LivePlayRyViewHolder.setViewUP(1); + mLivePlayViewHolder.setViewUP(1); } if (mLiveRoomViewHolder != null) { @@ -497,7 +493,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 - LivePlayRyViewHolder.setViewUP(2); + mLivePlayViewHolder.setViewUP(2); //pk排名数据 LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); @@ -511,7 +507,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.pkHandler = true; mLiveRoomViewHolder.initPkRank(null); } - LivePlayRyViewHolder.setViewUP(3); + mLivePlayViewHolder.setViewUP(3); //pk排名数据 LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); @@ -526,7 +522,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.initPkRank(null); } - LivePlayRyViewHolder.setViewUP(4); + mLivePlayViewHolder.setViewUP(4); mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); } @@ -736,7 +732,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onDestroy() { MicStatusManager.getInstance().removeOnMicListener(micStatusListener); - mContext = null;//上下文置空防止内存泄漏 + mContext = null;//上下文置空防止内存泄漏 } @Override @@ -1563,9 +1559,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void onLinkMicTxAccEvent(LinkMicTxAccEvent e) { - if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) { - ((LivePlayTxViewHolder) mLivePlayViewHolder).onLinkMicTxAccEvent(e.isLinkMic()); - } + } /** @@ -1574,9 +1568,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * @param linkMic true开始连麦 false断开连麦 */ public void onLinkMicTxAnchor(boolean linkMic) { - if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) { - ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(linkMic, 5000); - } + } /** diff --git a/live/src/main/res/layout/view_live_pk_details.xml b/live/src/main/res/layout/view_live_pk_details.xml index 7ba5e065e..03ef304ca 100644 --- a/live/src/main/res/layout/view_live_pk_details.xml +++ b/live/src/main/res/layout/view_live_pk_details.xml @@ -47,6 +47,9 @@ android:layout_marginStart="5.33dp" android:layout_marginTop="3.3dp" android:background="@drawable/background_pk_time" + android:ellipsize="end" + android:maxEms="6" + android:maxLines="1" android:paddingStart="6dp" android:paddingTop="4.33dp" android:paddingEnd="6dp" @@ -102,6 +105,9 @@ android:layout_marginTop="3.3dp" android:layout_marginEnd="5.33dp" android:background="@drawable/background_pk_time" + android:ellipsize="end" + android:maxEms="6" + android:maxLines="1" android:paddingStart="6dp" android:paddingTop="4.33dp" android:paddingEnd="6dp" @@ -126,6 +132,9 @@ android:layout_marginStart="5.33dp" android:layout_marginBottom="3.3dp" android:background="@drawable/background_pk_time" + android:ellipsize="end" + android:maxEms="6" + android:maxLines="1" android:paddingStart="6dp" android:paddingTop="4.33dp" android:paddingEnd="6dp" @@ -181,6 +190,9 @@ android:layout_marginEnd="5.33dp" android:layout_marginBottom="3.3dp" android:background="@drawable/background_pk_time" + android:ellipsize="end" + android:maxEms="6" + android:maxLines="1" android:paddingStart="6dp" android:paddingTop="4.33dp" android:paddingEnd="6dp" diff --git a/live/src/main/res/layout/view_live_push_ry.xml b/live/src/main/res/layout/view_live_push_ry.xml index a430d9b42..a90add632 100644 --- a/live/src/main/res/layout/view_live_push_ry.xml +++ b/live/src/main/res/layout/view_live_push_ry.xml @@ -183,6 +183,7 @@ android:visibility="gone"> - + + \ No newline at end of file