Merge remote-tracking branch 'origin/feature/v1.0.4' into feature/v1.0.4

This commit is contained in:
ihoudf
2020-04-22 20:26:38 +08:00
21 changed files with 645 additions and 324 deletions

View File

@@ -787,13 +787,9 @@ public class MogoServices implements IMogoMapListener,
mStatusManager.setVoiceUIShow( TAG, true );
}
} else if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
if ( mStatusManager.isMainPageOnResume() ) {
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
}
onActionDown( MogoAction.Next );
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
if ( mStatusManager.isMainPageOnResume() ) {
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
}
onActionDown( MogoAction.Prev );
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
} else if ( MogoReceiver.ACTION_ADAS_STATUS.equals( command ) ) {
@@ -884,9 +880,9 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onCmdSelected( String cmd ) {
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
onActionDown( MogoAction.Prev );
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
onActionDown( MogoAction.Next );
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) {
if ( mStatusManager.isMainPageOnResume() ) {
mUiController.recoverLockMode();
@@ -896,6 +892,19 @@ public class MogoServices implements IMogoMapListener,
}
}
private void onActionDown(MogoAction action){
if ( !mStatusManager.isMainPageOnResume() ) {
return;
}
if ( mStatusManager.isADASShow() ) {
// 分发到V2X
mActionManager.invoke( "V2X_UI", action );
} else {
String biz = MapMarkerManager.getInstance().getCurrentModuleName();
mActionManager.invoke( biz, action );
}
}
@Override
public void onCmdAction( String speakText ) {

View File

@@ -12,6 +12,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.entity.MarkerCarPois;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -143,49 +144,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if (!result) {
return false;
}
// 数据统计代码
final Map<String, Object> properties = new HashMap<>();
switch (mLastCheckMarker.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) mLastCheckMarker.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_4S:
properties.put("type", 10);
break;
}
}
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
properties.put("type", 6);
break;
}
MarkerServiceHandler.getMogoAnalytics().track("Launcher_Icon_Click", properties);
} catch (Exception e) {
e.printStackTrace();
}
@@ -638,48 +596,69 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
int size = onlineCarList == null ? 0 : onlineCarList.size();
fillNumberTrackEventBody(array, 3, size);
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_USER_DATA, size);
size = exploreWayList == null ? 0 : exploreWayList.size();
fillNumberTrackEventBody(array, 1, size);
size = shareMusicList == null ? 0 : shareMusicList.size();
fillNumberTrackEventBody(array, 4, size);
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;
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_ROAD_CONDITION, size);
size = noveltyInfoList == null ? 0 : noveltyInfoList.size();
JSONObject novelty = fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_NOVELTY, size);
if (noveltyInfoList != null) {
Map<String, Integer> counter = new HashMap<>( );
for (MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList) {
if (markerNoveltyInfo == null) {
continue;
}
switch (markerNoveltyInfo.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_4S:
num_fours_shop++;
break;
String childType = markerNoveltyInfo.getPoiType();
if ( !counter.containsKey( childType ) ) {
counter.put( childType, 0 );
}
int s = counter.get( childType ).intValue();
counter.put( childType, s+1 );
}
if ( !counter.isEmpty() ) {
JSONArray onlineCarJsonArray = new JSONArray();
for ( Map.Entry< String, Integer > entry : counter.entrySet() ) {
fillPoiChildTypeTrackBody(onlineCarJsonArray, entry.getKey(), entry.getValue());
}
if ( onlineCarJsonArray.length() > 0 ) {
try {
novelty.put( "content", onlineCarJsonArray );
} catch ( JSONException e ) {
e.printStackTrace();
}
}
}
}
fillNumberTrackEventBody(array, 2, num_gas_station);
fillNumberTrackEventBody(array, 6, num_road_closed);
fillNumberTrackEventBody(array, 5, num_traffic_check);
fillNumberTrackEventBody(array, 7, num_shop_discount);
fillNumberTrackEventBody(array, 8, num_fours_shop);
size = shareMusicList == null ? 0 : shareMusicList.size();
JSONObject shareMusic = fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_SHARE_MUSIC, size);
if (shareMusicList != null) {
Map<String, Integer> counter = new HashMap<>( );
for (MarkerShareMusic markerShareMusic : shareMusicList) {
if (markerShareMusic == null) {
continue;
}
String childType = markerShareMusic.getShareType()+"";
if ( !counter.containsKey( childType ) ) {
counter.put( childType, 0 );
}
int s = counter.get( childType ).intValue();
counter.put( childType, s+1 );
}
if ( !counter.isEmpty() ) {
JSONArray shareMusicJsonArray = new JSONArray();
for ( Map.Entry< String, Integer > entry : counter.entrySet() ) {
fillPoiChildTypeTrackBody(shareMusicJsonArray, entry.getKey(), entry.getValue());
}
if ( shareMusicJsonArray.length() > 0 ) {
try {
shareMusic.put( "content", shareMusicJsonArray );
} catch ( JSONException e ) {
e.printStackTrace();
}
}
}
}
try {
if (array.length() == 0) {
@@ -732,13 +711,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
/**
* 统计埋点
* 大而全数据计数埋点
*/
private synchronized static void fillNumberTrackEventBody(JSONArray arr, int type, int size) {
private synchronized static JSONObject fillPoiTypeTrackBody( JSONArray arr, String poiType, int poiTypeNum) {
JSONObject object = new JSONObject();
try {
object.put("type", type);
object.put("num", size);
object.put("poitype", poiType);
object.put("num", poiTypeNum);
if (arr != null) {
arr.put(object);
}
return object;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
private synchronized static void fillPoiChildTypeTrackBody(JSONArray arr, String childType, int childTypeNum){
JSONObject object = new JSONObject();
try {
object.put("contenttype", childType);
object.put("num", childTypeNum);
if (arr != null) {
arr.put(object);
}