opt
This commit is contained in:
@@ -66,6 +66,7 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
public MainPresenter( MainView view ) {
|
||||
super( view );
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,7 +142,6 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
}
|
||||
|
||||
public void handleSchemeIntent( Intent intent ) {
|
||||
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
|
||||
SchemeIntent.getInstance().handle( intent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,19 @@ package com.mogo.module.main;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.main.livedata.CardInfo;
|
||||
import com.mogo.module.main.livedata.CardSwitchLiveData;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -20,7 +26,7 @@ import com.mogo.utils.logger.Logger;
|
||||
* <p>
|
||||
* 导航: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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user