bugfix
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -35,10 +37,12 @@ import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -147,6 +151,11 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
onChoosePath( intent, key_type );
|
||||
} else if ( key_type == 10021 ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( isForeground( getContext() ) && !hasOthersActivity() && !mStatusManager.isMainPageOnResume() ) {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
}
|
||||
}, 500L );
|
||||
return;
|
||||
}
|
||||
onStopNaviInternal();
|
||||
@@ -181,6 +190,27 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
getContext().registerReceiver( broadcastReceiver, inputFilter );
|
||||
}
|
||||
|
||||
private boolean isForeground( Context context ) {
|
||||
if ( context != null ) {
|
||||
ActivityManager activityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningAppProcessInfo > processes = activityManager.getRunningAppProcesses();
|
||||
for ( ActivityManager.RunningAppProcessInfo processInfo : processes ) {
|
||||
if ( processInfo.processName.equals( context.getPackageName() ) ) {
|
||||
if ( processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasOthersActivity() {
|
||||
ActivityManager am = ( ActivityManager ) getContext().getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 2 );
|
||||
return list != null && list.size() > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换交通态势模式
|
||||
*
|
||||
@@ -295,7 +325,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private void zoomMap( boolean zoomIn ) {
|
||||
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
|
||||
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
|
||||
if (! CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
if ( !CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
if ( result == MapControlResult.TARGET ) {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( zoomIn ) {
|
||||
|
||||
Reference in New Issue
Block a user