From 4ebe56913a618712cd1df42d6f8a80c78d3fe3fa Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 1 Dec 2022 19:13:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=A8=AA=E7=AB=96=E5=B1=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/LivePlayRyViewHolder.java | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) 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 a3e60e80c..677c85fe0 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -192,6 +192,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public synchronized void setLiveBeanLandscape(int landscape) { + this.landscape = landscape; if (landscape == 2) { Log.i("收到socket--->", "还原9:16"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); @@ -454,53 +455,53 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } else { height = DpUtil.dp2px(285); } -// if (landscape == 2) { -// Log.i("收到socket--->", "还原9:16"); -// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); -// params.height = height; -// params.topMargin = 0; -// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); -// params.addRule(RelativeLayout.ALIGN_TOP); -// mVideoView.setLayoutParams(params); -// mVideoView.requestLayout(); -// -// RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); -// params1.height = height; -// params1.topMargin = 0; -// params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); -// ry_view.setLayoutParams(params1); -// ry_view.requestLayout(); -// RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); -// params2.height = height; -// params2.topMargin = 0; -// mCover.setLayoutParams(params2); -// mCover.requestLayout(); -// } else { -// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); -// params.height = height; -// params.topMargin = 0; -// if (videoLandscape == VIDEO_HORIZONTAL) { -// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); -// } -// params.addRule(RelativeLayout.ALIGN_TOP); -// mVideoView.setLayoutParams(params); -// mVideoView.requestLayout(); -// -// RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); -// params1.height = height; -// params1.topMargin = 0; -// params1.addRule(RelativeLayout.ALIGN_TOP); -// if (videoLandscape == VIDEO_HORIZONTAL) { -// params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); -// } -// ry_view.setLayoutParams(params1); -// ry_view.requestLayout(); -// RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); -// params2.height = height; -// params2.topMargin = DpUtil.dp2px(120); -// mCover.setLayoutParams(params2); -// mCover.requestLayout(); -// } + if (landscape == 2) { + Log.i("收到socket--->", "还原9:16"); + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = height; + params.topMargin = 0; + params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.setLayoutParams(params); + mVideoView.requestLayout(); + + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); + params1.height = height; + params1.topMargin = 0; + params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + ry_view.setLayoutParams(params1); + ry_view.requestLayout(); + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = height; + params2.topMargin = 0; + mCover.setLayoutParams(params2); + mCover.requestLayout(); + } else { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = height; + params.topMargin = 0; + if (videoLandscape == VIDEO_HORIZONTAL) { + params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + } + params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.setLayoutParams(params); + mVideoView.requestLayout(); + + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); + params1.height = height; + params1.topMargin = 0; + params1.addRule(RelativeLayout.ALIGN_TOP); + if (videoLandscape == VIDEO_HORIZONTAL) { + params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + } + ry_view.setLayoutParams(params1); + ry_view.requestLayout(); + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = height; + params2.topMargin = DpUtil.dp2px(120); + mCover.setLayoutParams(params2); + mCover.requestLayout(); + } } @Override @@ -514,24 +515,24 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } @Override - public void setPkEndview() { + public synchronized void setPkEndview() { Log.i("收收收", landscape + ""); -// if (landscape == 2) { -// Log.i("收到socket--->", "还原9:16"); -// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); -// params.height = RelativeLayout.LayoutParams.MATCH_PARENT; -// params.topMargin = 0; -// mVideoView.requestLayout(); -// -// } else { -// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); -// params.height = vHeight; -// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); -// params.addRule(RelativeLayout.ALIGN_TOP); -// mVideoView.requestLayout(); -// } + if (landscape == 2) { + Log.i("收到socket--->", "还原9:16"); + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params.topMargin = 0; + mVideoView.requestLayout(); + + } else { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = vHeight; + params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.requestLayout(); + } }