opt
This commit is contained in:
@@ -9,7 +9,7 @@ android {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode rootProject.ext.android.versionCode
|
||||
versionName rootProject.ext.android.versionName
|
||||
versionName "${rootProject.ext.android.versionName}_${getCurrentDate()}_${getGitCommit()}"
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">@color/app_window_background</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowFullscreen">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ ext {
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
versionCode : 2,
|
||||
versionName : "1.0.1",
|
||||
versionName : "1.0.2",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -11,6 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -20,8 +23,11 @@ import java.util.Map;
|
||||
*/
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
private static volatile AIAssist sInstance;
|
||||
private String mLastQAndAspeakText;
|
||||
private String mLastQAndASpeakText;
|
||||
|
||||
private boolean mHasFlush = false;
|
||||
|
||||
public static AIAssist getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
@@ -43,6 +49,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
mQAndAMap.clear();
|
||||
mVoiceClient.release();
|
||||
mSpeakVoiceMap.clear();
|
||||
mCacheUnWakeupCommands.clear();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -54,10 +61,15 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
// 单独的语音播放
|
||||
private Map< String, IMogoVoiceCmdCallBack > mSpeakVoiceMap = new HashMap<>();
|
||||
|
||||
private Map< String, String[] > mCacheUnWakeupCommands = new ConcurrentHashMap<>();
|
||||
|
||||
private AIAssist( Context context ) {
|
||||
// private constructor
|
||||
mVoiceClient = new VoiceClient( context.getApplicationContext() );
|
||||
mVoiceClient.setCallBack( this );
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
|
||||
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +77,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "received command: %s", cmd );
|
||||
final List< IMogoVoiceCmdCallBack > cmdCallBacks = mCmdMap.get( cmd );
|
||||
Iterator< IMogoVoiceCmdCallBack > iterator = cmdCallBacks.iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
@@ -77,8 +90,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndAspeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndAspeakText );
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdAction( speakText );
|
||||
}
|
||||
@@ -87,8 +100,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndAspeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndAspeakText );
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdCancel( speakText );
|
||||
}
|
||||
@@ -98,7 +111,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
mLastQAndAspeakText = speakText;
|
||||
mLastQAndASpeakText = speakText;
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.get( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onSpeakEnd( speakText );
|
||||
@@ -114,8 +127,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
if ( TextUtils.equals( speakText, mLastQAndAspeakText ) ) {
|
||||
mLastQAndAspeakText = null;
|
||||
if ( TextUtils.equals( speakText, mLastQAndASpeakText ) ) {
|
||||
mLastQAndASpeakText = null;
|
||||
}
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
@@ -136,8 +149,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
*/
|
||||
public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
@@ -149,7 +164,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
*/
|
||||
public void speakTTSVoice( String text ) {
|
||||
try {
|
||||
mVoiceClient.speakDefault( text );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
@@ -163,8 +180,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
*/
|
||||
public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
@@ -175,8 +194,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
* @param tts 播报内容
|
||||
*/
|
||||
public void speakQAndACmd( String tts, IMogoVoiceCmdCallBack callBack ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,8 +208,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
* @param cancelCmds 取消命令唤醒词
|
||||
*/
|
||||
public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,10 +223,17 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList< IMogoVoiceCmdCallBack >() );
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
} else {
|
||||
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +243,13 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
* @param cmdWords
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
} else {
|
||||
Logger.i( TAG, "cache un wakeup command. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +260,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
*/
|
||||
public synchronized void registerUnWakeupCommandCallback( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList< IMogoVoiceCmdCallBack >() );
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
}
|
||||
@@ -237,6 +273,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd ) {
|
||||
mCmdMap.remove( cmd );
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,11 +282,13 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
* @param cmd
|
||||
*/
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
return;
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
if ( mCmdMap.containsKey( cmd ) ) {
|
||||
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
|
||||
if ( callBacks != null ) {
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
}
|
||||
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
|
||||
public static void startAssistant( Context context ) {
|
||||
@@ -260,4 +299,35 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||
context.sendBroadcast( intent );
|
||||
}
|
||||
|
||||
public synchronized void flush() {
|
||||
if ( mCacheUnWakeupCommands.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
mHasFlush = true;
|
||||
Logger.d( TAG, "flush cache voice command when voice service ready." );
|
||||
for ( String cmd : mCacheUnWakeupCommands.keySet() ) {
|
||||
registerUnWakeupCommand( cmd, mCacheUnWakeupCommands.get( cmd ) );
|
||||
}
|
||||
mCacheUnWakeupCommands.clear();
|
||||
}
|
||||
|
||||
private boolean isVoiceServiceReady( Context context ) {
|
||||
if ( isRunningTaskExist( context, "com.zhidao.speech" )
|
||||
&& isRunningTaskExist( context, "com.zhidao.speech.adapter" ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isRunningTaskExist( Context context, String processName ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningAppProcessInfo > processList = am.getRunningAppProcesses();
|
||||
for ( ActivityManager.RunningAppProcessInfo info : processList ) {
|
||||
if ( info.processName.equals( processName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.amap.hook;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.autonavi.amap.mapcore.interfaces.IAMap;
|
||||
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
|
||||
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -33,7 +34,12 @@ public class BnHooker implements InvocationHandler {
|
||||
host = field.get( map );
|
||||
Object object = Proxy.newProxyInstance(
|
||||
BnHooker.class.getClassLoader(),
|
||||
new Class[]{com.amap.api.col.n3.ft.a.class, IAMapDelegate.class, IAMapListener.class},
|
||||
new Class[]{
|
||||
com.amap.api.col.n3.ft.a.class,
|
||||
IAMapDelegate.class,
|
||||
IAMapListener.class,
|
||||
IAMap.class
|
||||
},
|
||||
this
|
||||
);
|
||||
field.set( map, object );
|
||||
@@ -45,7 +51,7 @@ public class BnHooker implements InvocationHandler {
|
||||
return method.invoke( host, 10 );
|
||||
}
|
||||
if ( method.getName().equals( "drawFrame" ) ) {
|
||||
Logger.d(TAG, "drawFrame");
|
||||
Logger.d( TAG, "drawFrame" );
|
||||
}
|
||||
return method.invoke( host, args );
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleshare
|
||||
} else {
|
||||
implementation project(":libraries:mogo-map")
|
||||
implementation project(":libraries:mogo-map-api")
|
||||
@@ -61,7 +60,6 @@ dependencies {
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMogoMapUIController.setLockZoom( 16 );
|
||||
mMogoMapUIController.recoverLockMode();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -220,8 +224,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
getWindow().setBackgroundDrawable( null );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this );
|
||||
@@ -240,11 +242,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
loadContainerModules();
|
||||
mMogoModuleHandler.loadModules();
|
||||
mPresenter.delayOperations();
|
||||
hideCoverUpLayout();
|
||||
|
||||
// 显示左边遮罩
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mTopShadowFrame.setVisibility( View.VISIBLE );
|
||||
mCardsBkg.setVisibility( View.VISIBLE );
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
@@ -293,6 +295,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void hideCoverUpLayout() {
|
||||
mCoverUpLayout.setVisibility( View.GONE );
|
||||
mCardsBkg.setVisibility( View.VISIBLE );
|
||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -303,8 +307,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
//mCardsContainer.setPageTransformer( true, mTransformer );
|
||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||
|
||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -116,7 +116,7 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
*/
|
||||
public void delayOperations() {
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_LOAD_CARD_MODULES, 100L );
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_HIDE_MAP_COVER_FRAME, 0L );
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_HIDE_MAP_COVER_FRAME, 150L );
|
||||
}
|
||||
|
||||
public void postTrackLastCardShowEvent( IMogoModuleProvider provider ) {
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_main_top_shadow_height"
|
||||
android:background="@drawable/module_main_dw_top_frame_bkg"
|
||||
android:visibility="invisible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_left_shadow_frame"
|
||||
android:layout_width="@dimen/module_main_map_shadow_frame_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/module_main_dw_left_frame_bkg"
|
||||
android:visibility="invisible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_header_fragment_container"
|
||||
@@ -67,6 +67,7 @@
|
||||
android:layout_marginTop="@dimen/cards_container_dp_600"
|
||||
android:layout_marginLeft="@dimen/dp_64"
|
||||
android:layout_marginRight="@dimen/dp_64"
|
||||
android:visibility="invisible"
|
||||
android:background="@drawable/module_main_card_cover_up_bottom"
|
||||
/>
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
|
||||
<item name="checkboxStyle">@style/noCheckboxStyle</item>
|
||||
<item name="android:windowFullscreen">false</item>
|
||||
<item name="radioButtonStyle">@style/noCheckboxStyle</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -71,7 +72,11 @@ public class MapPresenter extends Presenter<MapView> implements
|
||||
mView.getUIController().setTrafficEnabled(opera_type == 0);
|
||||
} else if (type == 1) {
|
||||
mView.getUIController().changeZoom(opera_type == 0);
|
||||
mMogoMapService.getMapUIController().recoverLockMode();//缩放地图会导致锁车发生改变,这里强制锁车
|
||||
UiThreadHandler.postDelayed( ()->{
|
||||
int lockZoomLevel = opera_type == 0 ? ( ( int ) mView.getUIController().getZoomLevel() ) : ( ( int ) (mView.getUIController().getZoomLevel() + 0.5 ));
|
||||
mView.getUIController().setLockZoom( lockZoomLevel );
|
||||
mMogoMapService.getMapUIController().recoverLockMode();//缩放地图会导致锁车发生改变,这里强制锁车
|
||||
}, 1_000 );
|
||||
} else if (type == 2) {
|
||||
if (opera_type == 0) {
|
||||
mView.getUIController().changeMapMode(EnumMapUI.CarUp_2D);
|
||||
|
||||
@@ -301,6 +301,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_SWITCH_CARD, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_ADAS_STATUS, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_OPERATION, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_READY, this );
|
||||
|
||||
mADASController = apis.getAdasControllerApi();
|
||||
mLauncher = apis.getLauncherApi();
|
||||
@@ -362,6 +363,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
// 小智语音
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_UI );
|
||||
filter.addAction( MogoReceiver.ACTION_ADAS_STATUS );
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_READY );
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
Logger.i( TAG, "register voice receiver." );
|
||||
@@ -786,6 +788,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if( MogoReceiver.ACTION_VOICE_READY.equals( command ) ){
|
||||
AIAssist.getInstance( mContext ).flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,10 @@ public class MogoActionHandler implements IMogoActionManager {
|
||||
@Override
|
||||
public void bizInvoke( String biz, int position, Object data ) {
|
||||
if ( mBizActionDoneListener != null ) {
|
||||
mBizActionDoneListener.onBizActionDone( biz, position, data );
|
||||
try {
|
||||
mBizActionDoneListener.onBizActionDone( biz, position, data );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -342,7 +343,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
dispatchDataToBiz();
|
||||
UiThreadHandler.post( () -> {
|
||||
dispatchDataToBiz();
|
||||
} );
|
||||
|
||||
// 语音触发的在线车辆搜索,采用增量的形式绘制
|
||||
if ( mIsAISearchOnlineData = isOnlineCarDataOnly( mLastDataResult ) ) {
|
||||
@@ -601,9 +604,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
fillNumberTrackEventBody( array, 3, onlineCarList.size() );
|
||||
fillNumberTrackEventBody( array, 1, exploreWayList.size() );
|
||||
fillNumberTrackEventBody( array, 4, shareMusicList.size() );
|
||||
int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
fillNumberTrackEventBody( array, 3, size );
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
fillNumberTrackEventBody( array, 1, size );
|
||||
size = shareMusicList == null ? 0 : shareMusicList.size();
|
||||
fillNumberTrackEventBody( array, 4, size );
|
||||
|
||||
int num_gas_station = 0;
|
||||
int num_traffic_check = 0;
|
||||
@@ -611,28 +617,31 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
int num_shop_discount = 0;
|
||||
int num_fours_shop = 0;
|
||||
|
||||
for ( MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList ) {
|
||||
if ( markerNoveltyInfo == null ) {
|
||||
continue;
|
||||
}
|
||||
switch ( markerNoveltyInfo.getPoiType() ) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
num_gas_station++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
num_traffic_check++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
num_road_closed++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
num_shop_discount++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
num_fours_shop++;
|
||||
break;
|
||||
if ( noveltyInfoList != null ) {
|
||||
for ( MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList ) {
|
||||
if ( markerNoveltyInfo == null ) {
|
||||
continue;
|
||||
}
|
||||
switch ( markerNoveltyInfo.getPoiType() ) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
num_gas_station++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
num_traffic_check++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
num_road_closed++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
num_shop_discount++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
num_fours_shop++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fillNumberTrackEventBody( array, 2, num_gas_station );
|
||||
fillNumberTrackEventBody( array, 6, num_road_closed );
|
||||
fillNumberTrackEventBody( array, 5, num_traffic_check );
|
||||
@@ -793,9 +802,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoMarkerManager markerManager = MarkerServiceHandler.getMarkerManager();
|
||||
List< IMogoMarker > markers = markerManager.getMarkers( biz );
|
||||
if ( markers != null ) {
|
||||
IMogoMarker marker = markers.get( position );
|
||||
if ( marker != null ) {
|
||||
try {
|
||||
IMogoMarker marker = markers.get( position );
|
||||
switchMarkerOpenStatus( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "occur error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
public static final String ACTION_ADAS_STATUS = "com.zhidao.autopilot.adas.msg";
|
||||
|
||||
/**
|
||||
* 小智语音准备就绪
|
||||
*/
|
||||
public static final String ACTION_VOICE_READY = "com.zhidao.auto.AIAssist.ready";
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
public MogoReceiver( Context context ) {
|
||||
|
||||
Reference in New Issue
Block a user