opt
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.service.impl.adas;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -13,7 +14,9 @@ import com.mogo.service.impl.MogoServiceApis;
|
||||
import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||
import com.mogo.service.impl.statusmanager.MogoStatusManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -38,49 +41,71 @@ public class MogoADASController implements IMogoADASController {
|
||||
public static final String VAL_OPEN = "打开";
|
||||
public static final String VAL_CLOSE = "关闭";
|
||||
|
||||
private MogoStatusManager mStatusManager = SingletonsHolder.get( IMogoStatusManager.class );
|
||||
private IMogoStatusManager mStatusManager = SingletonsHolder.get( IMogoStatusManager.class );
|
||||
|
||||
@Override
|
||||
public void openADAS() {
|
||||
showADAS();
|
||||
}
|
||||
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "open adas" );
|
||||
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
@Override
|
||||
public void killADAS() {
|
||||
try {
|
||||
object.put( PARAM_OBJECT, VAL_OBJECT );
|
||||
object.put( PARAM_OPERATION, VAL_OPEN );
|
||||
intent.putExtra( PARAM_DATA, object.toString() );
|
||||
sendBroadcast( intent );
|
||||
AutopilotServiceManage.getInstance().kill();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showADAS() {
|
||||
|
||||
Logger.d( TAG, "show adas" );
|
||||
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
try {
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
AutopilotServiceManage.getInstance().showAdas();
|
||||
} catch ( Exception e ) {
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( PARAM_OBJECT, VAL_OBJECT );
|
||||
object.put( PARAM_OPERATION, VAL_OPEN );
|
||||
intent.putExtra( PARAM_DATA, object.toString() );
|
||||
sendBroadcast( intent );
|
||||
} catch ( Exception e1 ) {
|
||||
Logger.e( TAG, e1, "error." );
|
||||
}
|
||||
}
|
||||
}, 500 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeADAS() {
|
||||
|
||||
if ( !mStatusManager.isADASShow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "close adas" );
|
||||
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( PARAM_OBJECT, VAL_OBJECT );
|
||||
object.put( PARAM_OPERATION, VAL_CLOSE );
|
||||
intent.putExtra( PARAM_DATA, object.toString() );
|
||||
sendBroadcast( intent );
|
||||
AutopilotServiceManage.getInstance().hideAdas();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( PARAM_OBJECT, VAL_OBJECT );
|
||||
object.put( PARAM_OPERATION, VAL_CLOSE );
|
||||
intent.putExtra( PARAM_DATA, object.toString() );
|
||||
sendBroadcast( intent );
|
||||
} catch ( Exception e1 ) {
|
||||
Logger.e( TAG, e1, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +120,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
AutopilotServiceManage.getInstance().init( context );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoInitor;
|
||||
import com.mogo.map.MogoInputtipsSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
@@ -88,6 +87,5 @@ public class MogoMapService implements IMogoMapService {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
MogoInitor.init( context );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SingletonsHolder {
|
||||
sSingletons.put( IMogoStatusManager.class, new MogoStatusManager() );
|
||||
}
|
||||
|
||||
public static < T > T get( Class clazz ) {
|
||||
public static < T > T get( Class<T> clazz ) {
|
||||
return ( T ) sSingletons.get( clazz );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user