优化了点击道路事件的视频播放方式

This commit is contained in:
董宏宇
2020-11-03 13:36:20 +08:00
parent ea6fd32ea8
commit f6473a8d31
3 changed files with 59 additions and 65 deletions

View File

@@ -57,9 +57,14 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity>
public void showWindow() {
if (getV2XWindow() != null) {
getV2XWindow().show(getV2XMessageEntity().getContent());
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources()
.getDimension(R.dimen.v2x_video_window_height));
V2XServiceManager
.getIMogoWindowManager()
.addView(getV2XWindow().getView(), 0, 0, false);
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
}
}

View File

@@ -30,10 +30,11 @@ import java.util.ArrayList;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL;
/*
https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档
* */
public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, IDestroyable, VideoAdapterCallBack {
/**
https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档
*/
public class V2XRoadVideoWindow extends RelativeLayout implements
IV2XWindow, IDestroyable, VideoAdapterCallBack {
private static final String TAG = "V2XRoadVideoWindow";
private V2XWindowStatusListener mV2XWindowStatusListener;
@@ -92,9 +93,9 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
});
}
/*
/**
* 开始播放
* */
*/
private void startPlayWithVideoUrl(String videoUrl) {
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
.build(simpleCoverVideoPlayer);
@@ -103,9 +104,9 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
playImageView.setVisibility(View.GONE);
}
/*
/**
* 暂停
* */
*/
private void pause() {
playImageView.setVisibility(View.VISIBLE);
thumbnailImage.setVisibility(View.GONE);
@@ -117,18 +118,18 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
});
}
/*
/**
* 继续
* */
*/
private void resume() {
playImageView.setImageResource(R.drawable.v2x_video_pause);
playImageView.setVisibility(View.GONE);
thumbnailImage.setVisibility(View.GONE);
}
/*
/**
* 播放结束后
* */
*/
private void complete(Bitmap firstbitmap, String path) {
thumbnailImage.setVisibility(View.VISIBLE);
thumbnailImage.setImageBitmap(firstbitmap);
@@ -262,8 +263,8 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
public void close() {
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
.getMogoTopViewManager()
.removeViewNoLinkage(this);
}
@Override

View File

@@ -1,58 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.module.v2x.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:paddingStart="@dimen/module_main_v2x_animation_width">
android:layout_height="@dimen/v2x_video_window_height_content"
android:background="@drawable/v2x_alert_window_bg"
app:roundLayoutRadius="@dimen/dp_60">
<com.mogo.module.v2x.view.RoundLayout
android:id="@+id/rlRoadEventList"
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_674"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_327"
android:background="@drawable/module_v2x_shadow_bkg"
app:roundLayoutRadius="@dimen/dp_28">
android:layout_height="@dimen/dp_200"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:clickable="true" />
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_674"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:clickable="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="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<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="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/window_video_play"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:src="@drawable/v2x_icon_event_play"
android:visibility="gone" />
<ImageView
android:id="@+id/window_video_play"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:src="@drawable/v2x_icon_event_play"
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>
</FrameLayout>
<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>