Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangcongtao
2020-10-20 11:21:21 +08:00
18 changed files with 441 additions and 55 deletions

View File

@@ -28,6 +28,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@@ -645,7 +646,12 @@ public class BitmapHelper {
Bitmap b = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource( filePath );
retriever = new MediaMetadataRetriever();
if (Build.VERSION.SDK_INT >= 14)
retriever.setDataSource(filePath, new HashMap<String, String>());
else
retriever.setDataSource(filePath);
// mediaMetadataRetriever.setDataSource(videoPath);
b = retriever.getFrameAtTime();
} catch ( IllegalArgumentException e ) {
e.printStackTrace();

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

@@ -373,15 +373,24 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
GSYVideoManager.releaseAllVideos();
initVideo();
releaseTimer();
//埋点
Map<String, Object> properties = new HashMap<>();
properties.put("type", "2");
mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties);
//点击的marker的具体数据
MarkerExploreWay exploreWay = extractFromMarker(marker);
V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity();
roadEventEntity.setNoveltyInfo(exploreWay);
roadEventEntity.setPoiType(exploreWay.getPoiType());
roadEventEntity.setExpireTime(20000);
//地理位置
MarkerLocation location = exploreWay.getLocation();
roadEventEntity.setLocation(location);
V2XMessageEntity v2XMessageEntity = new V2XMessageEntity();
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
v2XMessageEntity.setShowState(true);
v2XMessageEntity.setOnlyShow(true);
v2XMessageEntity.setNeedAddLine(false);
v2XMessageEntity.setContent(roadEventEntity);
//更新数据
if (markerExploreWayList != null) {
markerExploreWayList.clear();
@@ -390,48 +399,20 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
}
markerExploreWayList.add(exploreWay);
boolean isAdd = TanluServiceManager.getIMogoTopViewManager().isViewAdded(TanluListWindow.this);
hideWindowTimerStart();
Logger.d(TAG, "onMarkerClicked ------ isAdd = " + isAdd);
Intent intent = new Intent(Const.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
//添加window窗口,重复创建
if (!isAdd) {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) getContext().getResources().getDimension((R.dimen.tanlu_module_card_height)));
TanluServiceManager.getIMogoTopViewManager().addView(TanluListWindow.this, layoutParams, new IMogoTopViewStatusListener() {
@Override
public void onViewAdded(View view) {
Logger.d(TAG, "onViewAdded -------->");
}
@Override
public void onViewRemoved(View view) {
Logger.e(TAG, "onViewRemoved -------->");
releaseTimer();
releaseAction();
}
@Override
public void beforeViewAddAnim(View view) {
}
@Override
public void beforeViewRemoveAnim(View view) {
}
});
}
renderCardViews();
//埋点
Map<String, Object> properties = new HashMap<>();
properties.put("type", "2");
mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties);
return false;
}
});
}
private CountDownTimer mHideWindowTimer;
private void hideWindowTimerStart() {

View File

@@ -23,6 +23,8 @@ import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadVideoCarScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadVideoWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.SpanUtils;
@@ -76,6 +78,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private MarkerExploreWay mNoveltyInfo;
private V2XRoadEventEntity mV2XRoadEventEntity;
private V2XEventShowEntity mV2XEventShowEntity;
private V2XRoadVideoCarScenario mV2XRoadVideoCarScenario;
// 拨打车聊聊语音回调
private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() {
@@ -163,7 +166,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@Override
public void onViewDetachedFromWindow(View v) {
Log.d(TAG,"onViewDetachedFromWindow unRegister");
Log.d(TAG, "onViewDetachedFromWindow unRegister");
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
@@ -194,6 +197,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
mUserInfo = mNoveltyInfo.getUserInfo();
if (!ArrayUtils.isEmpty(mNoveltyInfo.getItems())) {
String imgUrl = mNoveltyInfo.getItems().get(0).getThumbnail();
String url = mNoveltyInfo.getItems().get(0).getUrl();
if (TextUtils.isEmpty(imgUrl)) {
imgUrl = mNoveltyInfo.getItems().get(0).getUrl();
}
@@ -201,6 +205,19 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
V2XServiceManager.getImageLoader()
.displayImage(imgUrl, ivEventImg);
}
if (url.contains(".mp4")) {
ivEventImg.setOnClickListener(v -> {
showRoadVideoInfo(v2XEventShowEntity);
});
ivEventPlay.setOnClickListener(v -> {
showRoadVideoInfo(v2XEventShowEntity);
});
ivEventPlay.setVisibility(VISIBLE);
} else {
ivEventImg.setOnClickListener(null);
ivEventPlay.setOnClickListener(null);
ivEventPlay.setVisibility(GONE);
}
}
if (mNoveltyInfo.getUserInfo() != null &&
!TextUtils.isEmpty(mNoveltyInfo.getUserInfo().getUserHead())) {
@@ -270,6 +287,24 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
/*
* 展示事件的图片/视频资源
* */
private void showRoadVideoInfo(V2XEventShowEntity v2XEventShowEntity) {
if (v2XEventShowEntity != null) {
/*
* MarkerExploreWay 具体事件
* V2XRoadEventEntity 包含MarkerExploreWay 事件的二次封装(tts播报内容 事件类型等)
* V2XMessageEntity 三次封装(是否进行事件与本机连线 是否显示通话功能等)
* V2XEventShowEntity 包含V2XRoadEventEntity
* */
Log.d(TAG, "马上展示图片/视频资源全屏");
V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>();
v2XMessageEntity.setContent(v2XEventShowEntity);
V2XRoadVideoCarScenario.getInstance().init(v2XMessageEntity);
}
}
/**
* 展示直播信息
*

View File

@@ -141,6 +141,11 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
void setV2XAnimationWindowShow(String tag, boolean show);
/*
* 道路事件图片/视频资源 全屏
* */
void setV2XRoadVideoWindowShow(String tag, boolean show);
/**
* 设置 模拟直播车机 UI 是否在展示
*

View File

@@ -53,6 +53,11 @@ public enum V2XStatusDescriptor {
*/
LiveCarWindow_UI,
/**
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
V2XRoadVideo_UI,
/**
* 推送的POI
*/

View File

@@ -170,6 +170,13 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.V2XAnimationWindow_UI);
}
@Override
public void setV2XRoadVideoWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.V2XRoadVideo_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.V2XRoadVideo_UI);
}
@Override
public void setLiveCarWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.LiveCarWindow_UI, show);

View File

@@ -87,8 +87,10 @@ public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V
default:
Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId());
}
String path = "https://v.youku.com/v_show/id_XNjAzNzI3MDA0.html";
if (videoUri != null) {
// vvCarAnimation.setVideoPath(path);
vvCarAnimation.setVideoURI(videoUri);
vvCarAnimation.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "场景动画准备。。。。。");

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.scenario.scene.livecar;
import android.util.Log;
import android.view.View;
import com.mogo.module.common.entity.V2XEventShowEntity;
@@ -74,6 +75,7 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
@Override
public void showWindow() {
Log.d(TAG,getV2XWindow().toString());
if (getV2XWindow() != null) {
V2XServiceManager
.getMogoTopViewManager()

View File

@@ -0,0 +1,132 @@
package com.mogo.module.v2x.scenario.scene.road;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
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.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import javax.security.auth.DestroyFailedException;
import javax.security.auth.Destroyable;
public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity> implements IMogoTopViewStatusListener, Destroyable {
private static V2XRoadVideoCarScenario sV2XRoadVideoCarScenario;
private static String TAG = "V2XRoadVideoCarScenario";
public static V2XRoadVideoCarScenario getInstance() {
if (sV2XRoadVideoCarScenario == null) {
synchronized (V2XRoadVideoCarScenario.class) {
if (sV2XRoadVideoCarScenario == null) {
sV2XRoadVideoCarScenario = new V2XRoadVideoCarScenario();
sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow());
}
}
}
return sV2XRoadVideoCarScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XEventShowEntity> v2XMessageEntity) {
try {
setV2XMessageEntity(v2XMessageEntity);
show();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void show() {
showWindow();
}
@Override
public void showWindow() {
if (getV2XWindow() != null) {
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager
.getIMogoWindowManager()
.addView(getV2XWindow().getView(), 0, 0, false);
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setV2XRoadVideoWindowShow(TAG, false);
}
@Override
public void showButton() {
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
}
@Override
public void clearPOI() {
Log.d(TAG, "clearPOI");
}
@Override
public void destroy() throws DestroyFailedException {
Log.d(TAG, "destroy");
}
@Override
public boolean isDestroyed() {
Log.d(TAG, "isDestroyed");
return false;
}
@Override
public void onViewAdded(View view) {
Log.d(TAG, "onViewAdded");
}
@Override
public void onViewRemoved(View view) {
Log.d(TAG, "onViewRemoved");
}
@Override
public void beforeViewAddAnim(View view) {
Log.d(TAG, "beforeViewAddAnim");
}
@Override
public void beforeViewRemoveAnim(View view) {
Log.d(TAG, "beforeViewRemoveAnim");
}
}

View File

@@ -0,0 +1,143 @@
package com.mogo.module.v2x.scenario.scene.road;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.mogo.map.IDestroyable;
import com.mogo.module.common.entity.MarkerExploreWayItem;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
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.utils.BitmapHelper;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, IDestroyable {
private static final String TAG = "V2XRoadVideoWindow";
private V2XWindowStatusListener mV2XWindowStatusListener;
private TextureVideoView mVideoView;
private ImageView closeImage;
private ImageView mThumbnailImageView;
private ImageView windowPalyImageView;
public V2XRoadVideoWindow() {
this(V2XServiceManager.getContext(), null);
}
public V2XRoadVideoWindow(Context 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) {
LayoutInflater.from(context).inflate(R.layout.window_road_video, this);
mVideoView = findViewById(R.id.roadVideoView);
closeImage = findViewById(R.id.roadVideoClose);
mThumbnailImageView = findViewById(R.id.thumbnail_image);
windowPalyImageView = findViewById(R.id.window_video_play);
closeImage.setOnClickListener(v -> {
close();
});
}
@Override
public void show(Object entity) {
V2XEventShowEntity showEntity = (V2XEventShowEntity) entity;
V2XRoadEventEntity xRoadEventEntity = showEntity.getV2XRoadEventEntity();
ArrayList list = (ArrayList) xRoadEventEntity.getNoveltyInfo().getItems();
if (list.size() > 0) {
MarkerExploreWayItem item = (MarkerExploreWayItem) list.get(0);
String path = item.getUrl();
if (path == null) {
return;
}
if (path.contains(".mp4")) {
videoViewStartWithPath(path);
mVideoView.setOnCompletionListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "视频播放结束...");
videoPlayEnd(path);
});
}
}
}
/*
* 视频开始播放
* */
private void videoViewStartWithPath(String path) {
mVideoView.setVisibility(VISIBLE);
mVideoView.setVideoPath(path);
mVideoView.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "全屏准备。。。。。");
mThumbnailImageView.setVisibility(View.GONE);
windowPalyImageView.setVisibility(View.GONE);
});
mVideoView.start();
}
/*
* 视频播放结束
* */
private void videoPlayEnd(String path){
Bitmap bitmap = BitmapHelper.getVideoThumbnail(path);
mThumbnailImageView.setVisibility(View.VISIBLE);
mThumbnailImageView.setImageBitmap(bitmap);
windowPalyImageView.setVisibility(View.VISIBLE);
windowPalyImageView.setOnClickListener(v -> {
videoViewStartWithPath(path);
});
if (mV2XWindowStatusListener != null) {
mV2XWindowStatusListener.onViewClose();
}
}
@Override
public void close() {
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
}
@Override
public View getView() {
return this;
}
@Override
public void setWindowStatusListener(V2XWindowStatusListener listener) {
this.mV2XWindowStatusListener = listener;
}
@Override
public void destroy() {
}
}

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

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rlContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/v2x_alert_window_bg"
android:paddingStart="@dimen/dp_62"
android:paddingTop="@dimen/dp_42"

View File

@@ -3,17 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/v2x_alert_window_bg"
android:padding="@dimen/dp_25">
android:paddingStart="@dimen/dp_62"
android:paddingTop="@dimen/dp_42"
android:paddingEnd="@dimen/dp_62"
android:paddingBottom="@dimen/dp_42">
<TextView
android:id="@+id/tvImgTextContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/module_v2x_surrounding_item_bottom_image_height"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_7"
android:background="@drawable/bg_v2x_event_type_orange"
android:gravity="center_vertical"
@@ -101,7 +102,6 @@
android:id="@+id/ivFaultHelpEventNavi"
android:layout_width="@dimen/module_v2x_event_button_size"
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginRight="@dimen/dp_54"
android:src="@drawable/selector_nav_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -4,10 +4,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rvRoadEventList"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:orientation="vertical"
android:layout_height="match_parent"
android:orientation="horizontal"
android:overScrollMode="never"
android:padding="@dimen/module_v2x_widow_top_gaps"
tools:itemCount="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_v2x_fault_help" />

View File

@@ -7,5 +7,6 @@
android:layout_height="@dimen/module_v2x_event_window_height_ground"
android:orientation="horizontal"
android:overScrollMode="never"
android:padding="@dimen/module_v2x_widow_top_gaps"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_v2x_push_event_detail" />

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/window_road_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000"
android:paddingStart="@dimen/module_main_v2x_animation_width">
<com.mogo.module.v2x.view.RoundLayout
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
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.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:visibility="gone"
android:scaleType="fitXY"
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:visibility="gone"
android:src="@drawable/v2x_icon_event_play"/>
</com.mogo.module.v2x.view.RoundLayout>
<ImageView
android:id="@+id/roadVideoClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/rlRoadEventList"
android:layout_alignRight="@+id/rlRoadEventList"
android:src="@drawable/v2x_panel_close" />
</RelativeLayout>

View File

@@ -97,4 +97,5 @@
<dimen name="module_v2x_event_parking_text_size">34px</dimen>
<!--适配 V2X 弹窗 UI-->
</resources>