视频适配父布局
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
) {
|
||||
|
||||
@@ -1,17 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/window_road_video"
|
||||
android:id="@+id/item_video_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#99000000"
|
||||
android:paddingStart="@dimen/module_main_v2x_animation_width">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/video_recycleview"
|
||||
tools:listitem="@layout/window_road_video_layout"
|
||||
<RelativeLayout
|
||||
android:id="@+id/surface_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/v2x_icon_live_logo"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!--局部播放器-->
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dp_260"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@null"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
android:maxHeight="@dimen/dp_6"
|
||||
android:minHeight="@dimen/dp_6"
|
||||
android:thumb="@null" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="60px"
|
||||
android:layout_height="60px"
|
||||
android:scaleType="centerInside" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateDrawable="@drawable/live_error"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,35 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#99000000"
|
||||
android:background="#00000000"
|
||||
android:paddingStart="@dimen/module_main_v2x_animation_width">
|
||||
|
||||
<com.mogo.module.v2x.view.RoundLayout
|
||||
android:id="@+id/rlRoadEventList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/dp_30"
|
||||
app:roundLayoutRadius="@dimen/dp_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">
|
||||
|
||||
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer
|
||||
android:id="@+id/roadVideoView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/thumbnail_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/v2x_bg_big_image_dark"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:layout_height="@dimen/dp_674"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/window_video_play"
|
||||
@@ -37,14 +30,15 @@
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/v2x_icon_event_play"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/roadVideoClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:src="@drawable/v2x_panel_close" />
|
||||
</com.mogo.module.v2x.view.RoundLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/roadVideoClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/rlRoadEventList"
|
||||
android:layout_alignRight="@+id/rlRoadEventList"
|
||||
android:src="@drawable/v2x_panel_close" />
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user