opt
This commit is contained in:
@@ -640,6 +640,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
loseLockMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange( CameraPosition cameraPosition ) {
|
||||
}
|
||||
|
||||
@@ -22,5 +22,9 @@ public class AMapMessageConsts {
|
||||
* 取消导航
|
||||
*/
|
||||
public static final int MSG_NAVI_STOP = 1001;
|
||||
/**
|
||||
* 规划路线成功
|
||||
*/
|
||||
public static final int MSG_CALCULATE_SUCCESS = 1002;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ public interface AMapMessageListener {
|
||||
void onNaviStopped();
|
||||
|
||||
void onNaviInfoUpdat( NaviInfo naviInfo );
|
||||
|
||||
void onCalculateSuccess();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,10 @@ public class AMapMessageManager {
|
||||
sendMessage( AMapMessageConsts.MSG_NAVI_STOP );
|
||||
}
|
||||
|
||||
public void postCalculateSuccess() {
|
||||
sendMessage( AMapMessageConsts.MSG_CALCULATE_SUCCESS );
|
||||
}
|
||||
|
||||
private synchronized void handleMessage( Message msg ) {
|
||||
if ( msg == null ) {
|
||||
return;
|
||||
@@ -95,6 +99,9 @@ public class AMapMessageManager {
|
||||
case AMapMessageConsts.MSG_NAVI_STOP:
|
||||
handleNaviStoppedMsg();
|
||||
break;
|
||||
case AMapMessageConsts.MSG_CALCULATE_SUCCESS:
|
||||
handleCalculateSuccessMsg();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,4 +122,13 @@ public class AMapMessageManager {
|
||||
listener.onNaviStopped();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCalculateSuccessMsg() {
|
||||
if ( mListeners == null ) {
|
||||
return;
|
||||
}
|
||||
for ( AMapMessageListener listener : mListeners ) {
|
||||
listener.onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -222,8 +223,14 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
super.onCalculateRouteSuccess( aMapCalcRouteResult );
|
||||
Logger.i( TAG, "导航规划成功" );
|
||||
setStopped( false );
|
||||
mNaviOverlayHelper.showCalculatedPaths();
|
||||
MogoNaviListenerHandler.getInstance().onCalculateSuccess();
|
||||
WorkThreadHandler.getInstance().post( ()->{
|
||||
mNaviOverlayHelper.showCalculatedPaths(()->{
|
||||
UiThreadHandler.post( ()->{
|
||||
MogoNaviListenerHandler.getInstance().onCalculateSuccess();
|
||||
AMapMessageManager.getInstance().postCalculateSuccess();
|
||||
} );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,6 +254,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.handleClickedPolyline( polyline, isNaviing() );
|
||||
mAMapNavi.selectRouteId( mNaviOverlayHelper.getSelectedPathId() );
|
||||
mNaviOverlayHelper.showBounds();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,18 +86,22 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
/**
|
||||
* 显示规划的路径
|
||||
*/
|
||||
public void showCalculatedPaths() {
|
||||
public void showCalculatedPaths( Runnable after ) {
|
||||
clearCalculatedOverlay();
|
||||
mCalculatePathItems = getSortedPaths();
|
||||
if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
addEndPoints();
|
||||
showPathsBound( getBounds() );
|
||||
renderPathOverlay( mCalculatePathItems );
|
||||
showPathsBound( getBounds(), () -> {
|
||||
addEndPoints();
|
||||
renderPathOverlay( mCalculatePathItems );
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private LatLngBounds getBounds(){
|
||||
private LatLngBounds getBounds() {
|
||||
if ( mCalculatePathItems == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -164,17 +168,39 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
}
|
||||
}
|
||||
|
||||
public void showBounds() {
|
||||
showPathsBound( getBounds(), null );
|
||||
}
|
||||
|
||||
/**
|
||||
* 将规划好的路径显示在视野内
|
||||
*/
|
||||
private void showPathsBound( LatLngBounds bounds ) {
|
||||
private void showPathsBound( LatLngBounds bounds, Runnable after ) {
|
||||
if ( bounds == null ) {
|
||||
return;
|
||||
}
|
||||
checkAMapInstance();
|
||||
mAMap.animateCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect( bounds, mBoundRect.left, mBoundRect.right,
|
||||
mBoundRect.top, mBoundRect.bottom ) );
|
||||
mAMap.animateCamera( CameraUpdateFactory.newLatLngBoundsRect(
|
||||
bounds,
|
||||
mBoundRect.left,
|
||||
mBoundRect.right,
|
||||
mBoundRect.top,
|
||||
mBoundRect.bottom ),
|
||||
new AMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void checkAMapInstance() {
|
||||
@@ -414,6 +440,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
public void onItemClicked( String tagId ) {
|
||||
handleClickedPolyline( tagId );
|
||||
mAMapNavi.selectRouteId( getSelectedPathId() );
|
||||
showBounds();
|
||||
}
|
||||
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
|
||||
@@ -16,62 +16,65 @@ import com.mogo.module.apps.R;
|
||||
public enum AppEnum {
|
||||
|
||||
//"QQ音乐",
|
||||
QQMusic( "QQ音乐","com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
QQMusic( "QQ音乐", "com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
|
||||
//"车聊聊",
|
||||
Im( "车聊聊","com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
Im( "车聊聊", "com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
|
||||
//"探路",
|
||||
RoadCondition( "探路","com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadConditionSlit( "探路","com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadCondition( "探路", "com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadConditionSlit( "探路", "com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
|
||||
//"福利",
|
||||
Welfare( "福利","com.zhidaohulian.welfare.car", R.drawable.module_apps_ic_welfare ),
|
||||
Welfare( "福利", "com.zhidaohulian.welfare.car", R.drawable.module_apps_ic_welfare ),
|
||||
|
||||
//"蘑菇小队",
|
||||
Fleet( "蘑菇小队","com.zhidao.fleet", R.drawable.module_apps_ic_fleet ),
|
||||
Fleet( "蘑菇小队", "com.zhidao.fleet", R.drawable.module_apps_ic_fleet ),
|
||||
|
||||
//"行车记录仪",
|
||||
CarCorder( "行车记录仪","com.zhidao.carcorder", R.drawable.module_apps_ic_carcorder ),
|
||||
CarCorder( "行车记录仪", "com.zhidao.carcorder", R.drawable.module_apps_ic_carcorder ),
|
||||
|
||||
//"懒人听书",
|
||||
Lrts( "懒人听书","com.zhidao.lrts", R.drawable.module_apps_ic_lrts ),
|
||||
Lrts( "懒人听书", "com.zhidao.lrts", R.drawable.module_apps_ic_lrts ),
|
||||
|
||||
//"一键清理",
|
||||
CleanMaster( "一键清理","com.zhidao.cleanmaster", R.drawable.module_apps_ic_clean_master ),
|
||||
CleanMaster( "一键清理", "com.zhidao.cleanmaster", R.drawable.module_apps_ic_clean_master ),
|
||||
|
||||
//"系统升级",
|
||||
Fota( "系统升级","com.abupdate.fota_demo_iot", R.drawable.module_apps_ic_fota ),
|
||||
Fota( "系统升级", "com.abupdate.fota_demo_iot", R.drawable.module_apps_ic_fota ),
|
||||
|
||||
//"微信车机助手",
|
||||
WechatHelper( "微信车机助手","com.zhidao.wechathelper", R.drawable.module_apps_ic_wechat ),
|
||||
WechatHelper( "微信车机助手", "com.zhidao.wechathelper", R.drawable.module_apps_ic_wechat ),
|
||||
|
||||
//"爱奇艺HD",
|
||||
Qiyi( "爱奇艺HD","com.qiyi.video.pad", R.drawable.module_apps_ic_qiyi ),
|
||||
Qiyi( "爱奇艺HD", "com.qiyi.video.pad", R.drawable.module_apps_ic_qiyi ),
|
||||
|
||||
//"喜马拉雅",
|
||||
Ximalaya( "喜马拉雅","com.ximalaya.ting.android.car", R.drawable.module_apps_ic_ximalaya ),
|
||||
Ximalaya( "喜马拉雅", "com.ximalaya.ting.android.car", R.drawable.module_apps_ic_ximalaya ),
|
||||
|
||||
//"均衡器",
|
||||
Equlizer( "均衡器","com.zhidao.equalizer", R.drawable.module_apps_ic_equlizer ),
|
||||
Equlizer( "均衡器", "com.zhidao.equalizer", R.drawable.module_apps_ic_equlizer ),
|
||||
|
||||
//"方控学习",
|
||||
SteerProduct( "方控学习","com.zd.steerproduct", R.drawable.module_apps_ic_stee_product ),
|
||||
SteerProduct( "方控学习", "com.zd.steerproduct", R.drawable.module_apps_ic_stee_product ),
|
||||
|
||||
//"蓝牙音乐",
|
||||
BTMusic( "蓝牙音乐","com.nwd.bt.music", R.drawable.module_apps_ic_bt ),
|
||||
BTMusic( "蓝牙音乐", "com.nwd.bt.music", R.drawable.module_apps_ic_bt ),
|
||||
|
||||
//"车载设置",
|
||||
CarSettings( "车载设置","com.zhidao.settings", R.drawable.module_apps_ic_car_setting ),
|
||||
CarSettings( "车载设置", "com.zhidao.settings", R.drawable.module_apps_ic_car_setting ),
|
||||
|
||||
//"AUX",
|
||||
AUX( "AUX","com.nwd.auxin", R.drawable.module_apps_ic_aux ),
|
||||
AUX( "AUX", "com.nwd.auxin", R.drawable.module_apps_ic_aux ),
|
||||
|
||||
//FM
|
||||
FM( "FM","com.nwd.radio", R.drawable.module_apps_ic_fm ),
|
||||
FM( "FM", "com.nwd.radio", R.drawable.module_apps_ic_fm ),
|
||||
|
||||
// 新鲜事
|
||||
FreshThings( "新鲜事","com.zhidao.fresh.things", R.drawable.module_apps_ic_fresh_things ),
|
||||
FreshThings( "新鲜事", "com.zhidao.fresh.things", R.drawable.module_apps_ic_fresh_things ),
|
||||
|
||||
// 个人中心
|
||||
PersonCenter( "个人中心", "com.zhidao.auto.personal ", R.drawable.module_apps_ic_fresh_things ),
|
||||
;
|
||||
|
||||
private String mName;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -8,7 +8,6 @@ import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Trace;
|
||||
@@ -19,7 +18,6 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
@@ -46,8 +44,6 @@ import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
@@ -258,8 +254,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
public void onFail() {
|
||||
if ( mLoopRequest ) {
|
||||
Logger.d( TAG, "onFail and loop" );
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOOP_REQUEST,
|
||||
ServiceConst.LOOP_INTERVAL );
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOOP_REQUEST, ServiceConst.LOOP_INTERVAL );
|
||||
} else {
|
||||
invokeAutoRefreshStrategy();
|
||||
}
|
||||
@@ -271,8 +266,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
mRefreshRemainingTime = mAutoRefreshStrategy.getInterval();
|
||||
mHandler.removeMessages( ServiceConst.MSG_TYPE_REFRESH_DECREASE );
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE,
|
||||
ServiceConst.DECREASE_INTERVAL );
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, ServiceConst.DECREASE_INTERVAL );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -287,14 +281,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
mUiController = mMogoMapService.getMapUIController();
|
||||
mNavi = mMogoMapService.getNavi( context );
|
||||
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE,
|
||||
StatusDescriptor.USER_INTERACTED, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI,
|
||||
this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ADAS_UI,
|
||||
this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE,
|
||||
StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ADAS_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
|
||||
registerMogoReceiver( context );
|
||||
registerInternalUnWakeupWords();
|
||||
@@ -336,7 +326,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
Logger.d( TAG, "current thread: %s", Thread.currentThread() );
|
||||
Logger.d( TAG, "current thread: %s, msg = %s", Thread.currentThread(), msg.what );
|
||||
if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) {
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
RefreshObject ro = ( ( RefreshObject ) msg.obj );
|
||||
@@ -349,8 +339,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
RefreshObject ro = ( ( RefreshObject ) msg.obj );
|
||||
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius,
|
||||
ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -419,8 +408,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private float getMapCameraFactWidth() {
|
||||
try {
|
||||
return Utils.calculateLineDistance( mCameraNorthEastPosition,
|
||||
new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lng ) );
|
||||
return Utils.calculateLineDistance( mCameraNorthEastPosition, new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lng ) );
|
||||
} catch ( Exception e ) {
|
||||
return ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS;
|
||||
}
|
||||
@@ -507,6 +495,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索页面显示时不做任何策略
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
// 缩放级别缩小
|
||||
@@ -981,28 +976,21 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
if ( size == 0 ) {
|
||||
mUiController.showMyLocation( !mNavi.isNaviing() );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||
// 控制SearchUIShow 打点逻辑
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
if ( mNavi.isNaviing() ) {
|
||||
mUiController.setPointToCenter( 0.675926, 0.77552 );
|
||||
} else {
|
||||
mUiController.setPointToCenter( 0.66145, 0.661094 );
|
||||
}
|
||||
mUiController.showMyLocation( !mNavi.isNaviing() );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||
// 控制SearchUIShow 打点逻辑
|
||||
setMarkerStatus(false);
|
||||
mUiController.recoverLockMode();
|
||||
} else {
|
||||
mUiController.showMyLocation( false );
|
||||
AIAssist.getInstance( mContext )
|
||||
.registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
mStatusManager.setSearchUIShow( TAG, true );
|
||||
mUiController.setPointToCenter( 0.5, 0.5 );
|
||||
setMarkerStatus(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void setMarkerStatus( boolean show ) {
|
||||
mStatusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user