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" />