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 71648a7e63..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; - -public class V2XRoadVideoAdapter extends RecyclerView.Adapter { - - private V2XEventShowEntity mV2XEventShowEntity; - - public V2XRoadVideoAdapter(){ - - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return null; - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - - } - - @Override - public int getItemCount() { - return 0; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index 3b9156143c..6e76ee2823 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -280,10 +280,16 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { * */ private void showRoadVideoInfo(V2XEventShowEntity v2XEventShowEntity){ if (v2XEventShowEntity != null){ + /* + * MarkerExploreWay 具体事件 + * V2XRoadEventEntity 包含MarkerExploreWay 事件的二次封装(tts播报内容 事件类型等) + * V2XMessageEntity 三次封装(是否进行事件与本机连线 是否显示通话功能等) + * V2XEventShowEntity 包含V2XRoadEventEntity + * */ Log.d(TAG,"马上展示图片/视频资源"); - V2XMessageEntity> v2XMessageEntity = new V2XMessageEntity<>(); + V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); + v2XMessageEntity.setContent(v2XEventShowEntity); V2XRoadVideoCarScenario.getInstance().init(v2XMessageEntity); - V2XRoadVideoWindow window = (V2XRoadVideoWindow) V2XRoadVideoCarScenario.getInstance().getV2XWindow(); } } /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java index 9da2ab1f68..a95eaefc08 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java @@ -144,7 +144,7 @@ public interface IMoGoV2XStatusManager extends IProvider { /* * 道路事件图片/视频资源 全屏 * */ - void setV2XRoadVideoInfoWindowShow(String tag, boolean show); + void setV2XRoadVideoWindowShow(String tag, boolean show); /** * 设置 模拟直播车机 UI 是否在展示 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java index 286a4afc5c..1a80dcaebe 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java @@ -171,7 +171,7 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager { } @Override - public void setV2XRoadVideoInfoWindowShow(String tag, boolean show) { + public void setV2XRoadVideoWindowShow(String tag, boolean show) { mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show); invokeStatusChangedListener(V2XStatusDescriptor.V2XRoadVideo_UI, show); recordStatusModifier(tag, V2XStatusDescriptor.V2XRoadVideo_UI); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java index db1a19a891..542af49cd4 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java @@ -6,77 +6,61 @@ import android.view.ViewGroup; import androidx.annotation.Nullable; -import com.mogo.map.IDestroyable; -import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.V2XEventShowEntity; import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.R; -import com.mogo.module.v2x.adapter.V2XRoadVideoAdapter; +import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarWindow; import com.mogo.module.v2x.scenario.view.IV2XWindow; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.service.windowview.IMogoTopViewStatusListener; -import com.mogo.utils.logger.Logger; - -import java.util.List; import javax.security.auth.DestroyFailedException; import javax.security.auth.Destroyable; -public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopViewStatusListener, Destroyable { +public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopViewStatusListener, Destroyable { private static V2XRoadVideoCarScenario sV2XRoadVideoCarScenario; - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Log.d(TAG, "init"); - try { - sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow()); - setV2XMessageEntity(v2XMessageEntity); - show(); - } catch (Exception e) { - e.printStackTrace(); - } - } + private static String TAG = "V2XRoadVideoCarScenario"; public static V2XRoadVideoCarScenario getInstance() { if (sV2XRoadVideoCarScenario == null) { synchronized (V2XRoadVideoCarScenario.class) { - sV2XRoadVideoCarScenario = new V2XRoadVideoCarScenario(); + if (sV2XRoadVideoCarScenario == null) { + sV2XRoadVideoCarScenario = new V2XRoadVideoCarScenario(); + sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow()); + } + } } return new V2XRoadVideoCarScenario(); } + @Override + public void init(@Nullable V2XMessageEntity v2XMessageEntity) { + try { + setV2XMessageEntity(v2XMessageEntity); + show(); + } catch (Exception e) { + Log.d(TAG, "pppp" + e.getMessage()); + e.printStackTrace(); + } + } + @Override public void show() { - if (getV2XMessageEntity() != null) { - showWindow(); - } + showWindow(); } @Override public void showWindow() { - Log.d(TAG, "showWindow"); - MarkerExploreWay markerExploreWay = null; if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground)); + getV2XWindow().show(getV2XMessageEntity().getContent()); V2XServiceManager - .getMogoTopViewManager() - .addSubView(getV2XWindow().getView(), this); - sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow(V2XServiceManager.getContext())); - ((V2XRoadVideoWindow) getV2XWindow()).showWithEntity(markerExploreWay); - V2XServiceManager.getMoGoV2XStatusManager(). - setV2XRoadVideoInfoWindowShow( - "https://haokan.baidu.com/v?vid=11239381022041270821&pd=bjh&fr=bjhauthor&type=video", - true); + .getIMogoWindowManager() + .addView(getV2XWindow().getView(), 0, 0, false); + V2XServiceManager.getMoGoV2XStatusManager().setV2XRoadVideoWindowShow(TAG, true); } } @@ -119,7 +103,6 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopV @Override public void onViewAdded(View view) { - Log.d(TAG, "onViewAdded"); } 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 5f8c036dbb..d8f482e9a1 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,74 +1,56 @@ package com.mogo.module.v2x.scenario.scene.road; import android.content.Context; +import android.net.Uri; import android.util.AttributeSet; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; -import android.widget.RelativeLayout; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; +import androidx.constraintlayout.widget.ConstraintLayout; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.adapter.V2XRoadVideoAdapter; import com.mogo.module.v2x.listener.V2XWindowStatusListener; import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.V2XUtils; +import com.mogo.module.v2x.view.TextureVideoView; -import java.util.ArrayList; -import java.util.List; -public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow { +public class V2XRoadVideoWindow extends ConstraintLayout implements IV2XWindow { private static final String TAG = "V2XRoadVideoWindow"; - private RecyclerView mRecyclerView; - private V2XRoadVideoAdapter mV2XRoadVideoAdapter; - private List mItemList = new ArrayList<>(); + private V2XWindowStatusListener mV2XWindowStatusListener; + private TextureVideoView mVideoView; + private V2XMessageEntity mV2XMessageEntity; public V2XRoadVideoWindow() { - this(V2XServiceManager.getContext()); + this(V2XServiceManager.getContext(), null); } public V2XRoadVideoWindow(Context context) { - super(context); + this(context, null); + } + + public V2XRoadVideoWindow(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public V2XRoadVideoWindow(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); initView(context); } private void initView(Context context) { - Log.d(TAG, "初始化视频播放器"); - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadVideoAdapter = new V2XRoadVideoAdapter(); - mRecyclerView.setAdapter(mV2XRoadVideoAdapter); // 填充布局 LayoutInflater.from(context).inflate(R.layout.window_road_video, this); - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - } - - public void showWithEntity(MarkerExploreWay markerExploreWay) { - show(markerExploreWay); + mVideoView = findViewById(R.id.roadVideoView); } @Override public void show(Object entity) { - if (entity != null) { - mV2XRoadVideoAdapter.notifyDataSetChanged(); - } - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) V2XUtils.getApp() - .getResources() - .getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - - // 添加弹窗 - V2XServiceManager.getMogoTopViewManager().addView(this, layoutParams); + mV2XMessageEntity = (V2XMessageEntity) entity; +// String path = + mVideoView.setVideoPath("https://haokan.baidu.com/v?vid=11239381022041270821&pd=bjh&fr=bjhauthor&type=video"); } @Override @@ -78,11 +60,11 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow { @Override public View getView() { - return null; + return this; } @Override public void setWindowStatusListener(V2XWindowStatusListener listener) { - + this.mV2XWindowStatusListener = listener; } } 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 44752d3b5a..146a46e559 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,13 +1,18 @@ - + android:layout_height="match_parent" + android:id="@+id/roadVideoLayout" + android:background="#000000"> + android:background="@color/live_video_progress_bar_loading_color" + android:padding="@dimen/dp_30" + android:layout_marginTop="@dimen/dp_30"> - \ No newline at end of file + \ No newline at end of file