* 导航:adb shell am start -d "mogo://launcher/main/switch2?type=navi'&'lon=116.327007'&'lat=39.977639" */ -public class SchemeIntent { +public class SchemeIntent implements IMogoStatusChangedListener { private static final String TAG = "SchemeIntent"; @@ -29,6 +35,8 @@ public class SchemeIntent { private IMogoServiceApis mApis; private Context mContext; + private Intent mNextIntent; + private SchemeIntent() { // private constructor } @@ -44,6 +52,7 @@ public class SchemeIntent { public void init( Context context, IMogoServiceApis apis ) { mContext = context; mApis = apis; + mApis.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this ); } private Object readResolve() { @@ -60,15 +69,28 @@ public class SchemeIntent { if ( path == null || path.isEmpty() ) { return; } + + if ( !mApis.getStatusManagerApi().isMainPageOnResume() ) { + mNextIntent = intent; + mApis.getLauncherApi().backToLauncher( mContext ); + return; + } + switch ( path ) { case "/main/switch2": handleSwitch2Action( target ); break; } + + + mNextIntent = null; } private void handleSwitch2Action( Uri target ) { String type = target.getQueryParameter( "type" ); + if ( TextUtils.isEmpty( type ) ) { + return; + } switch ( type ) { case ModuleNames.CARD_TYPE_BUSINESS_OPERATION: case ModuleNames.CARD_TYPE_CARS_CHATTING: @@ -110,4 +132,16 @@ public class SchemeIntent { Logger.e( TAG, e, "error." ); } } + + @Override + public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) { + if ( descriptor == StatusDescriptor.MAIN_PAGE_RESUME ) { + if ( isTrue ) { + // 保证回到桌面后在开始该规划路线。 + UiThreadHandler.postDelayed( () -> { + handle( mNextIntent ); + }, 2_000L ); + } + } + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 8c9a26d8fe..7b7331392f 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -199,6 +199,8 @@ public class MogoServices implements IMogoMapListener, */ private void invokeAutoRefresh() { if ( mStatusManager.isSearchUIShow() || mStatusManager.isADASShow() ) { + mStatusManager.setUserInteractionStatus( TAG, true, false ); + mUiController.recoverLockMode(); return; } mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); @@ -345,6 +347,9 @@ public class MogoServices implements IMogoMapListener, Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount ); } + } else if( msg.what == ServiceConst.MSG_LOCK_CAR ){ + mStatusManager.setUserInteractionStatus( TAG, true, false ); + mUiController.recoverLockMode(); } } }; @@ -465,7 +470,10 @@ public class MogoServices implements IMogoMapListener, @Override public void onLockMap( boolean isLock ) { - + mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR ); + if ( !isLock ) { + mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); + } } @Override diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java index 967f8e7155..304c284b98 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java @@ -83,7 +83,7 @@ public class ServiceConst { public static final int DEFAULT_AUTO_REFRESH_DATA_RADIUS = 2_000; /** - * 30 s + * 20 s */ public static final int DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT = 20 * 1_000; @@ -107,6 +107,12 @@ public class ServiceConst { */ public static final int MSG_REQUEST_DATA = 0x201; + /** + * + * 锁车消息 + */ + public static final int MSG_LOCK_CAR = 0x202; + /** * 切换卡片内容-上一个 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 475bab0a0b..356bb2afb1 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 @@ -3,6 +3,7 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; import android.graphics.Color; +import android.net.Uri; import android.text.TextUtils; import android.view.View; import android.widget.TextView; @@ -64,6 +65,26 @@ public class MockIntentHandler implements IntentHandler { boolean status1 = intent.getBooleanExtra( "status", false ); MarkerServiceHandler.getMogoStatusManager().setUploadingStatus( TAG, status1 ); break; + case 7: + TextView button11 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 ); + if ( button11 != null ) { + button11.setVisibility( View.VISIBLE ); + button11.setBackgroundColor( Color.RED ); + button11.setOnClickListener( view -> { + Intent intent1 = new Intent( ); + intent1.setAction( Intent.ACTION_VIEW ); + intent1.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK ); + intent1.setData( Uri.parse("wechathelper://com.zhidao.wechathelper/main/transform?type=navi&lon=116.327007&lat=39.977639&from=os2.0") ); + try { + view.setOnClickListener( null ); + view.getContext().startActivity( intent1 ); + } catch ( Exception e ) { + e.printStackTrace(); + } + view.setVisibility( View.GONE ); + } ); + } + break; } } }