From d1a77dc8ec0d329656be4def8e3c6362c4517958 Mon Sep 17 00:00:00 2001 From: liujing Date: Tue, 22 Sep 2020 10:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A2=E8=B7=AF=E4=BA=8B=E4=BB=B6=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E8=BF=81=E7=A7=BB=E5=88=B0v2x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/mogo-module-tanlu/build.gradle | 7 ++ .../tanlu/fragment/TanluListWindow.java | 74 +++++++------------ 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/modules/mogo-module-tanlu/build.gradle b/modules/mogo-module-tanlu/build.gradle index c1b444cdc9..293b941e74 100644 --- a/modules/mogo-module-tanlu/build.gradle +++ b/modules/mogo-module-tanlu/build.gradle @@ -51,6 +51,8 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.localbroadcastmanager + if (Boolean.valueOf(RELEASE)) { compileOnly rootProject.ext.dependencies.mogomap compileOnly rootProject.ext.dependencies.mogoutils @@ -72,6 +74,11 @@ dependencies { implementation rootProject.ext.dependencies.videoarm64 implementation rootProject.ext.dependencies.videojava implementation rootProject.ext.dependencies.eventbus + implementation project(path: ':modules:mogo-module-v2x') + implementation project(path: ':modules:mogo-module-v2x') + implementation project(path: ':modules:mogo-module-v2x') + implementation project(path: ':modules:mogo-module-v2x') + implementation project(path: ':modules:mogo-module-v2x') // if( Boolean.valueOf(RELEASE)){ // implementation rootProject.ext.dependencies.moduletanlulib diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java index cc757b123b..94ddeb31bc 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java @@ -20,6 +20,7 @@ import android.view.animation.LinearInterpolator; import android.widget.RelativeLayout; import androidx.annotation.NonNull; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.PagerSnapHelper; import androidx.recyclerview.widget.RecyclerView; @@ -53,6 +54,8 @@ import com.mogo.module.common.entity.MarkerExploreWayItem; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.MarkerUserInfo; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.tanlu.R; import com.mogo.module.tanlu.callback.DataSetChangedAdapter; import com.mogo.module.tanlu.callback.NaviCallback; @@ -79,6 +82,7 @@ import com.mogo.module.tanlu.model.event.VoiceControlUpInfo; import com.mogo.module.tanlu.util.Utils; import com.mogo.module.tanlu.view.NetErrorDialog; import com.mogo.module.tanlu.view.UploadFailedDialog; +import com.mogo.module.v2x.V2XConst; import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.analytics.IMogoAnalytics; @@ -365,15 +369,18 @@ 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 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()); + + V2XMessageEntity v2XMessageEntity = new V2XMessageEntity(); + v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); + v2XMessageEntity.setShowState(true); + + v2XMessageEntity.setContent(roadEventEntity); //更新数据 if (markerExploreWayList != null) { markerExploreWayList.clear(); @@ -382,43 +389,14 @@ 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(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); + intent.putExtra(V2XConst.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 properties = new HashMap<>(); + properties.put("type", "2"); + mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties); return false; } @@ -481,7 +459,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL if (mogoIntentManager != null) { // 同行者 xxx堵不堵唤醒词语音注册 Logger.d(TAG, "initListener===="); - mogoIntentManager.registerIntentListener(TXZ_SPECIFIEDROAD_SEARCH,mogoIntentListener); + mogoIntentManager.registerIntentListener(TXZ_SPECIFIEDROAD_SEARCH, mogoIntentListener); // 通用唤醒词语音注册 mogoIntentManager.registerIntentListener(SPECIFIEDROAD_SEARCH, mogoIntentListener); mogoIntentManager.registerIntentListener(PLAY_VIDEO_AWAKEN, mogoIntentListener); @@ -508,7 +486,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL // 直接执行相关查询操作 Logger.d(TAG, "智慧出行在前台,可直接分享--->"); realShare(intentStr, intent); - }else{ + } else { // 需要打开智慧驾驶,然后执行操作 Logger.d(TAG, "智慧出行没在前台,需要打开 --->"); intent.setAction(Intent.ACTION_VIEW); @@ -522,7 +500,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL } }; - public void realShare(String intentStr, Intent intent){ + public void realShare(String intentStr, Intent intent) { String data = intent.getStringExtra("data"); Logger.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data); VoiceCmdData voiceData = null; @@ -1085,7 +1063,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL } if (!NetworkUtils.isConnected(getContext())) { //没有网络 - TipToast.shortTip("分享失败,请检查网络",new TipDrawable(getResources().getDrawable(R.drawable.module_tanlu_upload_fail))); + TipToast.shortTip("分享失败,请检查网络", new TipDrawable(getResources().getDrawable(R.drawable.module_tanlu_upload_fail))); } else { float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度 Logger.d(TAG, "onMarkerInfo event.type = " + event.type + " >>event.lat = " + event.lat + " >>event.lon = " + event.lon + " >>event.imageUrl =" + event.imageUrl); @@ -1100,7 +1078,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL String.format(voiceShareSuccessTts, getMathRandom())), null); TipToast.shortTip("分享成功", new TipDrawable(getResources().getDrawable(R.drawable.module_tanlu_upload_success))); - if(TanluServiceManager.getMogoStatusManager().isMainPageOnResume()) { + if (TanluServiceManager.getMogoStatusManager().isMainPageOnResume()) { double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); Log.d(TAG, "onMarkerInfo lat = " + lat + " >>>> lon = " + lon);