From c35832487dc5f7be98cbe25fa5b5342fa11d73cd Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Tue, 2 Apr 2024 13:20:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E4=BF=AE=E5=A4=8D-=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=B0=81=E9=9D=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../video/views/VideoPlayViewHolder.java | 12 +++++++++-- .../video/views/VideoPlayWrapViewHolder.java | 21 ++++++++++++------- .../main/res/layout/view_video_play_wrap.xml | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/video/src/main/java/com/yunbao/video/views/VideoPlayViewHolder.java b/video/src/main/java/com/yunbao/video/views/VideoPlayViewHolder.java index a14cfb8bc..2f1fe2ea3 100644 --- a/video/src/main/java/com/yunbao/video/views/VideoPlayViewHolder.java +++ b/video/src/main/java/com/yunbao/video/views/VideoPlayViewHolder.java @@ -87,9 +87,11 @@ public class VideoPlayViewHolder extends AbsViewHolder implements View.OnClickLi @Override public void onVideoSizeChanged(VideoSize videoSize) { Player.Listener.super.onVideoSizeChanged(videoSize); - if (mActionListener != null) { + /*if (mActionListener != null) { mActionListener.onVideoSize(videoSize.height, videoSize.width); - } + }*/ + L.e("onVideoSizeChanged————Height----"+videoSize.height); + L.e("onVideoSizeChanged————Width----"+videoSize.width); } @Override @@ -164,6 +166,12 @@ public class VideoPlayViewHolder extends AbsViewHolder implements View.OnClickLi } } + @Override + public void onDestroy() { + super.onDestroy(); + } + + /** * 循环播放 */ diff --git a/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java b/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java index daa73df71..24b233702 100644 --- a/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java +++ b/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java @@ -7,6 +7,7 @@ import android.os.Bundle; import androidx.core.content.ContextCompat; +import android.util.Log; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; @@ -32,6 +33,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; @@ -229,9 +231,9 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli } mVideoBean = bean; if (payload == null) { - if (mCover != null) { + /*if (mCover != null) { setCoverImage(); - } + }*/ if (mTitle != null) { mTitle.setText(String.valueOf(JSONObject.parseObject(bean.getContent()).get("msg"))); } @@ -303,6 +305,8 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli mCover.requestLayout(); } mCover.setImageDrawable(drawable); + L.e("setCoverImage————Height----"+mCover.getHeight()); + L.e("setCoverImage————Width----"+mCover.getWidth()); } } @@ -348,17 +352,20 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli * 获取到视频首帧回调 */ public void onFirstFrame() { - if (mCover != null && mCover.getVisibility() == View.VISIBLE) { + /*if (mCover != null && mCover.getVisibility() == View.VISIBLE) { mCover.setVisibility(View.INVISIBLE); - } + }*/ } public void onSetVideoCoverSize(int height, int width) { - if (mCover != null) { + /* if (mCover != null) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); params.width = width; params.height = height; } + if (mCover != null) { + setCoverImage(); + }*/ } @@ -376,13 +383,13 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli * 滑入屏幕 */ public void onPageInWindow() { - if (mCover != null) { + /*if (mCover != null) { if (mCover.getVisibility() != View.VISIBLE) { mCover.setVisibility(View.VISIBLE); } mCover.setImageDrawable(null); setCoverImage(); - } + }*/ } /** diff --git a/video/src/main/res/layout/view_video_play_wrap.xml b/video/src/main/res/layout/view_video_play_wrap.xml index 7f552263f..5f753e0f8 100644 --- a/video/src/main/res/layout/view_video_play_wrap.xml +++ b/video/src/main/res/layout/view_video_play_wrap.xml @@ -15,6 +15,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" + android:visibility="gone" android:layout_centerVertical="true" android:scaleType="centerCrop" />