[add] 视频播放器adapter
This commit is contained in:
@@ -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 <RecyclerView.ViewHolder> {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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<V2XEventShowEntity> mItemList;
|
||||
private V2XRoadVideoAdapter mV2XRoadVideoAdapter;
|
||||
private List<V2XEventShowEntity> 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
|
||||
|
||||
Reference in New Issue
Block a user