黑夜白天模式:adas、语音、桌面、高德地图同步
This commit is contained in:
@@ -5,6 +5,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -20,15 +21,21 @@ class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
|
||||
|
||||
public static final String TAG = "AutoNaviBroadcastReceiver";
|
||||
|
||||
// 发送高德:部分是小智语音发给高德的,这里顺便接收处理,都是历史遗留问题
|
||||
public static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
// 接收高德
|
||||
public static final String AUTONAVI_STANDARD_BROADCAST_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
|
||||
public void register( IMogoIntentManager manager ) {
|
||||
manager.registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
manager.registerIntentListener( AUTONAVI_STANDARD_BROADCAST_SEND, this );
|
||||
}
|
||||
|
||||
public void unregister( IMogoIntentManager manager ) {
|
||||
mCallback = null;
|
||||
manager.unregisterIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
manager.unregisterIntentListener( AUTONAVI_STANDARD_BROADCAST_SEND, this );
|
||||
}
|
||||
|
||||
private OnMapControlCallback mCallback;
|
||||
@@ -47,7 +54,8 @@ class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
|
||||
|
||||
Logger.d( TAG, "action = %s, keyType=%s, type=%s, operType=%s", action, keyType, type, operaType );
|
||||
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV )
|
||||
&& !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_SEND ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,6 +128,16 @@ class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
|
||||
.highSpeed( prefer == 20 )
|
||||
.avoidSpeed( prefer == 3 );
|
||||
mCallback.onReCalculatePath( config );
|
||||
} else if ( keyType == 10019 ) {
|
||||
int extraState = intent.getIntExtra( "EXTRA_STATE", -1 );
|
||||
// 高德改变黑夜白天模式后,传递给launcher,顺便改变其他
|
||||
if ( extraState == 37 ) {
|
||||
// 白天模式
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().changeAdasControlMode( EnumMapUI.Type_Light );
|
||||
} else if ( extraState == 38 ) {
|
||||
// 夜间模式
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().changeAdasControlMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -56,7 +55,7 @@ class MapControlCommandHandler {
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Light );
|
||||
notifyAMap(EnumMapUI.Type_Light);
|
||||
notifyAMap( EnumMapUI.Type_Light );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
@@ -68,12 +67,12 @@ class MapControlCommandHandler {
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Night );
|
||||
notifyAMap(EnumMapUI.Type_Night);
|
||||
notifyAMap( EnumMapUI.Type_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
notifyAMap(EnumMapUI.Type_AUTO_LIGHT_Night);
|
||||
notifyAMap( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
mCallback.onDisplayOverview();
|
||||
@@ -99,7 +98,7 @@ class MapControlCommandHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyAMap( EnumMapUI ui ) {
|
||||
public void notifyAMap( EnumMapUI ui ) {
|
||||
if ( ui == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -116,6 +115,8 @@ class MapControlCommandHandler {
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setAction( "AUTONAVI_STANDARD_BROADCAST_RECV" );
|
||||
|
||||
@@ -81,7 +81,6 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,6 +103,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
mView.getUIController().changeMapMode( mapUI );
|
||||
mCustomVoiceCommandHandler.notifyAMap( mapUI );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user