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 2cd94ed6b8..9c3eeca3df 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 @@ -370,47 +370,47 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL }); //监听marker点击 - mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() { - @Override - public boolean onMarkerClicked(IMogoMarker marker) { - - //点击的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(); - } else { - markerExploreWayList = new ArrayList<>(); - } - markerExploreWayList.add(exploreWay); - - Intent intent = new Intent(Const.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); - - //埋点 - Map properties = new HashMap<>(); - properties.put("type", "2"); - mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties); - - return false; - } - }); +// mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() { +// @Override +// public boolean onMarkerClicked(IMogoMarker marker) { +// +// //点击的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(); +// } else { +// markerExploreWayList = new ArrayList<>(); +// } +// markerExploreWayList.add(exploreWay); +// +// Intent intent = new Intent(Const.BROADCAST_SCENE_HANDLER_ACTION); +// intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); +// LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); +// +// //埋点 +// Map properties = new HashMap<>(); +// properties.put("type", "2"); +// mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties); +// +// return false; +// } +// }); } private CountDownTimer mHideWindowTimer; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java index 986804044a..8c0bd97968 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java @@ -61,6 +61,7 @@ public class V2XConst { public static final String V2X_ROAD_EVET = "v2x_road_event"; public static final String V2X_ROAD_EVET_HISTORY_BUTTON = "V2X_button_click"; public static final String V2X_ROAD_PRODUCE = "v2x_road_produce"; + public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click"; /** * V2X 道路事件操作类型 */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java index 4fdf2ba1f5..7f97170eda 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java @@ -1,9 +1,11 @@ package com.mogo.module.v2x; import android.content.Context; +import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.provider.Settings; +import android.util.Log; import android.view.MotionEvent; import android.view.View; @@ -15,13 +17,19 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.MogoLatLng; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; +import com.mogo.map.marker.MogoMarkersHandler; import com.mogo.map.model.MogoPoi; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.map.uicontroller.EnumMapUI; +import com.mogo.module.common.ModuleNames; import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.utils.Const; import com.mogo.module.v2x.entity.net.V2XSeekHelpRes; import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; import com.mogo.module.v2x.network.V2XRefreshCallback; @@ -31,6 +39,7 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario; import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow; import com.mogo.module.v2x.utils.FatigueDrivingUtils; import com.mogo.module.v2x.utils.TimeUtils; +import com.mogo.module.v2x.utils.TrackUtils; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.module.v2x.voice.V2XVoiceManager; import com.mogo.service.module.IMogoModuleLifecycle; @@ -42,6 +51,10 @@ import com.mogo.utils.logger.Logger; import com.mogo.utils.network.utils.GsonUtil; import com.mogo.utils.storage.SharedPrefsMgr; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import static com.mogo.module.v2x.V2XConst.MODULE_NAME; /** @@ -182,6 +195,20 @@ public class V2XModuleProvider implements }); } + private MarkerExploreWay extractFromMarker(IMogoMarker marker) { + if (marker == null) { + return null; + } + if (marker.getObject() instanceof MarkerShowEntity) { + MarkerShowEntity showEntity = ((MarkerShowEntity) marker.getObject()); + if (showEntity.getBindObj() instanceof MarkerExploreWay) { + return ((MarkerExploreWay) showEntity.getBindObj()); + } + } + + return null; + } + /** * 注册各种监听 */ @@ -194,6 +221,40 @@ public class V2XModuleProvider implements V2XServiceManager.getMoGoStatusManager() .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this); + V2XServiceManager + .getMogoRegisterCenter().registerMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION, new IMogoMarkerClickListener() { + @Override + public boolean onMarkerClicked(IMogoMarker marker) { + + Log.d(TAG,"onMarkerClicked2222"); + //点击的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); + + Intent intent = new Intent(Const.BROADCAST_SCENE_HANDLER_ACTION); + intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); + LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); + + //埋点 + TrackUtils.trackV2XMarkerClick(2); + + return false; + } + }); // 响应违章停车的POI点击 V2XServiceManager @@ -278,7 +339,7 @@ public class V2XModuleProvider implements if (result != null) { V2XSeekHelpRes.ResultBean resultBean = result.getResult(); if (resultBean != null) { - Logger.d(MODULE_NAME, "刷新自车求助状态 resultBean:"+resultBean); + Logger.d(MODULE_NAME, "刷新自车求助状态 resultBean:" + resultBean); int vehicleType = resultBean.getVehicleType(); //故障车 if (vehicleType == 4) { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java index 2fcce52d42..0f79252630 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java @@ -77,4 +77,15 @@ public class TrackUtils { e.printStackTrace(); } } + + public static void trackV2XMarkerClick(int type) { + try { + Map properties = new HashMap<>(); + properties.put("type", type); + V2XServiceManager.getMogoAnalytics().track(V2XConst.LAUNCHER_ICON_CLICK, properties); + } catch (Exception e) { + e.printStackTrace(); + } + } + }