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