From 44ec5cdcfe12886b0bf70feafb7bc83b6759e819 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Fri, 5 Jun 2020 12:19:13 +0800 Subject: [PATCH] opt --- .idea/misc.xml | 2 +- app/build.gradle | 30 +++-- .../com/mogo/launcher/MogoApplication.java | 19 ++- .../com/mogo/commons/debug/DebugConfig.java | 15 ++- gradle.properties | 2 +- .../map-autonavi/src/main/AndroidManifest.xml | 14 +- .../independent/MainIndependentActivity.java | 17 ++- .../src/main/res/values/dimens.xml | 5 + .../src/main/AndroidManifest.xml | 1 - .../common/map/CustomNaviInterrupter.java | 48 +++++++ .../extensions/entrance/EntranceFragment.java | 13 +- .../res/layout/module_main_activity_main.xml | 4 +- .../mogo/module/map/MapBroadCastHelper.java | 38 +++--- .../com/mogo/module/map/MapPresenter.java | 66 ++++++---- .../service/intent/MockIntentHandler.java | 122 ++++++++++++++++++ 15 files changed, 317 insertions(+), 79 deletions(-) create mode 100644 main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml create mode 100644 modules/mogo-module-common/src/main/java/com/mogo/module/common/map/CustomNaviInterrupter.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 707ee6e613..2dc54c489f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 97afdea972..d6878216d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,28 +53,38 @@ android { targetCompatibility 1.8 } + sourceSets { + main { + manifest.srcFile 'src/independent/AndroidManifest.xml' + } + launcher { + manifest.srcFile 'src/launcher/AndroidManifest.xml' + } + independent { + manifest.srcFile 'src/independent/AndroidManifest.xml' + } + } + flavorDimensions "product", "basic", "env" productFlavors { //独立app independent{ dimension "basic" - sourceSets { - main { - manifest.srcFile 'src/independent/AndroidManifest.xml' - } - } applicationId rootProject.ext.android.applicationId + // 是否启动位置服务 + buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'false' + // 是否使用自定义导航 + buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false' } // launcher app launcher{ dimension "basic" - sourceSets { - main { - manifest.srcFile 'src/launcher/AndroidManifest.xml' - } - } applicationId rootProject.ext.android.zhidadoApplicationId + // 是否启动位置服务 + buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'true' + // 是否使用自定义导航 + buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false' } // f系列-分体机全系列,未细分 f8xx{ diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 3b339d9a2d..d90f9010c4 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -10,6 +10,7 @@ import com.auto.zhidao.logsdk.CrashSystem; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.module.adcard.AdCardConstants; +import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant; import com.mogo.module.back.BackToLauncherConst; import com.mogo.module.carchatting.card.CallChatConstant; import com.mogo.module.common.MogoModule; @@ -24,9 +25,6 @@ import com.mogo.service.connection.IMogoSocketManager; import com.mogo.utils.logger.LogLevel; import com.mogo.utils.logger.Logger; -import static com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.PATH_AGREEMENT_FRAGMENT; -import static com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME; - /** * @author congtaowang * @since 2019-12-18 @@ -35,6 +33,8 @@ import static com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.PA */ public class MogoApplication extends AbsMogoApplication { + private static final String TAG = "MogoApplication"; + @Override public void onCreate() { DebugConfig.setNetMode(BuildConfig.NET_ENV); @@ -49,7 +49,7 @@ public class MogoApplication extends AbsMogoApplication { Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF); // 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( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME)); //运营位卡片,需要默认显示,放在第一个加载 MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME)); @@ -62,13 +62,20 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG)); MogoModulePaths.addModule(new MogoModule(BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME)); Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms"); + + DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE ); + DebugConfig.setLaunchLocationService( BuildConfig.USE_CUSTOM_NAVI ); } @Override protected void init() { super.init(); - IMogoSocketManager mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation(); - mMogoSocketManager.init(getApplicationContext(), BuildConfig.APPLICATION_ID); + IMogoSocketManager mMogoSocketManager = ARouter.getInstance().navigation( IMogoSocketManager.class ); + if ( mMogoSocketManager != null ) { + mMogoSocketManager.init(getApplicationContext(), BuildConfig.APPLICATION_ID); + } else { + Logger.e( TAG, "init socket server error." ); + } } @Override diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java index 2768a0fc7d..1e404bf945 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java @@ -75,7 +75,7 @@ public class DebugConfig { } /** - * 是否拉起位置服务 + * 是否拉起位置服务,launcher 需要拉起位置服务,独立 app 不需要 */ private static boolean sLaunchLocationService = true; @@ -86,4 +86,17 @@ public class DebugConfig { public static void setLaunchLocationService( boolean launchLocationService ) { DebugConfig.sLaunchLocationService = launchLocationService; } + + /** + * 是否使用自定义导航 + */ + private static boolean sUseCustomNavi = false; + + public static boolean isUseCustomNavi() { + return sUseCustomNavi; + } + + public static void setUseCustomNavi( boolean sUseCustomNavi ) { + DebugConfig.sUseCustomNavi = sUseCustomNavi; + } } diff --git a/gradle.properties b/gradle.properties index 830806c0d1..d9ad2e3ba1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -80,6 +80,6 @@ MOGO_MODULE_AD_CARD_VERSION=1.0.1 ## 产品库必备配置 applicationId=com.mogo.launcer -applicationName=Launcer2.0 +applicationName=IntelligentPilot versionCode=80006 versionName=8.0.6 \ No newline at end of file diff --git a/libraries/map-autonavi/src/main/AndroidManifest.xml b/libraries/map-autonavi/src/main/AndroidManifest.xml index 74341ccd56..48f598d4cc 100644 --- a/libraries/map-autonavi/src/main/AndroidManifest.xml +++ b/libraries/map-autonavi/src/main/AndroidManifest.xml @@ -2,12 +2,12 @@ package="com.mogo.map.impl.automap"> - - - - - + + + + + + + \ No newline at end of file diff --git a/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java b/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java index 99abe4c36c..2b81874a27 100644 --- a/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java +++ b/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java @@ -1,7 +1,7 @@ package com.zhidao.mogo.module.main.independent; import android.os.Bundle; -import android.view.View; +import android.widget.FrameLayout; import androidx.annotation.Nullable; @@ -16,8 +16,19 @@ public class MainIndependentActivity extends MainActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); + } + + @Override + protected void initViews() { + super.initViews(); + FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() ); + entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft ); + mEntrance.setLayoutParams( entranceParams ); + + FrameLayout.LayoutParams headerParams = ( ( FrameLayout.LayoutParams ) mHeader.getLayoutParams() ); + headerParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_header_fragment_container_marginLeft ); + mHeader.setLayoutParams( headerParams ); + -// mApps.setVisibility(View.GONE); -// mLeftShadowFrame.setVisibility(View.GONE); } } diff --git a/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml b/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..7c6006c413 --- /dev/null +++ b/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 350px + 366px + \ No newline at end of file diff --git a/modules/mogo-module-apps/src/main/AndroidManifest.xml b/modules/mogo-module-apps/src/main/AndroidManifest.xml index 3f10d1084d..d6de6be910 100644 --- a/modules/mogo-module-apps/src/main/AndroidManifest.xml +++ b/modules/mogo-module-apps/src/main/AndroidManifest.xml @@ -8,7 +8,6 @@ - diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/CustomNaviInterrupter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/CustomNaviInterrupter.java new file mode 100644 index 0000000000..c77dc49167 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/CustomNaviInterrupter.java @@ -0,0 +1,48 @@ +package com.mogo.module.common.map; + +import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.debug.DebugConfig; +import com.mogo.utils.AppUtils; +import com.mogo.utils.logger.Logger; + +public +/** + * @author congtaowang + * @since 2020/6/5 + *

+ * 自定义导航功能拦截器 + */ +class CustomNaviInterrupter implements Interrupter { + + private static final String TAG = "CustomNaviInterrupter"; + + private static volatile CustomNaviInterrupter sInstance; + + private CustomNaviInterrupter() { + } + + public static CustomNaviInterrupter getInstance() { + if ( sInstance == null ) { + synchronized ( CustomNaviInterrupter.class ) { + if ( sInstance == null ) { + sInstance = new CustomNaviInterrupter(); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + @Override + public boolean interrupt() { + if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), "com.autonavi.amapauto" ) + || DebugConfig.isUseCustomNavi() ) { + Logger.d( TAG, "do not use custom map function." ); + return true; + } + return false; + } +} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index d49941e94a..9520ef3000 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -188,7 +188,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent return R.layout.module_ext_layout_entrance; } - private List demoCache = new ArrayList<>(); + private List< View > demoCache = new ArrayList<>(); @Override protected void initViews() { @@ -279,9 +279,9 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent } ); // mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel ); - ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout); - if(rootView!=null) { - TopViewAnimHelper.getInstance().init(rootView); + ConstraintLayout rootView = findViewById( R.id.module_entrance_id_top_motion_layout ); + if ( rootView != null ) { + TopViewAnimHelper.getInstance().init( rootView ); } mExitNavi = findViewById( R.id.module_entrance_id_exit_navi ); @@ -419,6 +419,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent return; } if ( mExitNavi.getVisibility() == View.GONE ) { + // 避免先导航,后启动app导致无法显示控件 onStartNavi(); } mNaviInfo.notifyChanged( naviinfo ); @@ -550,7 +551,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent } @Override - public void refreshUserInfo(UserInfo userInfo) { - Logger.d(TAG, "刷新用户信息: " + userInfo); + public void refreshUserInfo( UserInfo userInfo ) { + Logger.d( TAG, "刷新用户信息: " + userInfo ); } } diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml index f866a8090f..02d9555475 100644 --- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml +++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java index dbd6eaa255..ea7e2d70fe 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java @@ -6,6 +6,7 @@ import android.util.Log; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.map.navi.MogoNaviInfo; +import com.mogo.module.common.map.CustomNaviInterrupter; import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; import com.mogo.service.statusmanager.IMogoStatusChangedListener; @@ -46,14 +47,17 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener { } public void notifyXiaozhi( MogoNaviInfo naviinfo ) { -// Intent intent = new Intent( ACTION_NAV_SEND ); -// intent.putExtra( "KEY_TYPE", 10001 ); -// intent.putExtra( "NEXT_ROAD_NAME", naviinfo.getNextRoadName() ); -// intent.putExtra( "ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime() ); -// intent.putExtra( "ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance() ); -// intent.putExtra( "ICON", naviinfo.getIconResId() ); -// mContext.sendBroadcast( intent ); -// Log.v( "MapBroadCastHelper", "action=" + ACTION_NAV_SEND + " NaviInfo" ); + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + Intent intent = new Intent( ACTION_NAV_SEND ); + intent.putExtra( "KEY_TYPE", 10001 ); + intent.putExtra( "NEXT_ROAD_NAME", naviinfo.getNextRoadName() ); + intent.putExtra( "ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime() ); + intent.putExtra( "ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance() ); + intent.putExtra( "ICON", naviinfo.getIconResId() ); + mContext.sendBroadcast( intent ); + Log.v( "MapBroadCastHelper", "action=" + ACTION_NAV_SEND + " NaviInfo" ); } @@ -67,30 +71,30 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener { } public void mapFrount() { -// notifyXizhiNavStatus( STATUS_NAV_FRONT ); + notifyXizhiNavStatus( STATUS_NAV_FRONT ); } public void mapBackground() { -// notifyXizhiNavStatus( STATUS_NAV_BACKGROUND ); + notifyXizhiNavStatus( STATUS_NAV_BACKGROUND ); } public void startNavi() { -// notifyXizhiNavStatus( STATUS_NAV_START ); + notifyXizhiNavStatus( STATUS_NAV_START ); } public void stopNavi() { -// notifyXizhiNavStatus( STATUS_NAV_STOP ); + notifyXizhiNavStatus( STATUS_NAV_STOP ); } @Override public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) { if ( descriptor == StatusDescriptor.AI_ASSIST_READY ) { if ( isTrue ) { -// if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) { -// mapBackground(); -// } else { -// mapFrount(); -// } + if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) { + mapBackground(); + } else { + mapFrount(); + } } } } diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index 4da612446f..000b64efbd 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -23,6 +23,7 @@ import com.mogo.map.navi.MogoNaviConfig; import com.mogo.map.navi.MogoNaviInfo; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.MapControlResult; +import com.mogo.module.common.map.CustomNaviInterrupter; import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; import com.mogo.service.intent.IMogoIntentListener; @@ -116,10 +117,13 @@ public class MapPresenter extends Presenter< MapView > implements onChangeDayNightMode( day_night_mode ); //继续导航 } else if ( key_type == 10049 ) { -// boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false ); -// if ( extra_endurance_data ) { -// onContinueNavigation(); -// } + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false ); + if ( extra_endurance_data ) { + onContinueNavigation(); + } } else if ( key_type == 10006 ) { // 避免冲突,会同时发送两个广播,这里不操作。 //int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 ); @@ -131,12 +135,21 @@ public class MapPresenter extends Presenter< MapView > implements } else if ( key_type == 10005 ) { int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type ); } else if ( key_type == 20009 ) { -// onOpenNavi(); + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + onOpenNavi(); } else if ( key_type == 10038 || key_type == 10007 ) { -// mLauncher.backToLauncher( getContext() ); -// onChoosePath( intent, key_type ); + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + mLauncher.backToLauncher( getContext() ); + onChoosePath( intent, key_type ); } else if ( key_type == 10021 ) { -// onStopNaviInternal(); + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + onStopNaviInternal(); } else if ( key_type == 10005 ) { // 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。 // 避免收费 | 1 @@ -149,12 +162,15 @@ public class MapPresenter extends Presenter< MapView > implements // 不走高速躲避收费和拥堵 | 8 // 高速优先 | 20 // 躲避拥堵且高速优先 | 24 -// int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 ); -// MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 ) -// .cost( prefer == 1 || prefer == 7 ) -// .highSpeed( prefer == 20 ) -// .avoidSpeed( prefer == 3 ); -// mMogoMapService.getNavi( getContext() ).reCalculateRoute( config ); + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } + int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 ); + MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 ) + .cost( prefer == 1 || prefer == 7 ) + .highSpeed( prefer == 20 ) + .avoidSpeed( prefer == 3 ); + mMogoMapService.getNavi( getContext() ).reCalculateRoute( config ); } } @@ -279,16 +295,18 @@ public class MapPresenter extends Presenter< MapView > implements private void zoomMap( boolean zoomIn ) { boolean isLocked = mMogoMapService.getMapUIController().isCarLocked(); MapControlResult result = mView.getUIController().changeZoom( zoomIn ); -// if ( result == MapControlResult.TARGET ) { -// UiThreadHandler.postDelayed( () -> { -// if ( zoomIn ) { -// AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最大", VoicePreemptType.PREEMPT_TYPE_NEXT, null ); -// } else { -// AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最小", VoicePreemptType.PREEMPT_TYPE_NEXT, null ); -// } -// }, 1_000L ); // 避免小智障播放完毕之前播报 -// return; -// } + if (! CustomNaviInterrupter.getInstance().interrupt() ) { + if ( result == MapControlResult.TARGET ) { + UiThreadHandler.postDelayed( () -> { + if ( zoomIn ) { + AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最大", VoicePreemptType.PREEMPT_TYPE_NEXT, null ); + } else { + AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最小", VoicePreemptType.PREEMPT_TYPE_NEXT, null ); + } + }, 1_000L ); // 避免小智障播放完毕之前播报 + return; + } + } if ( isLocked ) { // 保持锁车状态 UiThreadHandler.postDelayed( () -> { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index df929ff44c..7944f3a06e 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -2,14 +2,19 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.Uri; import android.text.TextUtils; import android.view.View; import android.widget.TextView; +import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.map.MogoLatLng; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.map.search.geo.IMogoGeoSearch; import com.mogo.map.search.geo.IMogoGeoSearchListener; import com.mogo.map.search.geo.MogoGeocodeResult; @@ -24,6 +29,9 @@ import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.utils.GsonUtil; +import java.util.ArrayList; +import java.util.List; + /** * @author congtaowang * @since 2020-04-17 @@ -148,6 +156,120 @@ public class MockIntentHandler implements IntentHandler { double lon = intent.getFloatExtra( "lon", 0.0f ); MarkerServiceHandler.getNavi().naviTo( new MogoLatLng( lat, lon ) ); } + case 14: { + List< MogoLatLng > mogoLatLngs = new ArrayList<>(); + mogoLatLngs.add(new MogoLatLng(116.396716,39.615986)); + mogoLatLngs.add(new MogoLatLng(116.396995,39.616007)); + mogoLatLngs.add(new MogoLatLng(116.397169,39.616012)); + mogoLatLngs.add(new MogoLatLng(116.397343,39.616017)); + mogoLatLngs.add(new MogoLatLng(116.397517,39.616022)); + mogoLatLngs.add(new MogoLatLng(116.397693,39.616029)); + mogoLatLngs.add(new MogoLatLng(116.397896,39.616039)); + mogoLatLngs.add(new MogoLatLng(116.3981,39.616051)); + mogoLatLngs.add(new MogoLatLng(116.39827,39.616058)); + mogoLatLngs.add(new MogoLatLng(116.398441,39.616066)); + mogoLatLngs.add(new MogoLatLng(116.398612,39.616074)); + mogoLatLngs.add(new MogoLatLng(116.398787,39.616083)); + mogoLatLngs.add(new MogoLatLng(116.39899,39.616093)); + mogoLatLngs.add(new MogoLatLng(116.399195,39.616105)); + mogoLatLngs.add(new MogoLatLng(116.399334,39.616112)); + mogoLatLngs.add(new MogoLatLng(116.399473,39.61612)); + mogoLatLngs.add(new MogoLatLng(116.399612,39.616128)); + mogoLatLngs.add(new MogoLatLng(116.399751,39.616136)); + mogoLatLngs.add(new MogoLatLng(116.399893,39.616148)); + mogoLatLngs.add(new MogoLatLng(116.40008,39.616153)); + mogoLatLngs.add(new MogoLatLng(116.400301,39.616159)); + mogoLatLngs.add(new MogoLatLng(116.400471,39.616167)); + mogoLatLngs.add(new MogoLatLng(116.400642,39.616175)); + mogoLatLngs.add(new MogoLatLng(116.400813,39.616183)); + mogoLatLngs.add(new MogoLatLng(116.400988,39.616192)); + mogoLatLngs.add(new MogoLatLng(116.401191,39.616201)); + mogoLatLngs.add(new MogoLatLng(116.401396,39.616213)); + mogoLatLngs.add(new MogoLatLng(116.401728,39.616235)); + mogoLatLngs.add(new MogoLatLng(116.401986,39.616246)); + mogoLatLngs.add(new MogoLatLng(116.402146,39.61625)); + mogoLatLngs.add(new MogoLatLng(116.402307,39.616255)); + mogoLatLngs.add(new MogoLatLng(116.402468,39.61626)); + mogoLatLngs.add(new MogoLatLng(116.40263,39.616267)); + mogoLatLngs.add(new MogoLatLng(116.402762,39.616272)); + mogoLatLngs.add(new MogoLatLng(116.402894,39.616277)); + mogoLatLngs.add(new MogoLatLng(116.403026,39.616282)); + mogoLatLngs.add(new MogoLatLng(116.403158,39.616287)); + mogoLatLngs.add(new MogoLatLng(116.40329,39.616292)); + mogoLatLngs.add(new MogoLatLng(116.403422,39.616297)); + mogoLatLngs.add(new MogoLatLng(116.403554,39.616302)); + mogoLatLngs.add(new MogoLatLng(116.403686,39.616307)); + mogoLatLngs.add(new MogoLatLng(116.403821,39.616321)); + mogoLatLngs.add(new MogoLatLng(116.404045,39.616331)); + mogoLatLngs.add(new MogoLatLng(116.404272,39.616343)); + mogoLatLngs.add(new MogoLatLng(116.404551,39.616353)); + mogoLatLngs.add(new MogoLatLng(116.404753,39.616363)); + mogoLatLngs.add(new MogoLatLng(116.404958,39.616375)); + mogoLatLngs.add(new MogoLatLng(116.405055,39.616375)); + mogoLatLngs.add(new MogoLatLng(116.405184,39.616379)); + mogoLatLngs.add(new MogoLatLng(116.405313,39.616384)); + mogoLatLngs.add(new MogoLatLng(116.405442,39.616389)); + mogoLatLngs.add(new MogoLatLng(116.405571,39.616394)); + mogoLatLngs.add(new MogoLatLng(116.4057,39.616399)); + mogoLatLngs.add(new MogoLatLng(116.405829,39.616404)); + mogoLatLngs.add(new MogoLatLng(116.405958,39.616409)); + mogoLatLngs.add(new MogoLatLng(116.406087,39.616414)); + mogoLatLngs.add(new MogoLatLng(116.406216,39.616419)); + mogoLatLngs.add(new MogoLatLng(116.406345,39.616424)); + mogoLatLngs.add(new MogoLatLng(116.406474,39.616429)); + mogoLatLngs.add(new MogoLatLng(116.406611,39.61644)); + mogoLatLngs.add(new MogoLatLng(116.406879,39.616461)); + mogoLatLngs.add(new MogoLatLng(116.407033,39.616465)); + mogoLatLngs.add(new MogoLatLng(116.407187,39.616469)); + mogoLatLngs.add(new MogoLatLng(116.407341,39.616473)); + mogoLatLngs.add(new MogoLatLng(116.407495,39.616477)); + mogoLatLngs.add(new MogoLatLng(116.407694,39.616483)); + mogoLatLngs.add(new MogoLatLng(116.407876,39.616493)); + mogoLatLngs.add(new MogoLatLng(116.408059,39.616504)); + mogoLatLngs.add(new MogoLatLng(116.408327,39.616515)); + mogoLatLngs.add(new MogoLatLng(116.408596,39.616526)); + mogoLatLngs.add(new MogoLatLng(116.408757,39.616536)); + mogoLatLngs.add(new MogoLatLng(116.409025,39.616547)); + mogoLatLngs.add(new MogoLatLng(116.409227,39.616556)); + mogoLatLngs.add(new MogoLatLng(116.409432,39.616568)); + mogoLatLngs.add(new MogoLatLng(116.409711,39.616579)); + mogoLatLngs.add(new MogoLatLng(116.409914,39.61659)); + mogoLatLngs.add(new MogoLatLng(116.410119,39.616601)); + mogoLatLngs.add(new MogoLatLng(116.410387,39.616601)); + mogoLatLngs.add(new MogoLatLng(116.410602,39.616601)); + mogoLatLngs.add(new MogoLatLng(116.410816,39.616622)); + mogoLatLngs.add(new MogoLatLng(116.411084,39.616633)); + mogoLatLngs.add(new MogoLatLng(116.411395,39.616643)); + mogoLatLngs.add(new MogoLatLng(116.411492,39.616654)); + mogoLatLngs.add(new MogoLatLng(116.411771,39.616665)); + mogoLatLngs.add(new MogoLatLng(116.411974,39.616674)); + mogoLatLngs.add(new MogoLatLng(116.412178,39.616686)); + mogoLatLngs.add(new MogoLatLng(116.412447,39.616697)); + mogoLatLngs.add(new MogoLatLng(116.412586,39.616697)); + mogoLatLngs.add(new MogoLatLng(116.412876,39.616718)); + mogoLatLngs.add(new MogoLatLng(116.413144,39.616729)); + mogoLatLngs.add(new MogoLatLng(116.413347,39.616738)); + mogoLatLngs.add(new MogoLatLng(116.413551,39.61675)); + mogoLatLngs.add(new MogoLatLng(116.41383,39.61675)); + mogoLatLngs.add(new MogoLatLng(116.414002,39.616761)); + mogoLatLngs.add(new MogoLatLng(116.414098,39.616761)); + mogoLatLngs.add(new MogoLatLng(116.414279,39.616767)); + mogoLatLngs.add(new MogoLatLng(116.414461,39.616774)); + mogoLatLngs.add(new MogoLatLng(116.414645,39.616782)); + mogoLatLngs.add(new MogoLatLng(116.41483,39.616792)); + mogoLatLngs.add(new MogoLatLng(116.415016,39.616802)); + mogoLatLngs.add(new MogoLatLng(116.415203,39.616814)); + mogoLatLngs.add(new MogoLatLng(116.415395,39.616824)); + mogoLatLngs.add(new MogoLatLng(116.415589,39.616836)); + mogoLatLngs.add(new MogoLatLng(116.415745,39.616842)); + mogoLatLngs.add(new MogoLatLng(116.415902,39.616849)); + mogoLatLngs.add(new MogoLatLng(116.416061,39.616857)); + mogoLatLngs.add(new MogoLatLng(116.416307,39.616868)); + MogoMarkerOptions options = new MogoMarkerOptions(); + options.icon( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) + .position( mogoLatLngs.get( 0 ) ); + IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, options ); + } break; } }