From 2259342a8954e9f1597d1f13886f03a3d108aefa Mon Sep 17 00:00:00 2001 From: liujing Date: Mon, 28 Sep 2020 15:32:23 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=99=A8adapter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/adapter/V2XRoadVideoAdapter.java | 34 +++++++++++++++++++ .../scene/road/V2XRoadVideoCarScenario.java | 6 ++-- .../scene/road/V2XRoadVideoWindow.java | 28 ++++++++++++--- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java 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 new file mode 100644 index 0000000000..71648a7e63 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadVideoAdapter.java @@ -0,0 +1,34 @@ +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/scenario/scene/road/V2XRoadVideoCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java index 0bf15e15b1..db1a19a891 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 @@ -7,11 +7,13 @@ 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.scenario.impl.AbsV2XScenario; import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarWindow; import com.mogo.module.v2x.scenario.view.IV2XWindow; @@ -52,7 +54,6 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopV @Override public void show() { - Log.d(TAG,getV2XMessageEntity().toString()+"content-----"+getV2XMessageEntity().getContent()); if (getV2XMessageEntity() != null) { showWindow(); } @@ -61,6 +62,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopV @Override public void showWindow() { Log.d(TAG, "showWindow"); + MarkerExploreWay markerExploreWay = null; if (getV2XWindow() != null) { ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( @@ -70,7 +72,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopV .getMogoTopViewManager() .addSubView(getV2XWindow().getView(), this); sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow(V2XServiceManager.getContext())); - getV2XWindow().show(getV2XMessageEntity().getContent()); + ((V2XRoadVideoWindow) getV2XWindow()).showWithEntity(markerExploreWay); V2XServiceManager.getMoGoV2XStatusManager(). setV2XRoadVideoInfoWindowShow( "https://haokan.baidu.com/v?vid=11239381022041270821&pd=bjh&fr=bjhauthor&type=video", 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 dbe97d1830..5f8c036dbb 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 @@ -5,26 +5,31 @@ 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 com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.V2XEventShowEntity; 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 java.util.ArrayList; import java.util.List; public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow { private static final String TAG = "V2XRoadVideoWindow"; private RecyclerView mRecyclerView; - private V2XRoadEventAdapter mV2XRoadEventAdapter; - private List mItemList; + private V2XRoadVideoAdapter mV2XRoadVideoAdapter; + private List mItemList = new ArrayList<>(); public V2XRoadVideoWindow() { this(V2XServiceManager.getContext()); @@ -38,17 +43,32 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow { private void initView(Context context) { Log.d(TAG, "初始化视频播放器"); mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); + 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); + } + @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); } @Override