add product manager
This commit is contained in:
@@ -751,10 +751,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.setADASUIShow( ServiceConst.TYPE, status == 1 );
|
||||
} else if ( Intent.ACTION_POWER_CONNECTED.equals( command ) ) {
|
||||
mStatusManager.setAccStatus( ServiceConst.TYPE, true );
|
||||
Logger.d( TAG, "acc status: %s", true );
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( command ) ) {
|
||||
mStatusManager.setAccStatus( ServiceConst.TYPE, false );
|
||||
Logger.d( TAG, "acc status: %s", false );
|
||||
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( command ) ) {
|
||||
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
|
||||
Logger.d( TAG, "acc status: %s", state == 1 );
|
||||
mStatusManager.setAccStatus( ServiceConst.TYPE, state == 1 );
|
||||
} else if ( MogoReceiver.ACTION_VOICE_UI.equals( command ) ) {
|
||||
String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS );
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ServiceConst {
|
||||
/**
|
||||
* 20 s
|
||||
*/
|
||||
public static final int DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT = 20 * 1_000;
|
||||
public static final int DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT = 30 * 1_000;
|
||||
|
||||
/**
|
||||
* 所有卡片显示的每类点的最大数据量
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
@@ -36,193 +37,145 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
private ConstraintLayout clMarkerContent;
|
||||
private ImageView ivReverseTriangle;
|
||||
|
||||
public MapMarkerInfoView(Context context) {
|
||||
super(context);
|
||||
public MapMarkerInfoView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
super(context);
|
||||
public MapMarkerInfoView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
updateView(markerShowEntity);
|
||||
updateView( markerShowEntity );
|
||||
}
|
||||
|
||||
protected void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker_info, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
clMarkerContent = findViewById(R.id.clMarkerContent);
|
||||
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
tvMarkerContent = findViewById(R.id.tvMarkerContent);
|
||||
protected void initView( Context context ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.view_map_marker_info, this );
|
||||
ivUserHead = findViewById( R.id.ivUserHead );
|
||||
ivIcon = findViewById( R.id.ivIcon );
|
||||
clMarkerContent = findViewById( R.id.clMarkerContent );
|
||||
ivReverseTriangle = findViewById( R.id.ivReverseTriangle );
|
||||
ivCar = findViewById( R.id.ivCar );
|
||||
tvMarkerContent = findViewById( R.id.tvMarkerContent );
|
||||
}
|
||||
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
try {
|
||||
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
|
||||
clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info );
|
||||
ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow );
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
|
||||
ivUserHead.setVisibility( View.VISIBLE );
|
||||
ivIcon.setVisibility( View.INVISIBLE );
|
||||
loadImageWithMarker( markerShowEntity );
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
//ivCar.setRotation(new Random().nextInt(360));
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
|
||||
if (bindObj instanceof MarkerOnlineCar) {
|
||||
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
} else {
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
|
||||
}
|
||||
}
|
||||
|
||||
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
ivUserHead.setVisibility( View.INVISIBLE );
|
||||
ivIcon.setVisibility( View.VISIBLE );
|
||||
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
if ( bindObj instanceof MarkerExploreWay ) {
|
||||
switch ( ( ( MarkerExploreWay ) bindObj ).getPoiType() ) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_refuel);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_orange_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_orange);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_refuel );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_green_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_green);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_check2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_off2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shop_discount);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_red_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_red);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shop_discount );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_4s);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_4s );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_work);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_work2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_pondingl);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_pondingl2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP_FREE:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shop);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_green_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_green);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shop );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_dark_frog2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_grey_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_grey);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_dark_frog2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_freeze2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_freeze2_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_parking2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_parking2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_accident2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_red_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_red);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_accident3_light );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_NEALY:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_living_light );
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivUserHead.setVisibility( View.INVISIBLE );
|
||||
ivIcon.setVisibility( View.VISIBLE );
|
||||
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
|
||||
if (bindObj instanceof MarkerShareMusic) {
|
||||
if ( bindObj instanceof MarkerShareMusic ) {
|
||||
// 2 为书籍听书,3 为新闻,1 为qq音乐,int
|
||||
switch (((MarkerShareMusic) bindObj).getShareType()) {
|
||||
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
|
||||
case 1:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
|
||||
break;
|
||||
case 2:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
|
||||
break;
|
||||
case 3:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
|
||||
if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) {
|
||||
String content;
|
||||
if (markerShowEntity.getTextContent().length() > 8) {
|
||||
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
|
||||
if ( markerShowEntity.getTextContent().length() > 8 ) {
|
||||
content = markerShowEntity.getTextContent().substring( 0, 7 ) + "...";
|
||||
} else {
|
||||
content = markerShowEntity.getTextContent();
|
||||
}
|
||||
tvMarkerContent.setText(content);
|
||||
tvMarkerContent.setText( content );
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,19 +222,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
trackData( mLastDataResult );
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是语音搜索的在线车辆数据:目前根据返回数据判断
|
||||
*
|
||||
* @param markerCardResult
|
||||
* @return
|
||||
*/
|
||||
private boolean isOnlineCarDataOnly( MarkerCardResult markerCardResult ) {
|
||||
if ( markerCardResult != null && markerCardResult.getDataType() != null && markerCardResult.getDataType().size() == 1 && markerCardResult.getDataType().contains( ServiceConst.CARD_TYPE_USER_DATA ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型绘制
|
||||
*
|
||||
@@ -260,12 +247,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*/
|
||||
private void drawAllMarker( MarkerCardResult markerCardResult ) {
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
// List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
// drawShareMusicMarker( shareMusicList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
drawNoveltyMarker( noveltyInfoList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,6 +301,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
int size = getAppropriateSize( maxAmount, exploreWayList );
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
Logger.i( TAG, "existCarMap: size = %d", existCarMap.size() );
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerExploreWay markerExploreWay = exploreWayList.get( i );
|
||||
if ( !markerExploreWay.getCanLive() ) {
|
||||
@@ -332,6 +316,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
String sn = getCarSnFromEntity( markerExploreWay );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
Logger.d( TAG, "draw road condition, sn = %s", sn );
|
||||
drawMapMarker( markerShowEntity );
|
||||
}
|
||||
}
|
||||
@@ -453,7 +438,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} else if ( entity instanceof MarkerNoveltyInfo ) {
|
||||
return ( ( MarkerNoveltyInfo ) entity ).getSn();
|
||||
} else if ( entity instanceof MarkerExploreWay ) {
|
||||
return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn();
|
||||
return ( ( MarkerExploreWay ) entity ).getInfoId();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
@@ -494,76 +479,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return;
|
||||
}
|
||||
JSONArray array = new JSONArray();
|
||||
List< MarkerOnlineCar > onlineCarList = markerCardResult.getOnlineCar();
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_USER_DATA, size );
|
||||
int size = 0;
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 ) {
|
||||
return;
|
||||
@@ -585,12 +506,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if ( mLastDataResult == null ) {
|
||||
return;
|
||||
}
|
||||
// List<MarkerOnlineCar> onlineCarList = mLastDataResult.getOnlineCar();
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = mLastDataResult.getNoveltyInfo();
|
||||
// dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ?new ArrayList<>() : onlineCarList);
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ? new ArrayList<>() : noveltyInfoList );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
@@ -31,156 +32,137 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
|
||||
private ImageView ivBg;
|
||||
|
||||
public MapMarkerView(Context context) {
|
||||
super(context);
|
||||
public MapMarkerView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapMarkerView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapMarkerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
super(context);
|
||||
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
updateView(markerShowEntity);
|
||||
updateView( markerShowEntity );
|
||||
}
|
||||
|
||||
protected void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
ivBg = findViewById(R.id.ivBg);
|
||||
clMarkerTopView = findViewById(R.id.clMarkerTopView);
|
||||
protected void initView( Context context ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.view_map_marker, this );
|
||||
ivUserHead = findViewById( R.id.ivUserHead );
|
||||
ivIcon = findViewById( R.id.ivIcon );
|
||||
ivCar = findViewById( R.id.ivCar );
|
||||
ivBg = findViewById( R.id.ivBg );
|
||||
clMarkerTopView = findViewById( R.id.clMarkerTopView );
|
||||
}
|
||||
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
try {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
ivBg.setImageResource( R.drawable.bg_map_marker_dark );
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
ivUserHead.setVisibility( View.VISIBLE );
|
||||
ivIcon.setVisibility( View.INVISIBLE );
|
||||
loadImageWithMarker( markerShowEntity );
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
|
||||
// ivCar.setRotation(new Random().nextInt(360));
|
||||
clMarkerTopView.setVisibility(View.GONE);
|
||||
if (bindObj instanceof MarkerOnlineCar) {
|
||||
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
clMarkerTopView.setVisibility( View.GONE );
|
||||
if ( bindObj instanceof MarkerOnlineCar ) {
|
||||
if ( ( ( MarkerOnlineCar ) bindObj ).getUserInfo().getGenderValue() == 0 ) {
|
||||
} else {
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivUserHead.setVisibility( View.INVISIBLE );
|
||||
ivIcon.setVisibility( View.VISIBLE );
|
||||
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
|
||||
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
if ( bindObj instanceof MarkerExploreWay ) {
|
||||
switch ( ( ( MarkerExploreWay ) bindObj ).getPoiType() ) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_refuel);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_oragne);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_refuel );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_check2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_off2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shop_discount);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_red);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shop_discount );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_4s);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_4s );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_work);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_work2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_pondingl);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_pondingl2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP_FREE:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shop);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green_dark);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shop );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_dark_frog);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_dark_frog2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_freeze);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_parking);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_freeze2 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_accident);
|
||||
ivIcon.setImageResource( R.drawable.module_service_ic_rc_accident3 );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_NEALY:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_living );
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
ivUserHead.setVisibility( View.INVISIBLE );
|
||||
ivIcon.setVisibility( View.VISIBLE );
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
|
||||
|
||||
if (bindObj instanceof MarkerShareMusic) {
|
||||
if ( bindObj instanceof MarkerShareMusic ) {
|
||||
// 2 为书籍听书,3 为新闻,1 为qq音乐,int
|
||||
switch (((MarkerShareMusic) bindObj).getShareType()) {
|
||||
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
|
||||
case 1:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
|
||||
break;
|
||||
case 2:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
|
||||
break;
|
||||
case 3:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user