增加了点击Marker的点击事件,Marker数据的绘制数量数据埋点
This commit is contained in:
@@ -16,11 +16,13 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.marker.MapMarkerAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
@@ -30,6 +32,7 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -54,6 +57,7 @@ public class MarkerServiceHandler {
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
@@ -65,6 +69,7 @@ public class MarkerServiceHandler {
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation();
|
||||
mMogoAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation();
|
||||
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
@@ -130,6 +135,10 @@ public class MarkerServiceHandler {
|
||||
return mMogoCardManager;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getMogoAnalytics() {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
|
||||
private static IMogoMarker lastMarker;
|
||||
|
||||
/**
|
||||
@@ -140,39 +149,85 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker:" + marker);
|
||||
if (lastMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if (marker.equals(lastMarker)) {
|
||||
Logger.w(TAG, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker);
|
||||
return false;
|
||||
try {
|
||||
if (lastMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if (marker.equals(lastMarker)) {
|
||||
Logger.w(TAG, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity:" + lastMarkerShowEntity);
|
||||
|
||||
lastMarkerShowEntity.setChecked(false);
|
||||
lastMarkerShowEntity.setHighlighted(false);
|
||||
|
||||
drawMapMarker(lastMarkerShowEntity);
|
||||
|
||||
lastMarker.remove();
|
||||
}
|
||||
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
// 将当前的Marker设置为选中
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker markerShowEntity:" + markerShowEntity);
|
||||
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity:" + lastMarkerShowEntity);
|
||||
markerShowEntity.setChecked(true);
|
||||
markerShowEntity.setHighlighted(true);
|
||||
|
||||
lastMarkerShowEntity.setChecked(false);
|
||||
lastMarkerShowEntity.setHighlighted(false);
|
||||
lastMarker = drawMapMarker(markerShowEntity);
|
||||
if (lastMarker != null) {
|
||||
lastMarker.setAlpha(1f);
|
||||
}
|
||||
|
||||
drawMapMarker(lastMarkerShowEntity);
|
||||
marker.remove();
|
||||
|
||||
lastMarker.remove();
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
switch (lastMarker.getOwner()) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
properties.put("type", 3);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
properties.put("type", 5);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
properties.put("type", 2);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
MarkerShowEntity showEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
properties.put("type", 4);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
properties.put("type", 8);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
properties.put("type", 7);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
properties.put("type", 9);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
properties.put("type", 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
properties.put("type", 6);
|
||||
break;
|
||||
}
|
||||
|
||||
getMogoAnalytics().track("Launcher_Icon_Click", properties);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 将当前的Marker设置为选中
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker markerShowEntity:" + markerShowEntity);
|
||||
|
||||
markerShowEntity.setChecked(true);
|
||||
markerShowEntity.setHighlighted(true);
|
||||
|
||||
lastMarker = drawMapMarker(markerShowEntity);
|
||||
if (lastMarker != null) {
|
||||
lastMarker.setAlpha(1f);
|
||||
}
|
||||
|
||||
marker.remove();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -246,6 +301,7 @@ public class MarkerServiceHandler {
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
analyticData(3, onlineCarList.size());
|
||||
}
|
||||
|
||||
if (exploreWayList != null) {
|
||||
@@ -262,6 +318,7 @@ public class MarkerServiceHandler {
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
analyticData(1, exploreWayList.size());
|
||||
}
|
||||
|
||||
if (shareMusicList != null) {
|
||||
@@ -277,9 +334,16 @@ public class MarkerServiceHandler {
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
analyticData(4, shareMusicList.size());
|
||||
}
|
||||
|
||||
if (noveltyInfoList != null) {
|
||||
int num_gas_station = 0;
|
||||
int num_traffic_check = 0;
|
||||
int num_road_closed = 0;
|
||||
int num_shop_discount = 0;
|
||||
int num_fours_shop = 0;
|
||||
|
||||
for (MarkerNoveltyInfo noveltyInfo : noveltyInfoList) {
|
||||
MarkerLocation markerLocation = noveltyInfo.getLocation();
|
||||
|
||||
@@ -290,13 +354,52 @@ public class MarkerServiceHandler {
|
||||
markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
switch (noveltyInfo.getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
num_gas_station++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
num_traffic_check++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
num_road_closed++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
num_shop_discount++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
num_fours_shop++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
analyticData(2, num_gas_station);
|
||||
analyticData(6, num_road_closed);
|
||||
analyticData(5, num_traffic_check);
|
||||
analyticData(7, num_shop_discount);
|
||||
analyticData(8, num_fours_shop);
|
||||
}
|
||||
}
|
||||
getMapUIController().changeZoom(12);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计地图内数据获取
|
||||
*
|
||||
* @param type 类型
|
||||
* @param num marker数量
|
||||
*/
|
||||
private static void analyticData(int type, int num) {
|
||||
try {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
properties.put("num", num);
|
||||
getMogoAnalytics().track("Launcher_Data_Get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker,这里绘制的会使用markerShowEntities队列进行维护
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user