图片+视频(无进度和暂停)

This commit is contained in:
liujing
2020-10-13 14:17:54 +08:00
parent 3f28efaf3e
commit 430388b61e
4 changed files with 47 additions and 14 deletions

View File

@@ -40,7 +40,8 @@ class StrategyServiceModel : BaseRepository() {
// }
// }
//
// suspend fun getSplashConfig(): BaseResponse<SplashConfig> {
// suspend fun getSplashConfig(): BaseR
// esponse<SplashConfig> {
// return apiCall {
// var splashConfigRequest =
// SplashConfigRequest("1", "1")

View File

@@ -21,6 +21,7 @@ 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.service.imageloader.MogoImageView;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
@@ -36,6 +37,7 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
private V2XWindowStatusListener mV2XWindowStatusListener;
private TextureVideoView mVideoView;
private ImageView closeImage;
private MogoImageView bigImage;
public V2XRoadVideoWindow() {
this(V2XServiceManager.getContext(), null);
@@ -57,6 +59,7 @@ 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);
bigImage = findViewById(R.id.big_image);
closeImage = findViewById(R.id.roadVideoClose);
closeImage.setOnClickListener(v -> {
close();
@@ -74,8 +77,10 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
if (path == null) {
return;
}
mVideoView.setVideoPath(path);
if (path != null) {
if (path.contains(".mp4")) {
mVideoView.setVisibility(VISIBLE);
bigImage.setVisibility(View.GONE);
mVideoView.setVideoPath(path);
mVideoView.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "全屏准备。。。。。");
});
@@ -86,7 +91,13 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
}
});
mVideoView.start();
} else {
bigImage.setVisibility(View.VISIBLE);
mVideoView.setVisibility(View.GONE);
V2XServiceManager.getImageLoader()
.displayImage(path, bigImage);
}
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#FFFFFF" android:startColor="#FFFFFF" />
<corners android:radius="@dimen/dp_28" />
</shape>
</item>
</selector>

View File

@@ -14,16 +14,17 @@
android:layout_margin="@dimen/dp_30"
app:roundLayoutRadius="@dimen/dp_28">
<com.mogo.module.v2x.view.TextureVideoView
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/live_video_progress_bar_loading_color"
android:clickable="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></com.mogo.module.v2x.view.TextureVideoView>
<com.mogo.module.v2x.view.TextureVideoView
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/live_video_progress_bar_loading_color"
android:clickable="false"
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/roadVideoClose"
@@ -33,7 +34,18 @@
android:layout_alignRight="@+id/roadVideoView"
android:src="@drawable/v2x_panel_close" />
</com.mogo.module.v2x.view.TextureVideoView>
</com.mogo.module.v2x.view.RoundLayout>
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/big_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_30"
android:background="@drawable/v2x_bg_big_image_dark"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>