This commit is contained in:
wangcongtao
2020-03-18 20:50:22 +08:00
parent 78f87fbfd6
commit 0f0bd23d11
9 changed files with 43 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
}
public synchronized void release() {
Logger.d( TAG, "release" );
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
for ( String cmd : mCmdMap.keySet() ) {
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
@@ -235,10 +236,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
if ( mHasFlush ) {
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
mCacheUnWakeupCommands.remove( cmd );
} else {
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
mCacheUnWakeupCommands.put( cmd, cmdWords );
}
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
mCacheUnWakeupCommands.put( cmd, cmdWords );
}
/**
@@ -251,10 +251,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
if ( mHasFlush ) {
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
mCacheUnWakeupCommands.remove( cmd );
} else {
Logger.i( TAG, "cache un wakeup command. %s", cmd );
mCacheUnWakeupCommands.put( cmd, cmdWords );
}
Logger.i( TAG, "cache un wakeup command. %s", cmd );
mCacheUnWakeupCommands.put( cmd, cmdWords );
}
/**
@@ -287,12 +286,14 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
* @param cmd
*/
public synchronized void unregisterUnWakeupCommand( String cmd, IMogoVoiceCmdCallBack callBack ) {
mCacheUnWakeupCommands.remove( cmd );
if ( mCmdMap.containsKey( cmd ) ) {
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
if ( callBacks != null ) {
callBacks.remove( callBack );
}
if ( callBacks.isEmpty() ) {
mCacheUnWakeupCommands.remove( cmd );
}
}
}
@@ -314,7 +315,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
for ( String cmd : mCacheUnWakeupCommands.keySet() ) {
registerUnWakeupCommand( cmd, mCacheUnWakeupCommands.get( cmd ) );
}
mCacheUnWakeupCommands.clear();
}
private boolean isVoiceServiceReady( Context context ) {

View File

@@ -50,7 +50,7 @@ public class NaviClient implements IMogoNavi {
private NaviClient( Context context ) {
mAMapNavi = AMapNavi.getInstance( context );
//mAMapNavi.setEmulatorNaviSpeed( 120 );
mAMapNavi.setEmulatorNaviSpeed( 120 );
mAMapNavi.setUseInnerVoice( true );
mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this );
mAimlessModeListener = new AimlessModeListenerAdapter() {

View File

@@ -4,6 +4,7 @@ import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.mogo.map.MogoLatLng;
import com.mogo.map.exception.MogoMapException;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -15,6 +16,8 @@ import java.util.List;
*/
public class MogoMapUtils {
private static final String TAG = "MogoMapUtils";
public static LatLngBounds getLatLngBounds( MogoLatLng carPosition, List< MogoLatLng > lonLats, boolean lockCarPosition ) throws Exception {
if ( lonLats == null || lonLats.isEmpty() ) {
@@ -74,6 +77,21 @@ public class MogoMapUtils {
return null;
}
if ( east < west ) {
double tmp = east;
east = west;
west = tmp;
}
if( north < south ){
double tmp = north;
north = south;
south = tmp;
}
Logger.d( TAG, "west = %s, east = %s, north = %s, south = %s", west, east, north, south );
return new LatLngBounds.Builder().include( new LatLng( east, north ) ).include( new LatLng( west, south ) ).build();
}
}

View File

@@ -8,5 +8,5 @@
android:id="@+id/map_amap_id_cursor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_1" />
android:src="@drawable/map_api_ic_current_location2_cursor" />
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -18,8 +18,10 @@ import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoCongestionInfo;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.overlay.IMogoPolyline;
@@ -57,7 +59,9 @@ import java.util.Map;
*/
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter >
implements EntranceView,
IMogoNaviListener, IMogoMapListener {
IMogoNaviListener,
IMogoMapListener,
IMogoAimlessModeListener {
private static final String TAG = "EntranceFragment";
@@ -214,6 +218,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
mMogoRegisterCenter.registerMogoAimlessModeListener( TAG, this );
mMogoMarkerManager = mService.getMarkerManager( getContext() );
}
@@ -265,6 +270,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
@Override
public void onUpdateTraffic( MogoTraffic traffic ) {
}
@Override
public void onUpdateTraffic2( MogoTraffic traffic ) {
if ( traffic == null ) {
return;
}
@@ -277,6 +286,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
}
}
@Override
public void onUpdateCongestion( MogoCongestionInfo info ) {
}
@Override
public void onMapLoaded() {