Merge remote-tracking branch 'origin/feature/v2.0.0' into feature/v2.0.0
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -51,7 +51,7 @@ public class MogoApplication extends AbsMogoApplication {
|
|||||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
crashSystem.setDebug(BuildConfig.DEBUG);
|
||||||
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
||||||
|
|
||||||
MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||||
MogoModulePaths.addModule(new MogoModule(PATH_AGREEMENT_FRAGMENT, PATH_AGREEMENT_MODULE_NAME));
|
MogoModulePaths.addModule(new MogoModule(PATH_AGREEMENT_FRAGMENT, PATH_AGREEMENT_MODULE_NAME));
|
||||||
|
|
||||||
//运营位卡片,需要默认显示,放在第一个加载
|
//运营位卡片,需要默认显示,放在第一个加载
|
||||||
|
|||||||
@@ -34,33 +34,33 @@ public interface IMogoVoiceCmdCallBack {
|
|||||||
*
|
*
|
||||||
* @param cmd
|
* @param cmd
|
||||||
*/
|
*/
|
||||||
void onCmdSelected( String cmd );
|
default void onCmdSelected( String cmd ){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语音播报临时免唤醒“确定”命令
|
* 语音播报临时免唤醒“确定”命令
|
||||||
*
|
*
|
||||||
* @param speakText 播报内容
|
* @param speakText 播报内容
|
||||||
*/
|
*/
|
||||||
void onCmdAction( String speakText );
|
default void onCmdAction( String speakText ){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语音播报临时免唤醒“取消”命令
|
* 语音播报临时免唤醒“取消”命令
|
||||||
*
|
*
|
||||||
* @param speakText 播报内容
|
* @param speakText 播报内容
|
||||||
*/
|
*/
|
||||||
void onCmdCancel( String speakText );
|
default void onCmdCancel( String speakText ){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语音播报完毕
|
* 语音播报完毕
|
||||||
*
|
*
|
||||||
* @param speakText 播报内容
|
* @param speakText 播报内容
|
||||||
*/
|
*/
|
||||||
void onSpeakEnd( String speakText );
|
default void onSpeakEnd( String speakText ){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语音播报完临时命令选择超时
|
* 语音播报完临时命令选择超时
|
||||||
*
|
*
|
||||||
* @param speakText 播报内容
|
* @param speakText 播报内容
|
||||||
*/
|
*/
|
||||||
void onSpeakSelectTimeOut( String speakText );
|
default void onSpeakSelectTimeOut( String speakText ){}
|
||||||
}
|
}
|
||||||
@@ -56,9 +56,9 @@ MOGO_MODULE_GUIDE_VERSION=1.0.3.12
|
|||||||
# 探路
|
# 探路
|
||||||
MOGO_MODULE_TANLU_VERSION=1.0.5.6
|
MOGO_MODULE_TANLU_VERSION=1.0.5.6
|
||||||
# 车聊聊
|
# 车聊聊
|
||||||
CARCHATTING_VERSION=1.0.3.2-SNAPSHOT
|
CARCHATTING_VERSION=1.0.4-SNAPSHOT
|
||||||
# 车聊聊接口
|
# 车聊聊接口
|
||||||
CARCHATTINGPROVIDER_VERSION=1.0.3.2-SNAPSHOT
|
CARCHATTINGPROVIDER_VERSION=1.0.4-SNAPSHOT
|
||||||
# 视频引导
|
# 视频引导
|
||||||
MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT
|
MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT
|
||||||
# 视频引导接口
|
# 视频引导接口
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class CalculatePathItem {
|
|||||||
return mPath.getLabels();
|
return mPath.getLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
public String getFormattedTime() {
|
||||||
if ( mTimeBuilder == null ) {
|
if ( mTimeBuilder == null ) {
|
||||||
final int time = mPath.getAllTime();
|
final int time = mPath.getAllTime();
|
||||||
mTimeBuilder = new StringBuilder();
|
mTimeBuilder = new StringBuilder();
|
||||||
@@ -64,6 +64,14 @@ public class CalculatePathItem {
|
|||||||
return mTimeBuilder.toString();
|
return mTimeBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTime(){
|
||||||
|
return mPath.getAllTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistance(){
|
||||||
|
return mPath.getAllLength();
|
||||||
|
}
|
||||||
|
|
||||||
private StringBuilder mTimeBuilder;
|
private StringBuilder mTimeBuilder;
|
||||||
|
|
||||||
private void fillFormatTime( int seconds, StringBuilder builder ) {
|
private void fillFormatTime( int seconds, StringBuilder builder ) {
|
||||||
@@ -83,7 +91,7 @@ public class CalculatePathItem {
|
|||||||
|
|
||||||
private String mDistanceCacheStr = "";
|
private String mDistanceCacheStr = "";
|
||||||
|
|
||||||
public String getDistance() {
|
public String getFormattedDistance() {
|
||||||
if ( TextUtils.isEmpty( mDistanceCacheStr ) ) {
|
if ( TextUtils.isEmpty( mDistanceCacheStr ) ) {
|
||||||
int distance = mPath.getAllLength();
|
int distance = mPath.getAllLength();
|
||||||
if ( distance == -1 ) {
|
if ( distance == -1 ) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.amap.api.maps.model.LatLng;
|
|||||||
import com.amap.api.maps.model.LatLngBounds;
|
import com.amap.api.maps.model.LatLngBounds;
|
||||||
import com.amap.api.maps.model.Marker;
|
import com.amap.api.maps.model.Marker;
|
||||||
import com.amap.api.maps.model.MarkerOptions;
|
import com.amap.api.maps.model.MarkerOptions;
|
||||||
import com.amap.api.maps.model.MarkerOptionsCreator;
|
|
||||||
import com.amap.api.maps.model.Polyline;
|
import com.amap.api.maps.model.Polyline;
|
||||||
import com.amap.api.navi.AMapNavi;
|
import com.amap.api.navi.AMapNavi;
|
||||||
import com.amap.api.navi.model.AMapNaviLocation;
|
import com.amap.api.navi.model.AMapNaviLocation;
|
||||||
@@ -21,15 +20,12 @@ import com.amap.api.navi.model.AMapNaviPath;
|
|||||||
import com.amap.api.navi.model.NaviInfo;
|
import com.amap.api.navi.model.NaviInfo;
|
||||||
import com.amap.api.navi.model.NaviLatLng;
|
import com.amap.api.navi.model.NaviLatLng;
|
||||||
import com.mogo.map.MogoLatLng;
|
import com.mogo.map.MogoLatLng;
|
||||||
import com.mogo.map.MogoMap;
|
|
||||||
import com.mogo.map.impl.amap.AMapWrapper;
|
import com.mogo.map.impl.amap.AMapWrapper;
|
||||||
import com.mogo.map.impl.amap.R;
|
import com.mogo.map.impl.amap.R;
|
||||||
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
|
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
|
||||||
import com.mogo.map.marker.MogoMarkerOptions;
|
|
||||||
import com.mogo.map.marker.MogoMarkersHandler;
|
import com.mogo.map.marker.MogoMarkersHandler;
|
||||||
import com.mogo.map.navi.MogoCalculatePath;
|
import com.mogo.map.navi.MogoCalculatePath;
|
||||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||||
import com.mogo.utils.UiThreadHandler;
|
|
||||||
import com.mogo.utils.WindowUtils;
|
import com.mogo.utils.WindowUtils;
|
||||||
import com.mogo.utils.logger.Logger;
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
@@ -394,10 +390,12 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
|||||||
if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
|
if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
|
||||||
for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
||||||
MogoCalculatePath path = new MogoCalculatePath();
|
MogoCalculatePath path = new MogoCalculatePath();
|
||||||
path.setDistance( calculatePathItem.getDistance() );
|
path.setFormattedDistance( calculatePathItem.getFormattedDistance() );
|
||||||
path.setPathId( calculatePathItem.getId() );
|
path.setPathId( calculatePathItem.getId() );
|
||||||
path.setStrategyName( calculatePathItem.getStrategyName() );
|
path.setStrategyName( calculatePathItem.getStrategyName() );
|
||||||
|
path.setFormattedTime( calculatePathItem.getFormattedTime() );
|
||||||
path.setTime( calculatePathItem.getTime() );
|
path.setTime( calculatePathItem.getTime() );
|
||||||
|
path.setDistance( calculatePathItem.getDistance() );
|
||||||
List< NaviLatLng > coordList = calculatePathItem.getPath().getCoordList();
|
List< NaviLatLng > coordList = calculatePathItem.getPath().getCoordList();
|
||||||
ArrayList< MogoLatLng > mogoLatLngs = new ArrayList<>();
|
ArrayList< MogoLatLng > mogoLatLngs = new ArrayList<>();
|
||||||
for ( NaviLatLng latlng : coordList
|
for ( NaviLatLng latlng : coordList
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
|||||||
if ( marker == null ) {
|
if ( marker == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !mServicesMarkers.containsKey( tag ) ) {
|
if ( mServicesMarkers.get( tag ) == null ) {
|
||||||
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
||||||
}
|
}
|
||||||
mServicesMarkers.get( tag ).add( marker );
|
mServicesMarkers.get( tag ).add( marker );
|
||||||
@@ -96,7 +96,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
|||||||
if ( markers == null || markers.isEmpty() ) {
|
if ( markers == null || markers.isEmpty() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !mServicesMarkers.containsKey( tag ) ) {
|
if ( mServicesMarkers.get( tag ) == null ) {
|
||||||
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
mServicesMarkers.put( tag, new ArrayList< IMogoMarker >() );
|
||||||
}
|
}
|
||||||
mServicesMarkers.get( tag ).addAll( markers );
|
mServicesMarkers.get( tag ).addAll( markers );
|
||||||
|
|||||||
@@ -11,44 +11,44 @@ public interface IMogoNaviListener {
|
|||||||
/**
|
/**
|
||||||
* 导航初始化失败
|
* 导航初始化失败
|
||||||
*/
|
*/
|
||||||
void onInitNaviFailure();
|
default void onInitNaviFailure(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航初始化成功
|
* 导航初始化成功
|
||||||
*/
|
*/
|
||||||
void onInitNaviSuccess();
|
default void onInitNaviSuccess(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航引导信息
|
* 导航引导信息
|
||||||
*
|
*
|
||||||
* @param naviinfo
|
* @param naviinfo
|
||||||
*/
|
*/
|
||||||
void onNaviInfoUpdate( MogoNaviInfo naviinfo );
|
default void onNaviInfoUpdate( MogoNaviInfo naviinfo ){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航开始回调
|
* 导航开始回调
|
||||||
*/
|
*/
|
||||||
void onStartNavi();
|
default void onStartNavi(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航停止:包括到达目的地和主动停止导航
|
* 导航停止:包括到达目的地和主动停止导航
|
||||||
*/
|
*/
|
||||||
void onStopNavi();
|
default void onStopNavi(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路径规划成功
|
* 路径规划成功
|
||||||
*/
|
*/
|
||||||
void onCalculateSuccess();
|
default void onCalculateSuccess(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路径规划失败
|
* 路径规划失败
|
||||||
*/
|
*/
|
||||||
void onoCalculateFailed();
|
default void onoCalculateFailed(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 巡航信息发生改变
|
* 巡航信息发生改变
|
||||||
* Deprecated, use {@link IMogoAimlessModeListener#onUpdateTraffic2(MogoTraffic)} instead.
|
* Deprecated, use {@link IMogoAimlessModeListener#onUpdateTraffic2(MogoTraffic)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void onUpdateTraffic( MogoTraffic traffic );
|
default void onUpdateTraffic( MogoTraffic traffic ){}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ public interface IMogoNaviListener2 extends IMogoNaviListener {
|
|||||||
/**
|
/**
|
||||||
* 实际导航结束
|
* 实际导航结束
|
||||||
*/
|
*/
|
||||||
void onArriveDestination();
|
default void onArriveDestination() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟导航结束
|
* 模拟导航结束
|
||||||
*/
|
*/
|
||||||
void onEndEmulatorNavi();
|
default void onEndEmulatorNavi(){}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ public class MogoCalculatePath {
|
|||||||
/**
|
/**
|
||||||
* 时间
|
* 时间
|
||||||
*/
|
*/
|
||||||
private String mTime;
|
private String mFormattedTime;
|
||||||
|
private int mTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 距离
|
* 距离
|
||||||
*/
|
*/
|
||||||
private String mDistance;
|
private String mFormattedDistance;
|
||||||
|
private int mDistance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 红绿灯个数
|
* 红绿灯个数
|
||||||
@@ -69,20 +71,20 @@ public class MogoCalculatePath {
|
|||||||
this.mStrategyName = mStrategyName;
|
this.mStrategyName = mStrategyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
public String getFormattedTime() {
|
||||||
return mTime;
|
return mFormattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime( String mTime ) {
|
public void setFormattedTime( String mTime ) {
|
||||||
this.mTime = mTime;
|
this.mFormattedTime = mTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDistance() {
|
public String getFormattedDistance() {
|
||||||
return mDistance;
|
return mFormattedDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistance( String mDistance ) {
|
public void setFormattedDistance( String mDistance ) {
|
||||||
this.mDistance = mDistance;
|
this.mFormattedDistance = mDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTrafficLights() {
|
public int getTrafficLights() {
|
||||||
@@ -125,4 +127,22 @@ public class MogoCalculatePath {
|
|||||||
public void setPathId( int mPathId ) {
|
public void setPathId( int mPathId ) {
|
||||||
this.mPathId = mPathId;
|
this.mPathId = mPathId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTime() {
|
||||||
|
return mTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MogoCalculatePath setTime( int time ) {
|
||||||
|
this.mTime = time;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistance() {
|
||||||
|
return mDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MogoCalculatePath setDistance( int distance ) {
|
||||||
|
this.mDistance = distance;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.mogo.map;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.mogo.map.impl.amap.InterceptorHandler;
|
|
||||||
import com.mogo.map.impl.amap.overlay.RouteOverlayHelper;
|
import com.mogo.map.impl.amap.overlay.RouteOverlayHelper;
|
||||||
import com.mogo.map.marker.IMogoMarker;
|
import com.mogo.map.marker.IMogoMarker;
|
||||||
import com.mogo.map.marker.IMogoMarkerManager;
|
import com.mogo.map.marker.IMogoMarkerManager;
|
||||||
@@ -54,6 +53,7 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
|||||||
try {
|
try {
|
||||||
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
|
return MogoMap.getInstance().getMogoMap().addMarker( tag, options );
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, Log.getStackTraceString( e ) );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
|||||||
private IMogoModuleProvider mSearchProvider;
|
private IMogoModuleProvider mSearchProvider;
|
||||||
|
|
||||||
private IMogoAnalytics mMogoAnalytics;
|
private IMogoAnalytics mMogoAnalytics;
|
||||||
private DiscreteScrollView scroller;
|
// private DiscreteScrollView scroller;
|
||||||
|
|
||||||
private static int CARD_SIZE = 6;
|
private static int CARD_SIZE = 6;
|
||||||
private AppIndicatorAdapter appIndicatorAdapter;
|
private AppIndicatorAdapter appIndicatorAdapter;
|
||||||
@@ -76,19 +76,19 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
|||||||
|
|
||||||
mApps = findViewById(R.id.module_apps_id_apps);
|
mApps = findViewById(R.id.module_apps_id_apps);
|
||||||
|
|
||||||
scroller = findViewById(R.id.module_apps_id_scroller);
|
// scroller = findViewById(R.id.module_apps_id_scroller);
|
||||||
|
//
|
||||||
scroller.setRatio(330 / 523F);
|
// scroller.setRatio(330 / 523F);
|
||||||
//scroller.setRatio(176/279F);
|
// //scroller.setRatio(176/279F);
|
||||||
scroller.setSlideOnFling(true);
|
// scroller.setSlideOnFling(true);
|
||||||
scroller.addOnItemChangedListener(this);
|
// scroller.addOnItemChangedListener(this);
|
||||||
scroller.addScrollStateChangeListener(this);
|
// scroller.addScrollStateChangeListener(this);
|
||||||
//scroller.setItemTransitionTimeMillis(DiscreteScrollViewOptions.getTransitionTime());
|
// //scroller.setItemTransitionTimeMillis(DiscreteScrollViewOptions.getTransitionTime());
|
||||||
apps = NavigatorApps.getApps();
|
// apps = NavigatorApps.getApps();
|
||||||
CARD_SIZE = apps.size();
|
// CARD_SIZE = apps.size();
|
||||||
scroller.setItemTransformer(new CardScaleTransformer.Builder()
|
// scroller.setItemTransformer(new CardScaleTransformer.Builder()
|
||||||
.setMinScale(0.84f)
|
// .setMinScale(0.84f)
|
||||||
.build());
|
// .build());
|
||||||
|
|
||||||
appIndicatorAdapter = new AppIndicatorAdapter(getContext(), apps);
|
appIndicatorAdapter = new AppIndicatorAdapter(getContext(), apps);
|
||||||
|
|
||||||
@@ -99,8 +99,8 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
scroller.setAdapter(appIndicatorAdapter);
|
// scroller.setAdapter(appIndicatorAdapter);
|
||||||
scroller.scrollToPosition(Integer.MAX_VALUE / 2 - 1);
|
// scroller.scrollToPosition(Integer.MAX_VALUE / 2 - 1);
|
||||||
//mNavigation.setOnClickListener( view -> {
|
//mNavigation.setOnClickListener( view -> {
|
||||||
// openSearchPanel();
|
// openSearchPanel();
|
||||||
// trackNavigatorClickEvent( 1 );
|
// trackNavigatorClickEvent( 1 );
|
||||||
@@ -222,44 +222,44 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
|||||||
@Override public void onSwitched(int position, String moduleName) {
|
@Override public void onSwitched(int position, String moduleName) {
|
||||||
//int index = (position - scroller.getCurrentItem() % CARD_SIZE + 2) % CARD_SIZE;
|
//int index = (position - scroller.getCurrentItem() % CARD_SIZE + 2) % CARD_SIZE;
|
||||||
//int i = scroller.getCurrentItem() + index;
|
//int i = scroller.getCurrentItem() + index;
|
||||||
DiscreteScrollLayoutManager layoutManager =
|
// DiscreteScrollLayoutManager layoutManager =
|
||||||
(DiscreteScrollLayoutManager) scroller.getLayoutManager();
|
// (DiscreteScrollLayoutManager) scroller.getLayoutManager();
|
||||||
|
//
|
||||||
int currentPosition = (scroller.getCurrentItem() - 2) % CARD_SIZE;
|
// int currentPosition = (scroller.getCurrentItem() - 2) % CARD_SIZE;
|
||||||
|
//
|
||||||
int index = position - currentPosition;
|
// int index = position - currentPosition;
|
||||||
|
//
|
||||||
if (index == 0) {
|
// if (index == 0) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (index <= -3) {
|
// if (index <= -3) {
|
||||||
index += CARD_SIZE;
|
// index += CARD_SIZE;
|
||||||
} else if (index >= 3) {
|
// } else if (index >= 3) {
|
||||||
index = index - CARD_SIZE;
|
// index = index - CARD_SIZE;
|
||||||
}
|
// }
|
||||||
//RecyclerView 的特性,如果是否在屏幕内
|
// //RecyclerView 的特性,如果是否在屏幕内
|
||||||
//if (index < 0) {
|
// //if (index < 0) {
|
||||||
// index -= 2;
|
// // index -= 2;
|
||||||
//}
|
// //}
|
||||||
|
//
|
||||||
Logger.d(TAG, "position--"
|
// Logger.d(TAG, "position--"
|
||||||
+ position
|
// + position
|
||||||
+ "index--"
|
// + "index--"
|
||||||
+ index
|
// + index
|
||||||
+ "scroll-->"
|
// + "scroll-->"
|
||||||
+ scroller.getCurrentItem()
|
// + scroller.getCurrentItem()
|
||||||
+ index);
|
// + index);
|
||||||
|
//
|
||||||
//scroller.setPendingScroll(getResources().getDimensionPixelSize(R.dimen.dp_137)*index);
|
// //scroller.setPendingScroll(getResources().getDimensionPixelSize(R.dimen.dp_137)*index);
|
||||||
//layoutManager.scrollToPositionWithOffset(scroller.getCurrentItem() + index,0);
|
// //layoutManager.scrollToPositionWithOffset(scroller.getCurrentItem() + index,0);
|
||||||
//scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137)*index,0);
|
// //scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137)*index,0);
|
||||||
|
//
|
||||||
if (Math.abs(index) == 1) {
|
// if (Math.abs(index) == 1) {
|
||||||
scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137) * index,
|
// scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137) * index,
|
||||||
0, null, 10);
|
// 0, null, 10);
|
||||||
} else {
|
// } else {
|
||||||
layoutManager.startSmoothPendingScroll(layoutManager.getCurrentPosition() + index);
|
// layoutManager.startSmoothPendingScroll(layoutManager.getCurrentPosition() + index);
|
||||||
}
|
// }
|
||||||
//layoutManager.smoothScrollToPosition(scroller.getCurrentItem() + index);
|
//layoutManager.smoothScrollToPosition(scroller.getCurrentItem() + index);
|
||||||
//currentPosition = position;
|
//currentPosition = position;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<com.yarolegovich.discretescrollview.DiscreteScrollView
|
<com.yarolegovich.discretescrollview.DiscreteScrollView
|
||||||
android:id="@+id/module_apps_id_scroller"
|
android:id="@+id/module_apps_id_scroller"
|
||||||
android:layout_width="@dimen/apps_id_scroller_width"
|
android:layout_width="@dimen/apps_id_scroller_width"
|
||||||
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
android:layout_height="@dimen/module_apps_navigation_icon_container_height"
|
android:layout_height="@dimen/module_apps_navigation_icon_container_height"
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
override fun init(context: Context?) {
|
||||||
if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
//todo 引导判断暂时去掉 后续引导流程更改完再放开
|
||||||
|
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||||
|
if (isDeviceOfD() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||||
mogoAuthShow.invokeAuthorizeForShow()
|
mogoAuthShow.invokeAuthorizeForShow()
|
||||||
} else {
|
} else {
|
||||||
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
||||||
|
|||||||
@@ -69,12 +69,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
|
|
||||||
private View mHeader;
|
private View mHeader;
|
||||||
private View mCards;
|
private View mCards;
|
||||||
private View mCardsBkg;
|
|
||||||
private View mApps;
|
private View mApps;
|
||||||
private View mEntrance;
|
private View mEntrance;
|
||||||
private FrameLayout mFloatingLayout;
|
private FrameLayout mFloatingLayout;
|
||||||
private FrameLayout mCoverUpLayout;
|
private FrameLayout mCoverUpLayout;
|
||||||
private FrameLayout mCardCoverUpBottomLayout;
|
|
||||||
private View mLeftShadowFrame;
|
private View mLeftShadowFrame;
|
||||||
private View mTopShadowFrame;
|
private View mTopShadowFrame;
|
||||||
|
|
||||||
@@ -180,14 +178,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
|
|
||||||
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||||
mCards = findViewById( R.id.module_main_id_cards_container );
|
mCards = findViewById( R.id.module_main_id_cards_container );
|
||||||
mCardsBkg = findViewById( R.id.module_main_id_cards_bkg );
|
|
||||||
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
||||||
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
||||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||||
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
||||||
mTopShadowFrame = findViewById( R.id.module_main_id_map_top_shadow_frame );
|
mTopShadowFrame = findViewById( R.id.module_main_id_map_top_shadow_frame );
|
||||||
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
|
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
|
||||||
mCardCoverUpBottomLayout = findViewById( R.id.module_main_id_card_cover_up_bottom );
|
|
||||||
|
|
||||||
// 避免事件穿透导致地图被滑动
|
// 避免事件穿透导致地图被滑动
|
||||||
mLeftShadowFrame.setOnClickListener( view -> {
|
mLeftShadowFrame.setOnClickListener( view -> {
|
||||||
@@ -204,8 +200,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
mFloatingLayout.setVisibility( View.GONE );
|
mFloatingLayout.setVisibility( View.GONE );
|
||||||
mLeftShadowFrame.setVisibility( View.GONE );
|
mLeftShadowFrame.setVisibility( View.GONE );
|
||||||
mTopShadowFrame.setVisibility( View.GONE );
|
mTopShadowFrame.setVisibility( View.GONE );
|
||||||
mCardsBkg.setVisibility( View.GONE );
|
|
||||||
mCardCoverUpBottomLayout.setVisibility( View.GONE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示布局
|
// 显示布局
|
||||||
@@ -217,8 +211,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||||
mTopShadowFrame.setVisibility( View.VISIBLE );
|
mTopShadowFrame.setVisibility( View.VISIBLE );
|
||||||
mCardsBkg.setVisibility( View.VISIBLE );
|
|
||||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -305,23 +297,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
// 默认触发第一个卡片
|
// 默认触发第一个卡片
|
||||||
mOnPageChangeListener.onPageSelected( 0 );
|
mOnPageChangeListener.onPageSelected( 0 );
|
||||||
}
|
}
|
||||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideCoverUpLayout() {
|
public void hideCoverUpLayout() {
|
||||||
mCoverUpLayout.setVisibility( View.GONE );
|
mCoverUpLayout.setVisibility( View.GONE );
|
||||||
mCardsBkg.setVisibility( View.VISIBLE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCardModules() {
|
public void loadCardModules() {
|
||||||
|
|
||||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||||
mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
// mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||||
mCardsContainer.setOffscreenPageLimit( providers.size() );
|
// mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||||
mCardsContainer.setPageTransformer( true, mTransformer );
|
// mCardsContainer.setPageTransformer( true, mTransformer );
|
||||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
// mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 713 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -37,12 +37,6 @@
|
|||||||
android:layout_marginLeft="@dimen/module_main_card_container_marginLeft"
|
android:layout_marginLeft="@dimen/module_main_card_container_marginLeft"
|
||||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop">
|
android:layout_marginTop="@dimen/module_main_card_container_marginTop">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/module_main_id_cards_bkg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:src="@drawable/module_apps_bg_card"
|
|
||||||
android:layout_height="@dimen/dp_797"/>
|
|
||||||
<com.mogo.module.main.cards.OrientedViewPager
|
<com.mogo.module.main.cards.OrientedViewPager
|
||||||
android:id="@+id/module_main_id_cards_container"
|
android:id="@+id/module_main_id_cards_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -60,17 +54,6 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/module_main_id_card_cover_up_bottom"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_26"
|
|
||||||
android:layout_marginTop="@dimen/cards_container_shadow_dp_margin_top"
|
|
||||||
android:layout_marginLeft="@dimen/dp_64"
|
|
||||||
android:layout_marginRight="@dimen/dp_64"
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:background="@drawable/module_main_card_cover_up_bottom"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<!--快捷操作浮层-->
|
<!--快捷操作浮层-->
|
||||||
|
|||||||
@@ -47,4 +47,6 @@ public class AMapConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String COMMAND_START_NAVI = "com.ileja.navi.route.confirm";
|
public static final String COMMAND_START_NAVI = "com.ileja.navi.route.confirm";
|
||||||
|
|
||||||
|
public static final String COMMAND_CHOOSE_PATH = "com.zhidao.route.plan";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.mogo.module.navi.constants;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zyz
|
* @author zyz
|
||||||
* @since 2019-10-02
|
* @since 2019-10-02
|
||||||
@@ -42,4 +45,32 @@ public class DataConstants {
|
|||||||
public static final String COMPANY_ADDRESS_LATITUDE = "companyAddressLatitude";
|
public static final String COMPANY_ADDRESS_LATITUDE = "companyAddressLatitude";
|
||||||
public static final String COMPANY_ADDRESS_LONGITUDE = "companyAddressLongitude";
|
public static final String COMPANY_ADDRESS_LONGITUDE = "companyAddressLongitude";
|
||||||
|
|
||||||
|
// 泛化语义
|
||||||
|
public static final String STRATEGY_THE_TIME_SHORTEST_PATH = "STRATEGY_THE_TIME_SHORTEST_PATH";
|
||||||
|
public static final String[] WORDS_STRATEGY_THE_TIME_SHORTEST_PATH = {"最快的"};
|
||||||
|
public static final String STRATEGY_THE_DISTANCE_SHORTEST_PATH = "STRATEGY_THE_DISTANCE_SHORTEST_PATH";
|
||||||
|
public static final String[] WORDS_STRATEGY_THE_DISTANCE_SHORTED_PATH = {"路程最短的"};
|
||||||
|
|
||||||
|
// 第x个选个
|
||||||
|
public static final String STRATEGY_THE_FIRST_PATH = "STRATEGY_THE_FIRST_PATH";
|
||||||
|
public static final String[] WORDS_STRATEGY_THE_FIRST_PATH = {"第一个"};
|
||||||
|
public static final String STRATEGY_THE_SECOND_PATH = "STRATEGY_THE_SECOND_PATH";
|
||||||
|
public static final String[] WORDS_STRATEGY_THE_SECOND_PATH = {"第二个"};
|
||||||
|
public static final String STRATEGY_THE_THIRD_PATH = "STRATEGY_THE_THIRD_PATH";
|
||||||
|
public static final String[] WORDS_STRATEGY_THE_THIRD_PATH = {"第三个"};
|
||||||
|
|
||||||
|
// 开始导航
|
||||||
|
public static final String STRATEGY_START_NAVI = "STRATEGY_START_NAVI";
|
||||||
|
public static final String[] WORDS_STRATEGY_START_NAVI = {"开始导航", "开始"};
|
||||||
|
|
||||||
|
public static final Map< String, String[] > sCmds = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
sCmds.put( STRATEGY_THE_TIME_SHORTEST_PATH, WORDS_STRATEGY_THE_TIME_SHORTEST_PATH );
|
||||||
|
sCmds.put( STRATEGY_THE_DISTANCE_SHORTEST_PATH, WORDS_STRATEGY_THE_DISTANCE_SHORTED_PATH );
|
||||||
|
sCmds.put( STRATEGY_THE_FIRST_PATH, WORDS_STRATEGY_THE_FIRST_PATH );
|
||||||
|
sCmds.put( STRATEGY_THE_SECOND_PATH, WORDS_STRATEGY_THE_SECOND_PATH );
|
||||||
|
sCmds.put( STRATEGY_THE_THIRD_PATH, WORDS_STRATEGY_THE_THIRD_PATH );
|
||||||
|
sCmds.put( STRATEGY_START_NAVI, WORDS_STRATEGY_START_NAVI );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import com.mogo.map.navi.MogoCalculatePath;
|
import com.mogo.map.navi.MogoCalculatePath;
|
||||||
import com.mogo.map.search.inputtips.MogoTip;
|
|
||||||
import com.mogo.module.navi.R;
|
import com.mogo.module.navi.R;
|
||||||
import com.mogo.module.navi.ui.adapter.base.RecycleBaseAdapter;
|
import com.mogo.module.navi.ui.adapter.base.RecycleBaseAdapter;
|
||||||
import com.mogo.module.navi.ui.adapter.base.RecycleViewHolder;
|
import com.mogo.module.navi.ui.adapter.base.RecycleViewHolder;
|
||||||
@@ -53,8 +52,8 @@ public class CalculatePathAdapter extends RecycleBaseAdapter<MogoCalculatePath>
|
|||||||
if (holder.getLayoutPosition() >= 2) {
|
if (holder.getLayoutPosition() >= 2) {
|
||||||
mName.setVisibility(View.GONE);
|
mName.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.setText(R.id.amap_calculate_item_strategy_time, item.getTime());
|
holder.setText(R.id.amap_calculate_item_strategy_time, item.getFormattedTime());
|
||||||
holder.setText(R.id.amap_calculate_item_strategy_distance, item.getDistance());
|
holder.setText(R.id.amap_calculate_item_strategy_distance, item.getFormattedDistance());
|
||||||
holder.setText(R.id.amap_calculate_item_strategy_desc, item.getDesc());
|
holder.setText(R.id.amap_calculate_item_strategy_desc, item.getDesc());
|
||||||
|
|
||||||
if (TextUtils.isEmpty(item.getDesc())) {
|
if (TextUtils.isEmpty(item.getDesc())) {
|
||||||
|
|||||||
@@ -11,25 +11,26 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
|||||||
import com.mogo.map.MogoLatLng
|
import com.mogo.map.MogoLatLng
|
||||||
import com.mogo.map.navi.IMogoNaviListener
|
import com.mogo.map.navi.IMogoNaviListener
|
||||||
import com.mogo.map.navi.MogoCalculatePath
|
import com.mogo.map.navi.MogoCalculatePath
|
||||||
import com.mogo.map.navi.MogoNaviInfo
|
import com.mogo.map.navi.MogoNaviConfig
|
||||||
import com.mogo.map.navi.MogoTraffic
|
|
||||||
import com.mogo.module.common.MogoModulePaths
|
|
||||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||||
import com.mogo.module.common.map.Scene
|
import com.mogo.module.common.map.Scene
|
||||||
import com.mogo.module.navi.R
|
import com.mogo.module.navi.R
|
||||||
import com.mogo.module.navi.constants.AMapConstants
|
import com.mogo.module.navi.constants.AMapConstants
|
||||||
|
import com.mogo.module.navi.constants.DataConstants
|
||||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||||
import com.mogo.module.navi.manager.SettingManager
|
import com.mogo.module.navi.manager.SettingManager
|
||||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||||
import com.mogo.module.navi.ui.base.BaseFragment
|
import com.mogo.module.navi.ui.base.BaseFragment
|
||||||
import com.mogo.service.intent.IMogoIntentListener
|
import com.mogo.service.intent.IMogoIntentListener
|
||||||
import com.mogo.utils.UiThreadHandler
|
import com.mogo.utils.UiThreadHandler
|
||||||
|
import com.mogo.utils.logger.Logger
|
||||||
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
||||||
import kotlinx.android.synthetic.main.fragment_search_category.pb_path
|
import kotlinx.android.synthetic.main.fragment_search_category.pb_path
|
||||||
import kotlinx.android.synthetic.main.fragment_search_category.rv_search_result
|
import kotlinx.android.synthetic.main.fragment_search_category.rv_search_result
|
||||||
import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||||
import kotlinx.android.synthetic.main.include_search_bar.et_navi_search
|
import kotlinx.android.synthetic.main.include_search_bar.et_navi_search
|
||||||
import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zyz
|
* @author zyz
|
||||||
@@ -37,24 +38,34 @@ import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
|||||||
*/
|
*/
|
||||||
class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallBack, IMogoIntentListener {
|
class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallBack, IMogoIntentListener {
|
||||||
|
|
||||||
|
var mTimeShortestPosition = -1
|
||||||
|
var mDistanceShortestPosition = -1
|
||||||
|
|
||||||
override fun onCmdSelected(cmd: String?) {
|
override fun onCmdSelected(cmd: String?) {
|
||||||
when (cmd) {
|
when (cmd) {
|
||||||
"firstPath" -> {
|
DataConstants.STRATEGY_THE_FIRST_PATH -> {
|
||||||
selectItem(0)
|
selectItem(0)
|
||||||
startNavi()
|
startNavi()
|
||||||
|
|
||||||
}
|
}
|
||||||
"secondPath" -> {
|
DataConstants.STRATEGY_THE_SECOND_PATH -> {
|
||||||
selectItem(1)
|
selectItem(1)
|
||||||
startNavi()
|
startNavi()
|
||||||
|
|
||||||
}
|
}
|
||||||
"thirdPath" -> {
|
DataConstants.STRATEGY_THE_THIRD_PATH -> {
|
||||||
selectItem(2)
|
selectItem(2)
|
||||||
startNavi()
|
startNavi()
|
||||||
|
|
||||||
}
|
}
|
||||||
"startNavi" -> {
|
DataConstants.STRATEGY_START_NAVI -> {
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
|
DataConstants.STRATEGY_THE_DISTANCE_SHORTEST_PATH -> {
|
||||||
|
// 路程最短
|
||||||
|
selectItem(mDistanceShortestPosition)
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
|
DataConstants.STRATEGY_THE_TIME_SHORTEST_PATH -> {
|
||||||
|
// 时间最短
|
||||||
|
selectItem(mTimeShortestPosition)
|
||||||
startNavi()
|
startNavi()
|
||||||
}
|
}
|
||||||
"retry" -> {
|
"retry" -> {
|
||||||
@@ -63,45 +74,15 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
"cancel" -> {
|
"cancel" -> {
|
||||||
SearchServiceHolder.fragmentManager.clearAll()
|
SearchServiceHolder.fragmentManager.clearAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun selectItem(index: Int) {
|
private fun selectItem(index: Int) {
|
||||||
|
if (mAdapter.list.size > index && index > 0) {
|
||||||
if (mAdapter.list.size > index) {
|
|
||||||
selectPath(mAdapter.list[index])
|
selectPath(mAdapter.list[index])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCmdAction(speakText: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCmdCancel(speakText: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSpeakEnd(speakText: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInitNaviFailure() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInitNaviSuccess() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNaviInfoUpdate(naviinfo: MogoNaviInfo?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStartNavi() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopNavi() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCalculateSuccess() {
|
override fun onCalculateSuccess() {
|
||||||
var calculatedStrategies = SearchServiceHolder.getNavi().calculatedStrategies
|
var calculatedStrategies = SearchServiceHolder.getNavi().calculatedStrategies
|
||||||
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
||||||
@@ -115,9 +96,33 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
return@postDelayed
|
return@postDelayed
|
||||||
}
|
}
|
||||||
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(calculatedStrategies[0].tagId)
|
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(calculatedStrategies[0].tagId)
|
||||||
|
|
||||||
|
if (calculatedStrategies.size == 1) {
|
||||||
|
// 一条路线,自动开启导航
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
}, 500L)
|
}, 500L)
|
||||||
|
|
||||||
|
if (calculatedStrategies.size > 1) {
|
||||||
|
|
||||||
|
var timeShortest = Integer.MAX_VALUE
|
||||||
|
var distanceShortest = Integer.MAX_VALUE
|
||||||
|
|
||||||
|
for (i in 0 until calculatedStrategies.size) {
|
||||||
|
if (timeShortest > calculatedStrategies[i].time) {
|
||||||
|
timeShortest = calculatedStrategies[i].time
|
||||||
|
mTimeShortestPosition = i
|
||||||
|
}
|
||||||
|
if (distanceShortest > calculatedStrategies[i].distance) {
|
||||||
|
distanceShortest = calculatedStrategies[i].distance
|
||||||
|
mDistanceShortestPosition = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.d(TAG, "mTimeShortestPosition = ${mTimeShortestPosition}, mDistanceShortestPosition = $mDistanceShortestPosition")
|
||||||
|
AIAssist.getInstance(context).speakTTSVoice(String.format("已为你规划处%d条路线,请选择", calculatedStrategies.size))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AIAssist.getInstance(context).speakTTSVoice(String.format("已为你规划处%d条路线,请选择", calculatedStrategies.size))
|
|
||||||
pb_path.visibility = View.GONE
|
pb_path.visibility = View.GONE
|
||||||
group_path.visibility = View.GONE
|
group_path.visibility = View.GONE
|
||||||
tv_navi_navi.text = getString(R.string.start_navi)
|
tv_navi_navi.text = getString(R.string.start_navi)
|
||||||
@@ -132,10 +137,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
pb_path.visibility = View.GONE
|
pb_path.visibility = View.GONE
|
||||||
|
|
||||||
registerRetryVoice()
|
registerRetryVoice()
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUpdateTraffic(traffic: MogoTraffic?) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var mAdapter: CalculatePathAdapter
|
private lateinit var mAdapter: CalculatePathAdapter
|
||||||
@@ -143,24 +144,16 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
return R.layout.fragment_search_category
|
return R.layout.fragment_search_category
|
||||||
}
|
}
|
||||||
|
|
||||||
val firstPath: String = "第一个"
|
|
||||||
val secondPath: String = "第二个"
|
|
||||||
val thirdPath: String = "第三个"
|
|
||||||
val startNavi: String = "开始导航"
|
|
||||||
|
|
||||||
var mogoTip: MogoLatLng? = null
|
var mogoTip: MogoLatLng? = null
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
mogoTip = arguments?.getParcelable<MogoLatLng>(AMapConstants.KEY_PARCELABLE)
|
mogoTip = arguments?.getParcelable<MogoLatLng>(AMapConstants.KEY_PARCELABLE)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否开启导航
|
// 是否开启导航
|
||||||
var isStartedNavi = false
|
var isStartedNavi = false
|
||||||
|
|
||||||
override fun onViewCreated(
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
view: View,
|
|
||||||
savedInstanceState: Bundle?) {
|
|
||||||
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
iv_navi_back.setOnClickListener {
|
iv_navi_back.setOnClickListener {
|
||||||
@@ -199,13 +192,14 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
|
|
||||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||||
|
|
||||||
AIAssist.getInstance(context).registerUnWakeupCommand("firstPath", arrayOf<String>(firstPath), this)
|
DataConstants.sCmds.entries.filter {
|
||||||
AIAssist.getInstance(context).registerUnWakeupCommand("secondPath", arrayOf<String>(secondPath), this)
|
it != null && !TextUtils.isEmpty(it.key) && (it.value?.isNotEmpty() ?: false)
|
||||||
AIAssist.getInstance(context).registerUnWakeupCommand("thirdPath", arrayOf<String>(thirdPath), this)
|
}.forEach {
|
||||||
AIAssist.getInstance(context).registerUnWakeupCommand("startNavi", arrayOf<String>(startNavi, "开始"), this)
|
AIAssist.getInstance(mContext).registerUnWakeupCommand(it.key, it.value, this@ChoosePathFragment)
|
||||||
|
}
|
||||||
|
|
||||||
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||||
|
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerRetryVoice() {
|
private fun registerRetryVoice() {
|
||||||
@@ -214,7 +208,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
|
|
||||||
private fun unregisterRetryVoice() {
|
private fun unregisterRetryVoice() {
|
||||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("retry")
|
AIAssist.getInstance(context).unregisterUnWakeupCommand("retry")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun retry() {
|
private fun retry() {
|
||||||
@@ -227,7 +220,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
if (TextUtils.isEmpty(mAdapter.selectTag)) {
|
if (TextUtils.isEmpty(mAdapter.selectTag)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// moveMapToRight()
|
|
||||||
|
|
||||||
SearchServiceHolder.getNavi().startNavi(!SettingManager.isMonitor())
|
SearchServiceHolder.getNavi().startNavi(!SettingManager.isMonitor())
|
||||||
SearchServiceHolder.getMapUIController().recoverLockMode()
|
SearchServiceHolder.getMapUIController().recoverLockMode()
|
||||||
@@ -253,21 +245,81 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
SearchServiceHolder.getNavi().clearCalculatePaths()
|
SearchServiceHolder.getNavi().clearCalculatePaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("firstPath")
|
DataConstants.sCmds.entries.filter {
|
||||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("secondPath")
|
it != null && !TextUtils.isEmpty(it.key) && (it.value?.isNotEmpty() ?: false)
|
||||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("thirdPath")
|
}.forEach {
|
||||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("startNavi")
|
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(it.key)
|
||||||
|
}
|
||||||
|
|
||||||
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||||
|
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onIntentReceived(intentStr: String?, intent: Intent?) {
|
override fun onIntentReceived(intentStr: String?, intent: Intent?) {
|
||||||
if (TextUtils.equals(AMapConstants.COMMAND_START_NAVI, intentStr)) {
|
when (intentStr) {
|
||||||
startNavi()
|
AMapConstants.COMMAND_START_NAVI -> {
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
|
AMapConstants.COMMAND_CHOOSE_PATH -> {
|
||||||
|
choosePath(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun choosePath(intent: Intent?) {
|
||||||
|
var dataJsonStr = intent?.getStringExtra("data") ?: ""
|
||||||
|
try {
|
||||||
|
var jsonObj = JSONObject(dataJsonStr)
|
||||||
|
var routePlan = jsonObj.optString("route_plan", " ")
|
||||||
|
when (routePlan) {
|
||||||
|
"最快" -> {
|
||||||
|
// 时间最短
|
||||||
|
selectItem(mTimeShortestPosition)
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
|
"不走高速" -> {
|
||||||
|
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||||
|
// 避免收费 | 1
|
||||||
|
// 多策略算路 | 2
|
||||||
|
// 不走高速 | 3
|
||||||
|
// 躲避拥堵 | 4
|
||||||
|
// 不走高速且避免收费 | 5
|
||||||
|
// 不走高速且躲避拥堵 | 6
|
||||||
|
// 躲避收费和拥堵 | 7
|
||||||
|
// 不走高速躲避收费和拥堵 | 8
|
||||||
|
// 高速优先 | 20
|
||||||
|
// 躲避拥堵且高速优先 | 24
|
||||||
|
var prefer = 3
|
||||||
|
val config = MogoNaviConfig().congestion(prefer == 4)
|
||||||
|
.cost(prefer == 1 || prefer == 7)
|
||||||
|
.highSpeed(prefer == 20)
|
||||||
|
.avoidSpeed(prefer == 3)
|
||||||
|
SearchServiceHolder.getNavi().reCalculateRoute(config)
|
||||||
|
}
|
||||||
|
"最近" -> {
|
||||||
|
// 路程最短
|
||||||
|
selectItem(mDistanceShortestPosition)
|
||||||
|
startNavi()
|
||||||
|
}
|
||||||
|
"躲避拥堵" -> {
|
||||||
|
var prefer = 4
|
||||||
|
val config = MogoNaviConfig().congestion(prefer == 4)
|
||||||
|
.cost(prefer == 1 || prefer == 7)
|
||||||
|
.highSpeed(prefer == 20)
|
||||||
|
.avoidSpeed(prefer == 3)
|
||||||
|
SearchServiceHolder.getNavi().reCalculateRoute(config)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val TAG: String = "ChoosePathFragment"
|
||||||
|
|
||||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CALCULATE_PATH)
|
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CALCULATE_PATH)
|
||||||
var bundle = Bundle()
|
var bundle = Bundle()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.mogo.module.service.marker;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.animation.BounceInterpolator;
|
import android.view.animation.BounceInterpolator;
|
||||||
import android.view.animation.OvershootInterpolator;
|
import android.view.animation.OvershootInterpolator;
|
||||||
|
|
||||||
@@ -257,20 +258,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭 Marker 详情
|
|
||||||
*
|
|
||||||
* @param marker 要关闭的Marker
|
|
||||||
*/
|
|
||||||
public synchronized void closeMarkerSelect( IMogoMarker marker ) {
|
|
||||||
// 将上次选中 Marker 设置为未选中状态
|
|
||||||
if ( marker != null ) {
|
|
||||||
Logger.i( TAG, "closeMarkerSelect 将出Marker详情关闭:" + marker );
|
|
||||||
closeMarker( marker );
|
|
||||||
mLastCheckMarker = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 展开气泡
|
// 展开气泡
|
||||||
private void openMarker( IMogoMarker mogoMarker ) {
|
private void openMarker( IMogoMarker mogoMarker ) {
|
||||||
if ( mogoMarker == null ) {
|
if ( mogoMarker == null ) {
|
||||||
@@ -358,7 +345,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
} else {
|
} else {
|
||||||
mLastCheckMarker = null;
|
mLastCheckMarker = null;
|
||||||
// 清空所有地图上绘制的Marker
|
// 清空所有地图上绘制的Marker
|
||||||
MarkerServiceHandler.getMarkerManager().removeMarkers();
|
MarkerServiceHandler.getMarkerManager().removeMarkersExcept( ModuleNames.CARD_TYPE_USER_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
drawMarkerByCurrentType( mLastDataResult );
|
drawMarkerByCurrentType( mLastDataResult );
|
||||||
@@ -402,29 +389,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION;
|
mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
List< MarkerOnlineCar > onlineCarList = markerCardResult.getOnlineCar();
|
drawAllMarker( markerCardResult );
|
||||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
|
||||||
List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
|
||||||
List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo();
|
|
||||||
|
|
||||||
switch ( mCurrentModuleName ) {
|
|
||||||
case ServiceConst.CARD_TYPE_BUSINESS_OPERATION:
|
|
||||||
drawAllMarker( markerCardResult );
|
|
||||||
break;
|
|
||||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
|
||||||
drawNoveltyMarker( noveltyInfoList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
|
|
||||||
break;
|
|
||||||
// case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
|
||||||
// case ServiceConst.CARD_TYPE_USER_DATA:
|
|
||||||
// drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
|
||||||
// break;
|
|
||||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
|
||||||
drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
|
|
||||||
break;
|
|
||||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
|
||||||
drawShareMusicMarker( shareMusicList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -457,6 +422,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
|
|
||||||
double nearlyDistance = Float.MAX_VALUE;
|
double nearlyDistance = Float.MAX_VALUE;
|
||||||
int size = getAppropriateSize( maxAmount, onlineCarList );
|
int size = getAppropriateSize( maxAmount, onlineCarList );
|
||||||
|
|
||||||
|
Map< String, IMogoMarker > existCarMap = purgeCarsData( onlineCarList );
|
||||||
|
|
||||||
for ( int i = 0; i < size; i++ ) {
|
for ( int i = 0; i < size; i++ ) {
|
||||||
MarkerOnlineCar markerOnlineCar = onlineCarList.get( i );
|
MarkerOnlineCar markerOnlineCar = onlineCarList.get( i );
|
||||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||||
@@ -470,9 +438,15 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
markerShowEntity.setIconUrl( markerOnlineCar.getUserInfo().getUserHead() );
|
markerShowEntity.setIconUrl( markerOnlineCar.getUserInfo().getUserHead() );
|
||||||
}
|
}
|
||||||
|
|
||||||
IMogoMarker iMogoMarker = drawMapMarker( markerShowEntity );
|
if ( markerOnlineCar.getUserInfo() == null || TextUtils.isEmpty( markerOnlineCar.getUserInfo().getSn() ) ) {
|
||||||
// iMogoMarker.setInfoWindowAdapter(this);
|
continue;
|
||||||
startSmooth( iMogoMarker, markerOnlineCar, markerLocation );
|
}
|
||||||
|
IMogoMarker mogoMarker = existCarMap.get( markerOnlineCar.getUserInfo().getSn() );
|
||||||
|
if ( mogoMarker == null ) {
|
||||||
|
Logger.d( TAG, "car [%s] need be create.", markerOnlineCar.getUserInfo().getSn() );
|
||||||
|
mogoMarker = drawMapMarker( markerShowEntity );
|
||||||
|
}
|
||||||
|
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
|
||||||
|
|
||||||
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
|
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
|
||||||
try {
|
try {
|
||||||
@@ -489,7 +463,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
// 进行比较,保留最近的一个数据
|
// 进行比较,保留最近的一个数据
|
||||||
if ( calculateDistance < nearlyDistance ) {
|
if ( calculateDistance < nearlyDistance ) {
|
||||||
nearlyDistance = calculateDistance;
|
nearlyDistance = calculateDistance;
|
||||||
mNearlyMarker = iMogoMarker;
|
mNearlyMarker = mogoMarker;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
@@ -519,6 +493,66 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据新的在线车辆列表,选出已存在的在线车辆,并从视图和内存中移除不存在的在线车辆
|
||||||
|
*
|
||||||
|
* @param newCarsList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map< String, IMogoMarker > purgeCarsData( List< MarkerOnlineCar > newCarsList ) {
|
||||||
|
|
||||||
|
final long start = System.currentTimeMillis();
|
||||||
|
Map< String, IMogoMarker > existCarsMap = new HashMap<>();
|
||||||
|
List< IMogoMarker > allCarsList = MarkerServiceHandler.getMarkerManager().getMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||||
|
if ( allCarsList == null || allCarsList.isEmpty() ) {
|
||||||
|
return existCarsMap;
|
||||||
|
}
|
||||||
|
if ( newCarsList == null || newCarsList.isEmpty() ) {
|
||||||
|
return existCarsMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map< String, IMogoMarker > allCarsMap = new HashMap<>();
|
||||||
|
for ( IMogoMarker marker : allCarsList ) {
|
||||||
|
String sn = getCarSnFromMarker( marker );
|
||||||
|
Logger.d( TAG, "sn = [%s]", sn );
|
||||||
|
allCarsMap.put( sn, marker );
|
||||||
|
}
|
||||||
|
for ( MarkerOnlineCar markerOnlineCar : newCarsList ) {
|
||||||
|
String sn = markerOnlineCar.getUserInfo().getSn();
|
||||||
|
if ( allCarsMap.containsKey( sn ) ) {
|
||||||
|
Logger.d( TAG, " car [%s] is cached.", sn );
|
||||||
|
existCarsMap.put( sn, allCarsMap.get( sn ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for ( String sn : allCarsMap.keySet() ) {
|
||||||
|
if ( !existCarsMap.containsKey( sn ) ) {
|
||||||
|
IMogoMarker dirtyMarker = allCarsMap.get( sn );
|
||||||
|
allCarsList.remove( dirtyMarker );
|
||||||
|
dirtyMarker.destroy();
|
||||||
|
Logger.d( TAG, " car [%s] is destroy.", sn );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allCarsMap.clear();
|
||||||
|
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||||
|
return existCarsMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCarSnFromMarker( IMogoMarker marker ) {
|
||||||
|
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ( !( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ( ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getUserInfo() == null ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getUserInfo().getSn();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 探路数据
|
* 探路数据
|
||||||
*
|
*
|
||||||
@@ -869,7 +903,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
if ( result == null ) {
|
if ( result == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeCarMarkers();
|
|
||||||
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
||||||
if ( !MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
if ( !MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||||
dispatchDataToBis( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
dispatchDataToBis( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
||||||
|
|||||||
Reference in New Issue
Block a user