直播横竖屏问题修改

This commit is contained in:
18401019693 2022-12-01 19:13:52 +08:00
parent efcc2591c2
commit 4ebe56913a

View File

@ -192,6 +192,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@Override @Override
public synchronized void setLiveBeanLandscape(int landscape) { public synchronized void setLiveBeanLandscape(int landscape) {
this.landscape = landscape;
if (landscape == 2) { if (landscape == 2) {
Log.i("收到socket--->", "还原916"); Log.i("收到socket--->", "还原916");
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
@ -454,53 +455,53 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
} else { } else {
height = DpUtil.dp2px(285); height = DpUtil.dp2px(285);
} }
// if (landscape == 2) { if (landscape == 2) {
// Log.i("收到socket--->", "还原916"); Log.i("收到socket--->", "还原916");
// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
// params.height = height; params.height = height;
// params.topMargin = 0; params.topMargin = 0;
// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
// params.addRule(RelativeLayout.ALIGN_TOP); params.addRule(RelativeLayout.ALIGN_TOP);
// mVideoView.setLayoutParams(params); mVideoView.setLayoutParams(params);
// mVideoView.requestLayout(); mVideoView.requestLayout();
//
// RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams();
// params1.height = height; params1.height = height;
// params1.topMargin = 0; params1.topMargin = 0;
// params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
// ry_view.setLayoutParams(params1); ry_view.setLayoutParams(params1);
// ry_view.requestLayout(); ry_view.requestLayout();
// RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams();
// params2.height = height; params2.height = height;
// params2.topMargin = 0; params2.topMargin = 0;
// mCover.setLayoutParams(params2); mCover.setLayoutParams(params2);
// mCover.requestLayout(); mCover.requestLayout();
// } else { } else {
// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
// params.height = height; params.height = height;
// params.topMargin = 0; params.topMargin = 0;
// if (videoLandscape == VIDEO_HORIZONTAL) { if (videoLandscape == VIDEO_HORIZONTAL) {
// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
// } }
// params.addRule(RelativeLayout.ALIGN_TOP); params.addRule(RelativeLayout.ALIGN_TOP);
// mVideoView.setLayoutParams(params); mVideoView.setLayoutParams(params);
// mVideoView.requestLayout(); mVideoView.requestLayout();
//
// RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams();
// params1.height = height; params1.height = height;
// params1.topMargin = 0; params1.topMargin = 0;
// params1.addRule(RelativeLayout.ALIGN_TOP); params1.addRule(RelativeLayout.ALIGN_TOP);
// if (videoLandscape == VIDEO_HORIZONTAL) { if (videoLandscape == VIDEO_HORIZONTAL) {
// params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
// } }
// ry_view.setLayoutParams(params1); ry_view.setLayoutParams(params1);
// ry_view.requestLayout(); ry_view.requestLayout();
// RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams();
// params2.height = height; params2.height = height;
// params2.topMargin = DpUtil.dp2px(120); params2.topMargin = DpUtil.dp2px(120);
// mCover.setLayoutParams(params2); mCover.setLayoutParams(params2);
// mCover.requestLayout(); mCover.requestLayout();
// } }
} }
@Override @Override
@ -514,24 +515,24 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
} }
@Override @Override
public void setPkEndview() { public synchronized void setPkEndview() {
Log.i("收收收", landscape + ""); Log.i("收收收", landscape + "");
// if (landscape == 2) { if (landscape == 2) {
// Log.i("收到socket--->", "还原916"); Log.i("收到socket--->", "还原916");
// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
// params.height = RelativeLayout.LayoutParams.MATCH_PARENT; params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
// params.topMargin = 0; params.topMargin = 0;
// mVideoView.requestLayout(); mVideoView.requestLayout();
//
// } else { } else {
// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
// params.height = vHeight; params.height = vHeight;
// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
// params.addRule(RelativeLayout.ALIGN_TOP); params.addRule(RelativeLayout.ALIGN_TOP);
// mVideoView.requestLayout(); mVideoView.requestLayout();
// } }
} }