From c2c9a82705a3e333b28bd6c3de47b70d5aa60736 Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 21 Oct 2020 17:43:17 +0800 Subject: [PATCH 1/6] no message --- .../scene/road/V2XRoadVideoWindow.java | 54 +++++++++++-------- .../module/v2x/view/SimpleCoverVideoPlayer.kt | 2 +- .../com/mogo/module/v2x/view/VideoInit.kt | 2 +- .../src/main/res/layout/window_road_video.xml | 4 +- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java index 268fa90b4b..810473ea01 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java @@ -13,15 +13,17 @@ import com.mogo.module.common.entity.MarkerExploreWayItem; import com.mogo.module.common.entity.V2XEventShowEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.v2x.R; +import com.mogo.module.v2x.SimpleCoverVideoPlayer; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.listener.V2XWindowStatusListener; import com.mogo.module.v2x.scenario.view.IV2XWindow; import com.mogo.module.v2x.view.TextureVideoView; import com.mogo.utils.BitmapHelper; import com.mogo.utils.logger.Logger; +import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; import java.util.ArrayList; - +import com.mogo.module.v2x.VideoInitKt; import static com.mogo.module.v2x.V2XConst.MODULE_NAME; @@ -29,10 +31,11 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private static final String TAG = "V2XRoadVideoWindow"; private V2XWindowStatusListener mV2XWindowStatusListener; - private TextureVideoView mVideoView; + private SimpleCoverVideoPlayer simpleCoverVideoPlayer; private ImageView closeImage; private ImageView mThumbnailImageView; private ImageView windowPalyImageView; + private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); public V2XRoadVideoWindow() { this(V2XServiceManager.getContext(), null); @@ -53,20 +56,20 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.window_road_video, this); - mVideoView = findViewById(R.id.roadVideoView);/*播放器*/ + simpleCoverVideoPlayer = findViewById(R.id.roadVideoView);/*播放器*/ windowPalyImageView = findViewById(R.id.window_video_play);/*播放键*/ mThumbnailImageView = findViewById(R.id.thumbnail_image);/*第一帧图片*/ closeImage = findViewById(R.id.roadVideoClose); closeImage.setOnClickListener(v -> { close(); }); - mVideoView.setOnClickListener(v -> { + simpleCoverVideoPlayer.setOnClickListener(v -> { mThumbnailImageView.setVisibility(View.GONE); - if (mVideoView.isPlaying()) { - videoPause(); - } else { - videoResume(); - } +// if (simpleCoverVideoPlayer.isPlaying()) { +// videoPause(); +// } else { +// videoResume(); +// } }); } @@ -84,10 +87,10 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID if (path.contains(".mp4")) { videoViewStartWithPath(path); - mVideoView.setOnCompletionListener(mediaPlayer -> { - Logger.w(MODULE_NAME, "视频播放结束..."); - videoPlayEnd(path); - }); +// mVideoView.setOnCompletionListener(mediaPlayer -> { +// Logger.w(MODULE_NAME, "视频播放结束..."); +// videoPlayEnd(path); +// }); } @@ -98,20 +101,25 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID * 视频开始播放 * */ private void videoViewStartWithPath(String path) { - mVideoView.setVisibility(VISIBLE); - mVideoView.setVideoPath(path); - mVideoView.setOnPreparedListener(mediaPlayer -> { - mThumbnailImageView.setVisibility(View.GONE); - windowPalyImageView.setVisibility(View.GONE); - }); - mVideoView.start(); + simpleCoverVideoPlayer.setVisibility(View.VISIBLE); + //加载封面图 +// simpleCoverVideoPlayer.loadCoverImage(path, getContext()); + gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) + .build(simpleCoverVideoPlayer); + simpleCoverVideoPlayer.getStartButton().performClick(); + +// simpleCoverVideoPlayer.setOnPreparedListener(mediaPlayer -> { +// mThumbnailImageView.setVisibility(View.GONE); +// windowPalyImageView.setVisibility(View.GONE); +// }); +// simpleCoverVideoPlayer.start(); } /* * 视频暂停播放 * */ private void videoPause() { - mVideoView.pause(); +// simpleCoverVideoPlayer.pause(); windowPalyImageView.setVisibility(View.VISIBLE); windowPalyImageView.setOnClickListener(v -> { videoResume(); @@ -122,8 +130,8 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID * 视频暂停后继续播放 * */ private void videoResume() { - mThumbnailImageView.setVisibility(View.INVISIBLE); - mVideoView.resume(); +// mThumbnailImageView.setVisibility(View.INVISIBLE); +// mVideoView.resume(); } /* diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt index 21e8e1a035..77cb118d27 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt @@ -1,4 +1,4 @@ -package com.mogo.module.tanlu.video +package com.mogo.module.v2x import android.content.Context import android.util.AttributeSet diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt index b7962f3acc..d3e9c2c7e6 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt @@ -1,4 +1,4 @@ -package com.mogo.module.tanlu.video +package com.mogo.module.v2x import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.cache.CacheFactory diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml index d43b868146..e7216d6a89 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml @@ -14,7 +14,7 @@ android:layout_margin="@dimen/dp_30" app:roundLayoutRadius="@dimen/dp_28"> - - + Date: Wed, 21 Oct 2020 18:01:50 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/v2x/scenario/scene/road/V2XRoadVideoWindow.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java index 810473ea01..e18a4955e3 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java @@ -17,14 +17,11 @@ import com.mogo.module.v2x.SimpleCoverVideoPlayer; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.listener.V2XWindowStatusListener; import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.view.TextureVideoView; import com.mogo.utils.BitmapHelper; -import com.mogo.utils.logger.Logger; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; import java.util.ArrayList; -import com.mogo.module.v2x.VideoInitKt; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; +import static com.mogo.module.v2x.VideoInitKt.initVideo; public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, IDestroyable { @@ -56,6 +53,7 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.window_road_video, this); + initVideo(); simpleCoverVideoPlayer = findViewById(R.id.roadVideoView);/*播放器*/ windowPalyImageView = findViewById(R.id.window_video_play);/*播放键*/ mThumbnailImageView = findViewById(R.id.thumbnail_image);/*第一帧图片*/ From fddad1dd8757bc22c0704b7a84dfe7e20b372fda Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 22 Oct 2020 14:11:16 +0800 Subject: [PATCH 3/6] zancun --- .../scene/road/V2XRoadVideoWindow.java | 33 +++++----- .../src/main/res/layout/window_road_video.xml | 22 +++++-- .../res/layout/window_road_video_item.xml | 62 +++++++++++++++++++ 3 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java index e18a4955e3..9284c45710 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.Bitmap; import android.util.AttributeSet; import android.view.LayoutInflater; +import android.view.TextureView; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; @@ -21,6 +22,7 @@ import com.mogo.utils.BitmapHelper; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; import java.util.ArrayList; + import static com.mogo.module.v2x.VideoInitKt.initVideo; @@ -53,22 +55,22 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.window_road_video, this); - initVideo(); - simpleCoverVideoPlayer = findViewById(R.id.roadVideoView);/*播放器*/ + simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView);/*播放器*/ + TextureView textureView = findViewById(R.id.tex); windowPalyImageView = findViewById(R.id.window_video_play);/*播放键*/ mThumbnailImageView = findViewById(R.id.thumbnail_image);/*第一帧图片*/ - closeImage = findViewById(R.id.roadVideoClose); - closeImage.setOnClickListener(v -> { - close(); - }); - simpleCoverVideoPlayer.setOnClickListener(v -> { - mThumbnailImageView.setVisibility(View.GONE); -// if (simpleCoverVideoPlayer.isPlaying()) { -// videoPause(); -// } else { -// videoResume(); -// } - }); +// closeImage = findViewById(R.id.roadVideoClose); +// closeImage.setOnClickListener(v -> { +// close(); +// }); +// simpleCoverVideoPlayer.setOnClickListener(v -> { +// mThumbnailImageView.setVisibility(View.GONE); +//// if (simpleCoverVideoPlayer.isPlaying()) { +//// videoPause(); +//// } else { +//// videoResume(); +//// } +// }); } @Override @@ -99,9 +101,10 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID * 视频开始播放 * */ private void videoViewStartWithPath(String path) { + initVideo(); simpleCoverVideoPlayer.setVisibility(View.VISIBLE); //加载封面图 -// simpleCoverVideoPlayer.loadCoverImage(path, getContext()); + simpleCoverVideoPlayer.loadCoverImage(path, getContext()); gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) .build(simpleCoverVideoPlayer); simpleCoverVideoPlayer.getStartButton().performClick(); diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml index e7216d6a89..6c0898cf0f 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml @@ -14,25 +14,32 @@ android:layout_margin="@dimen/dp_30" app:roundLayoutRadius="@dimen/dp_28"> - + - + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml new file mode 100644 index 0000000000..cbfe283897 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d2ec559f030d61dcc21215e2c0c4a1c6c70bcb59 Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 22 Oct 2020 21:23:13 +0800 Subject: [PATCH 4/6] [add] adapter --- .../v2x/adapter/V2XRoadVideoAdapter.java | 89 +++++++++++++ .../v2x/fragment/V2XShareEventsFragment.java | 1 - .../v2x/listener/VideoAdapterCallBack.java | 10 ++ .../scene/road/V2XRoadVideoWindow.java | 120 +++++------------- .../module/v2x/view/SimpleCoverVideoPlayer.kt | 2 +- .../src/main/res/layout/window_road_video.xml | 64 +--------- .../res/layout/window_road_video_item.xml | 13 -- 7 files changed, 139 insertions(+), 160 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/VideoAdapterCallBack.java diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java new file mode 100644 index 0000000000..9488f14e61 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java @@ -0,0 +1,89 @@ +package com.mogo.module.v2x.adapter; + +import android.content.Context; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.module.v2x.R; +import com.mogo.module.v2x.SimpleCoverVideoPlayer; +import com.mogo.module.v2x.listener.AdapterCallback; +import com.mogo.module.v2x.listener.VideoAdapterCallBack; +import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; + +import java.util.ArrayList; + +public class V2XRoadVideoAdapter extends RecyclerView.Adapter { + private static final String TAG = "V2XRoadVideoAdapter"; + private final LayoutInflater shareLayoutInflater; + private VideoAdapterCallBack mCallback; + private SimpleCoverVideoPlayer simpleCoverVideoPlayer; + private Context mContext; + + private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); + + public V2XRoadVideoAdapter(Context context, VideoAdapterCallBack callback) { + mContext = context; + shareLayoutInflater = LayoutInflater.from(context); + mCallback = callback; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View v = shareLayoutInflater.inflate(R.layout.window_road_video_item, parent, + false); + RoadVideoVH holder = new RoadVideoVH(v); + return holder; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + Log.d(TAG, "onBindViewHolder"); + } + + @Override + public int getItemCount() { + return 1; + } + + public void videoPlayWithVideoUrl(String videoUrl) { +// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) +// .build(simpleCoverVideoPlayer); +// simpleCoverVideoPlayer.getStartButton().performClick(); + } + + public class RoadVideoVH extends RecyclerView.ViewHolder { + private ImageView playImageView; + private ImageView closeImage; + + public RoadVideoVH(@NonNull View itemView) { + super(itemView); + playImageView = itemView.findViewById(R.id.window_video_play); + simpleCoverVideoPlayer = itemView.findViewById(R.id.roadVideoView); + closeImage = itemView.findViewById(R.id.roadVideoClose); + + playImageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mCallback.videoPlayWithVideoUrl(""); + } + + }); + simpleCoverVideoPlayer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mCallback.videoPlayWithVideoUrl(""); + } + }); + closeImage.setOnClickListener(v -> { + mCallback.closeVideoWindow(); + }); + } + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java index d1f9b455a4..bc638a88b4 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java @@ -69,7 +69,6 @@ public class V2XShareEventsFragment extends MvpFragment { -// close(); -// }); -// simpleCoverVideoPlayer.setOnClickListener(v -> { -// mThumbnailImageView.setVisibility(View.GONE); -//// if (simpleCoverVideoPlayer.isPlaying()) { -//// videoPause(); -//// } else { -//// videoResume(); -//// } -// }); + mContext = context; + LayoutInflater.from(mContext).inflate(R.layout.window_road_video, this); + initVideo(); + roadVideoRecyclerView = findViewById(R.id.video_recycleview); + mV2XRoadVideoAdapter = new V2XRoadVideoAdapter(mContext, this); + roadVideoRecyclerView.setAdapter(mV2XRoadVideoAdapter); + LinearLayoutManager linearLayoutManager = + new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false); + roadVideoRecyclerView.setLayoutManager(linearLayoutManager); } @Override @@ -85,74 +85,12 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID return; } if (path.contains(".mp4")) { - videoViewStartWithPath(path); - -// mVideoView.setOnCompletionListener(mediaPlayer -> { -// Logger.w(MODULE_NAME, "视频播放结束..."); -// videoPlayEnd(path); -// }); - + mV2XRoadVideoAdapter.videoPlayWithVideoUrl(path); } } } - /* - * 视频开始播放 - * */ - private void videoViewStartWithPath(String path) { - initVideo(); - simpleCoverVideoPlayer.setVisibility(View.VISIBLE); - //加载封面图 - simpleCoverVideoPlayer.loadCoverImage(path, getContext()); - gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) - .build(simpleCoverVideoPlayer); - simpleCoverVideoPlayer.getStartButton().performClick(); - -// simpleCoverVideoPlayer.setOnPreparedListener(mediaPlayer -> { -// mThumbnailImageView.setVisibility(View.GONE); -// windowPalyImageView.setVisibility(View.GONE); -// }); -// simpleCoverVideoPlayer.start(); - } - - /* - * 视频暂停播放 - * */ - private void videoPause() { -// simpleCoverVideoPlayer.pause(); - windowPalyImageView.setVisibility(View.VISIBLE); - windowPalyImageView.setOnClickListener(v -> { - videoResume(); - }); - } - - /* - * 视频暂停后继续播放 - * */ - private void videoResume() { -// mThumbnailImageView.setVisibility(View.INVISIBLE); -// mVideoView.resume(); - } - - /* - * 视频播放结束 - * */ - private void videoPlayEnd(String path) { - Bitmap bitmap = BitmapHelper.getVideoThumbnail(path); - mThumbnailImageView.setVisibility(View.VISIBLE); - mThumbnailImageView.setImageBitmap(bitmap); - - windowPalyImageView.setVisibility(View.VISIBLE); - windowPalyImageView.setOnClickListener(v -> { - videoViewStartWithPath(path); - - }); - if (mV2XWindowStatusListener != null) { - mV2XWindowStatusListener.onViewClose(); - } - } - @Override public void close() { //移除窗体 @@ -175,4 +113,14 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID public void destroy() { } + + @Override + public void videoPlayWithVideoUrl(String videoUrl) { + + } + + @Override + public void closeVideoWindow() { + + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt index 77cb118d27..cd246a5f61 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt @@ -36,7 +36,7 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer { super.init(context) coverImage = findViewById(R.id.thumbnail_image) start = findViewById(R.id.start) - fullscreen = findViewById(R.id.fullscreen) +// fullscreen = findViewById(R.id.fullscreen) if (mThumbImageViewLayout != null && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR) ) { diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml index 6c0898cf0f..ce6f2f91c1 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml @@ -1,71 +1,17 @@ - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml index cbfe283897..f10bc55235 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml @@ -17,19 +17,6 @@ android:layout_height="match_parent" android:layout_centerInParent="true" android:visibility="visible" /> - - - - - - - - - - - - - Date: Thu, 22 Oct 2020 21:40:53 +0800 Subject: [PATCH 5/6] no message --- .../v2x/adapter/V2XRoadVideoAdapter.java | 5 +-- .../scene/road/V2XRoadVideoWindow.java | 43 ++++++++++++++----- .../src/main/res/layout/window_road_video.xml | 2 +- ..._item.xml => window_road_video_layout.xml} | 7 +-- 4 files changed, 39 insertions(+), 18 deletions(-) rename modules/mogo-module-v2x/src/main/res/layout/{window_road_video_item.xml => window_road_video_layout.xml} (90%) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java index 9488f14e61..d4fe35c96e 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java @@ -12,12 +12,9 @@ import androidx.recyclerview.widget.RecyclerView; import com.mogo.module.v2x.R; import com.mogo.module.v2x.SimpleCoverVideoPlayer; -import com.mogo.module.v2x.listener.AdapterCallback; import com.mogo.module.v2x.listener.VideoAdapterCallBack; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; -import java.util.ArrayList; - public class V2XRoadVideoAdapter extends RecyclerView.Adapter { private static final String TAG = "V2XRoadVideoAdapter"; private final LayoutInflater shareLayoutInflater; @@ -36,7 +33,7 @@ public class V2XRoadVideoAdapter extends RecyclerView.Adapter { @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View v = shareLayoutInflater.inflate(R.layout.window_road_video_item, parent, + View v = shareLayoutInflater.inflate(R.layout.window_road_video_layout, parent, false); RoadVideoVH holder = new RoadVideoVH(v); return holder; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java index bc51d897bd..bf989b8921 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java @@ -38,9 +38,17 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private RecyclerView roadVideoRecyclerView; V2XRoadVideoAdapter mV2XRoadVideoAdapter; private V2XWindowStatusListener mV2XWindowStatusListener; + private ImageView playImageView; + private ImageView closeImage; + + private SimpleCoverVideoPlayer simpleCoverVideoPlayer; private Context mContext; + private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); + +// private Context mContext; + public V2XRoadVideoWindow() { this(V2XServiceManager.getContext(), null); } @@ -57,20 +65,19 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID public V2XRoadVideoWindow(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - initView(context); mContext = context; + initView(mContext); } private void initView(Context context) { - mContext = context; - LayoutInflater.from(mContext).inflate(R.layout.window_road_video, this); + LayoutInflater.from(mContext).inflate(R.layout.window_road_video_layout, this); initVideo(); - roadVideoRecyclerView = findViewById(R.id.video_recycleview); - mV2XRoadVideoAdapter = new V2XRoadVideoAdapter(mContext, this); - roadVideoRecyclerView.setAdapter(mV2XRoadVideoAdapter); - LinearLayoutManager linearLayoutManager = - new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false); - roadVideoRecyclerView.setLayoutManager(linearLayoutManager); + playImageView = this.findViewById(R.id.window_video_play); + simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView); + closeImage = this.findViewById(R.id.roadVideoClose); + closeImage.setOnClickListener(v -> { + + }); } @Override @@ -85,7 +92,23 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID return; } if (path.contains(".mp4")) { - mV2XRoadVideoAdapter.videoPlayWithVideoUrl(path); + playImageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) + .build(simpleCoverVideoPlayer); + simpleCoverVideoPlayer.getStartButton().performClick(); + } + + }); + simpleCoverVideoPlayer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) + .build(simpleCoverVideoPlayer); + simpleCoverVideoPlayer.getStartButton().performClick(); + } + }); } } diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml index ce6f2f91c1..2e61ee01a9 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml @@ -10,7 +10,7 @@ diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml similarity index 90% rename from modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml rename to modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml index f10bc55235..a89e378a3d 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_item.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml @@ -2,7 +2,9 @@ + android:layout_height="match_parent" + android:background="#99000000" + android:paddingStart="@dimen/module_main_v2x_animation_width"> + android:layout_centerInParent="true" /> Date: Fri, 23 Oct 2020 13:42:40 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=80=82=E9=85=8D?= =?UTF-8?q?=E7=88=B6=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/adapter/V2XRoadVideoAdapter.java | 86 ------------------ .../scene/road/V2XRoadVideoWindow.java | 40 +++------ .../module/v2x/view/SimpleCoverVideoPlayer.kt | 6 +- .../src/main/res/layout/window_road_video.xml | 87 ++++++++++++++++--- .../res/layout/window_road_video_layout.xml | 50 +++++------ 5 files changed, 111 insertions(+), 158 deletions(-) delete mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java deleted file mode 100644 index d4fe35c96e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.content.Context; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.SimpleCoverVideoPlayer; -import com.mogo.module.v2x.listener.VideoAdapterCallBack; -import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; - -public class V2XRoadVideoAdapter extends RecyclerView.Adapter { - private static final String TAG = "V2XRoadVideoAdapter"; - private final LayoutInflater shareLayoutInflater; - private VideoAdapterCallBack mCallback; - private SimpleCoverVideoPlayer simpleCoverVideoPlayer; - private Context mContext; - - private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); - - public V2XRoadVideoAdapter(Context context, VideoAdapterCallBack callback) { - mContext = context; - shareLayoutInflater = LayoutInflater.from(context); - mCallback = callback; - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View v = shareLayoutInflater.inflate(R.layout.window_road_video_layout, parent, - false); - RoadVideoVH holder = new RoadVideoVH(v); - return holder; - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - Log.d(TAG, "onBindViewHolder"); - } - - @Override - public int getItemCount() { - return 1; - } - - public void videoPlayWithVideoUrl(String videoUrl) { -// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) -// .build(simpleCoverVideoPlayer); -// simpleCoverVideoPlayer.getStartButton().performClick(); - } - - public class RoadVideoVH extends RecyclerView.ViewHolder { - private ImageView playImageView; - private ImageView closeImage; - - public RoadVideoVH(@NonNull View itemView) { - super(itemView); - playImageView = itemView.findViewById(R.id.window_video_play); - simpleCoverVideoPlayer = itemView.findViewById(R.id.roadVideoView); - closeImage = itemView.findViewById(R.id.roadVideoClose); - - playImageView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mCallback.videoPlayWithVideoUrl(""); - } - - }); - simpleCoverVideoPlayer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mCallback.videoPlayWithVideoUrl(""); - } - }); - closeImage.setOnClickListener(v -> { - mCallback.closeVideoWindow(); - }); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java index bf989b8921..36a9a38f4d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java @@ -1,42 +1,34 @@ package com.mogo.module.v2x.scenario.scene.road; import android.content.Context; -import android.graphics.Bitmap; import android.util.AttributeSet; -import android.util.Log; import android.view.LayoutInflater; -import android.view.TextureView; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import com.mogo.map.IDestroyable; import com.mogo.module.common.entity.MarkerExploreWayItem; import com.mogo.module.common.entity.V2XEventShowEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.v2x.R; -import com.mogo.module.v2x.SimpleCoverVideoPlayer; import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadVideoAdapter; import com.mogo.module.v2x.listener.V2XWindowStatusListener; import com.mogo.module.v2x.listener.VideoAdapterCallBack; import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.utils.BitmapHelper; +import com.mogo.module.v2x.view.SimpleCoverVideoPlayer; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; +import com.shuyu.gsyvideoplayer.utils.GSYVideoType; import java.util.ArrayList; import static com.mogo.module.v2x.VideoInitKt.initVideo; +import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL; public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, IDestroyable, VideoAdapterCallBack { private static final String TAG = "V2XRoadVideoWindow"; - private RecyclerView roadVideoRecyclerView; - V2XRoadVideoAdapter mV2XRoadVideoAdapter; private V2XWindowStatusListener mV2XWindowStatusListener; private ImageView playImageView; private ImageView closeImage; @@ -47,7 +39,6 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); -// private Context mContext; public V2XRoadVideoWindow() { this(V2XServiceManager.getContext(), null); @@ -74,9 +65,12 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID initVideo(); playImageView = this.findViewById(R.id.window_video_play); simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView); + GSYVideoType.setShowType(SCREEN_MATCH_FULL); + //mCurrentAspectRatio +// simpleCoverVideoPlayer. closeImage = this.findViewById(R.id.roadVideoClose); closeImage.setOnClickListener(v -> { - + close(); }); } @@ -92,23 +86,9 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID return; } if (path.contains(".mp4")) { - playImageView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) - .build(simpleCoverVideoPlayer); - simpleCoverVideoPlayer.getStartButton().performClick(); - } - - }); - simpleCoverVideoPlayer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) - .build(simpleCoverVideoPlayer); - simpleCoverVideoPlayer.getStartButton().performClick(); - } - }); + gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG) + .build(simpleCoverVideoPlayer); + simpleCoverVideoPlayer.getStartButton().performClick(); } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt index cd246a5f61..bf8302607e 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt @@ -1,4 +1,4 @@ -package com.mogo.module.v2x +package com.mogo.module.v2x.view import android.content.Context import android.util.AttributeSet @@ -34,9 +34,9 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer { override fun init(context: Context) { super.init(context) - coverImage = findViewById(R.id.thumbnail_image) + coverImage = findViewById(R.id.thumbImage) start = findViewById(R.id.start) -// fullscreen = findViewById(R.id.fullscreen) + fullscreen = findViewById(R.id.fullscreen) if (mThumbImageViewLayout != null && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR) ) { diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml index 2e61ee01a9..04c2ed5bb4 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video.xml @@ -1,17 +1,82 @@ + android:layout_height="match_parent"> - + android:layout_height="match_parent" + android:gravity="center"> - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml index a89e378a3d..6bfd64acd8 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml @@ -1,35 +1,28 @@ - + android:layout_height="@dimen/dp_674" + android:layout_marginTop="@dimen/dp_30" + android:layout_marginLeft="@dimen/dp_30" + android:layout_marginRight="@dimen/dp_30" + android:layout_marginBottom="@dimen/dp_327" + app:roundLayoutRadius="@dimen/dp_28" + android:background="#D9FFFFFF"> - - + android:layout_height="@dimen/dp_674" + android:layout_alignParentTop="true" + android:layout_alignParentBottom="true"/> + android:visibility="gone" /> + + - - \ No newline at end of file + \ No newline at end of file