diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 7addc8c88b..abaa885203 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -155,7 +155,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, } mMapView.setRouteOverlayVisible( false ); mMapView.setCarOverlayVisible( false ); - setUIMode(EnumMapUI.CarUp_2D, null); + setUIMode( EnumMapUI.CarUp_2D, null ); } } @@ -201,7 +201,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, initMapView(); initListeners(); initMyLocation(); - initLocationSource(); +// initLocationSource(); } } @@ -450,7 +450,6 @@ public class AMapNaviViewWrapper implements IMogoMapView, } } - private boolean checkAMapView() { if ( mMapView == null ) { Logger.e( TAG, "高德mapView实例为空,请检查" ); @@ -467,22 +466,17 @@ public class AMapNaviViewWrapper implements IMogoMapView, return; } loseLockMode(); - mMapView.getMap() - .moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) ); + mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) ); } @Override public void showMyLocation( boolean visible ) { - Logger.d( TAG, "showMyLocation1" ); + Logger.d( TAG, "showMyLocation1 %s", visible ); + if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) { + return; + } if ( checkAMapView() ) { MyLocationStyle style = mMapView.getMap().getMyLocationStyle(); - - if ( visible ) { - if ( NaviClient.getInstance( getContext() ).isNaviing() ) { - return; - } - } - style.showMyLocation( visible ); if ( visible ) { // 强制刷新一遍车标 @@ -492,19 +486,15 @@ public class AMapNaviViewWrapper implements IMogoMapView, } } - private View mCursorView; - @Override - public void showMyLocation( float degree ) { + public void showMyLocation( View view ) { if ( NaviClient.getInstance( getContext() ).isNaviing() ) { return; } if ( checkAMapView() ) { - mCursorView = View.inflate( getContext(), R.layout.map_amap_cursor, null ); - mCursorView.setRotation( degree ); MyLocationStyle style = mMapView.getMap().getMyLocationStyle(); style.showMyLocation( true ); - style.myLocationIcon( BitmapDescriptorFactory.fromView( mCursorView ) ); + style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) ); mMapView.getMap().setMyLocationStyle( style ); } } @@ -523,7 +513,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, } } - private void initLocationSource(){ + private void initLocationSource() { if ( checkAMapView() ) { mMapView.getMap().setLocationSource( new LocationSource() { @Override diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java index f7d9f2674e..2509ae321e 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java @@ -94,9 +94,9 @@ public class AMapUIController implements IMogoMapUIController { } @Override - public void showMyLocation( float degree ) { + public void showMyLocation( View view ) { if ( mClient != null ) { - mClient.showMyLocation( degree ); + mClient.showMyLocation( view ); } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 8ec0cb3263..bd2d6aeef6 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -56,9 +56,10 @@ public interface IMogoMapUIController { void showMyLocation( boolean visible ); /** - * @param degree 车标方向 + * + * @param view */ - void showMyLocation( float degree ); + void showMyLocation( View view ); /** * 以外部定位的方式改变当前位置 diff --git a/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location.png b/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location.png deleted file mode 100755 index 70be2a654c..0000000000 Binary files a/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location.png and /dev/null differ diff --git a/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2.png b/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2.png index e7914a741e..5219b2f620 100644 Binary files a/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2.png and b/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2.png differ diff --git a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png b/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png deleted file mode 100644 index 65cecf9af2..0000000000 Binary files a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png and /dev/null differ diff --git a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2.png b/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2.png index 8f8e62bae4..a4486144b2 100644 Binary files a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2.png and b/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2.png differ diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index a905a0f819..83d2d655a8 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -88,9 +88,9 @@ public class MogoMapUIController implements IMogoMapUIController { } @Override - public void showMyLocation( float degree ) { + public void showMyLocation( View view ) { if ( mDelegate != null ) { - mDelegate.showMyLocation( degree ); + mDelegate.showMyLocation( view ); } } diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index 7f0a61f73b..324fb644b0 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -59,11 +59,10 @@ import java.util.List; * 描述:加载各个模块 */ public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView, - IMogoLocationListener, - IMogoMarkerClickListener, IMogoVoiceCmdCallBack { + IMogoLocationListener, + IMogoMarkerClickListener { private static final String TAG = "MainActivity"; - private static final String BACK_CMD = "back"; private IMogoServiceApis mServiceApis; private IMogoMapService mMogoMapService; @@ -281,18 +280,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> { if ( size == 0 ) { showLayout(); - - AIAssist.getInstance(getContext()) - .unregisterUnWakeupCommand(BACK_CMD); - } else if ( size == 1 ) { - AIAssist.getInstance(getContext()) - .registerUnWakeupCommand(BACK_CMD, new String[] { "关闭", "返回" }, this); - - UiThreadHandler.postDelayed(new Runnable() { - @Override public void run() { - mMogoMapUIController.setPointToCenter(0.5,0.5); - + UiThreadHandler.postDelayed( new Runnable() { + @Override + public void run() { + mMogoMapUIController.setPointToCenter( 0.5, 0.5 ); } }, 1000 ); hideLayout(); @@ -424,28 +416,4 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme mMogoFragmentManager = null; AIAssist.getInstance( this ).release(); } - - @Override public void onCmdSelected(String cmd) { - - if (TextUtils.equals(BACK_CMD,cmd)) { - mMogoFragmentManager.clearAll(); - } - - } - - @Override public void onCmdAction(String speakText) { - - } - - @Override public void onCmdCancel(String speakText) { - - } - - @Override public void onSpeakEnd(String speakText) { - - } - - @Override public void onSpeakSelectTimeOut(String speakText) { - - } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index b45b844f9a..3e2e904551 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -15,6 +15,7 @@ import android.os.Message; import android.os.Trace; import android.text.TextUtils; import android.view.MotionEvent; +import android.view.View; import androidx.annotation.NonNull; @@ -48,6 +49,7 @@ import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.cardmanager.IMogoCardManager; +import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; import com.mogo.service.fragmentmanager.IMogoFragmentManager; import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.intent.IMogoIntentManager; @@ -85,7 +87,8 @@ public class MogoServices implements IMogoMapListener, IMogoStatusChangedListener, IMogoIntentListener, IMogoAimlessModeListener, - IMogoVoiceCmdCallBack { + IMogoVoiceCmdCallBack, + FragmentStackTransactionListener { private boolean mInternalUnWakeupRegisterStatus = false; @@ -310,6 +313,8 @@ public class MogoServices implements IMogoMapListener, mLauncher = apis.getLauncherApi(); mFragmentManager = apis.getFragmentManagerApi(); mCardManager = apis.getCardManagerApi(); + + mFragmentManager.addMainFragmentStackTransactionListener( this ); initWorkThread(); } @@ -633,17 +638,9 @@ public class MogoServices implements IMogoMapListener, case ADAS_UI: try { if ( isTrue ) { - // ADAS 时,不在自动刷新打点策略 - stopAutoRefreshStrategy(); - // 清除所有的打点信息记录 - MarkerServiceHandler.getMapMarkerManager().alreadySmallMarker.clear(); + onAdasOn(); } else { - // 主动刷新 - refreshStrategy(); - // ADAS关闭后,打开打点策略 - if ( mAutoRefreshCallback != null ) { - mAutoRefreshCallback.onSuccess(); - } + onAdasClosed(); } } catch ( Exception e ) { e.printStackTrace(); @@ -659,6 +656,21 @@ public class MogoServices implements IMogoMapListener, } } + private void onAdasOn(){ + // ADAS 时,不在自动刷新打点策略 + stopAutoRefreshStrategy(); + // 清除所有的打点信息记录 + MarkerServiceHandler.getMapMarkerManager().alreadySmallMarker.clear(); + } + + private void onAdasClosed(){ + refreshStrategy(); + // ADAS关闭后,打开打点策略 + if ( mAutoRefreshCallback != null ) { + mAutoRefreshCallback.onSuccess(); + } + } + public void restartAutoRefreshAtTime( int time ) { if ( time < 0 ) { Logger.w( TAG, "ignore refresh request case time < 0" ); @@ -798,6 +810,9 @@ public class MogoServices implements IMogoMapListener, } else if ( MogoReceiver.ACTION_VOICE_READY.equals( command ) ) { AIAssist.getInstance( mContext ).flush(); } else if ( ServiceConst.COMMAND_MY_LOCATION.equals( command ) ) { + if ( mStatusManager.isSearchUIShow() ) { + return; + } if ( mStatusManager.isMainPageOnResume() ) { mUiController.recoverLockMode(); } @@ -853,10 +868,17 @@ public class MogoServices implements IMogoMapListener, return; } UiThreadHandler.post( () -> { - mUiController.showMyLocation( ( ( float ) degree ) ); + + mUiController.showMyLocation( inflateCursorView( degree ) ); } ); } + private View inflateCursorView( double degree ) { + View view = View.inflate( mContext, R.layout.map_amap_cursor, null ); + view.setRotation( ( float ) degree ); + return view; + } + private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) { if ( valuesBean == null ) { return; @@ -903,6 +925,8 @@ public class MogoServices implements IMogoMapListener, if ( mStatusManager.isMainPageOnResume() ) { mUiController.recoverLockMode(); } + } else if ( TextUtils.equals( ServiceConst.CMD_BACK, cmd ) ) { + mFragmentManager.clearAll(); } } @@ -925,4 +949,13 @@ public class MogoServices implements IMogoMapListener, public void onSpeakSelectTimeOut( String speakText ) { } + + @Override + public void onTransaction( int size ) { + if ( size == 0 ) { + AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK ); + } else { + AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this ); + } + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java index 4e0fd3b80d..bc53a71cae 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java @@ -149,5 +149,8 @@ public class ServiceConst { "定位我的位置" }; + public static final String CMD_BACK = "back"; + public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"}; + } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index e3ff2c1362..9ea9784bac 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -340,6 +340,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener, return; } + if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) { + return; + } + // 解析不同的Marker类型,然后对应的进行绘制 mLastDataResult = response.getResult(); @@ -392,6 +396,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener, return; } + if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) { + return; + } + if ( TextUtils.isEmpty( mCurrentModuleName ) ) { // 默认大而全 mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION; diff --git a/libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2_cursor.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/map_api_ic_current_location2_cursor.png similarity index 100% rename from libraries/mogo-map-api/src/main/res/drawable-ldpi/map_api_ic_current_location2_cursor.png rename to modules/mogo-module-service/src/main/res/drawable-ldpi/map_api_ic_current_location2_cursor.png diff --git a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2_cursor.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/map_api_ic_current_location2_cursor.png similarity index 100% rename from libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location2_cursor.png rename to modules/mogo-module-service/src/main/res/drawable-xhdpi/map_api_ic_current_location2_cursor.png diff --git a/libraries/map-amap/src/main/res/layout/map_amap_cursor.xml b/modules/mogo-module-service/src/main/res/layout/map_amap_cursor.xml similarity index 100% rename from libraries/map-amap/src/main/res/layout/map_amap_cursor.xml rename to modules/mogo-module-service/src/main/res/layout/map_amap_cursor.xml diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index a988dc8a80..9969338db9 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -6,8 +6,13 @@ import android.content.Intent; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.AbsMogoApplication; +import com.mogo.map.MogoOverlayManager; import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASController; +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.logger.Logger; import org.json.JSONObject; @@ -33,8 +38,15 @@ public class MogoADASController implements IMogoADASController { public static final String VAL_OPEN = "打开"; public static final String VAL_CLOSE = "关闭"; + private MogoStatusManager mStatusManager = SingletonsHolder.get( IMogoStatusManager.class ); + @Override public void openADAS() { + + if ( mStatusManager.isADASShow() ) { + return; + } + Intent intent = new Intent( ACTION ); intent.putExtra( PARAM_COMMAND, VAL_COMMAND ); JSONObject object = new JSONObject(); @@ -50,6 +62,11 @@ public class MogoADASController implements IMogoADASController { @Override public void closeADAS() { + + if ( !mStatusManager.isADASShow() ) { + return; + } + Intent intent = new Intent( ACTION ); intent.putExtra( PARAM_COMMAND, VAL_COMMAND ); JSONObject object = new JSONObject();