From ca7828a5d8781287e25fc45c43df2bffa9311920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Fri, 24 Jul 2020 16:23:16 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=8D=87=E7=BA=A7v2x=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7ba83bc94d..316601007d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -71,7 +71,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT # 在线车辆F MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2 # v2x -MOGO_MODULE_V2X_VERSION=1.1.533 +MOGO_MODULE_V2X_VERSION=1.1.534 # 推送 MOGO_MODULE_PUSH_VERSION=1.1.5.7 MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5 From 66c98a3094af8db472a56e96b029d3bc84817737 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Wed, 29 Jul 2020 19:09:12 +0800 Subject: [PATCH 2/8] bugfix: E85XJD-107 --- .../extensions/entrance/EntranceFragment.java | 42 ++++++++----------- .../com/mogo/module/map/MapPresenter.java | 2 +- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 6cf876ad86..e2d83eb720 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -355,33 +355,27 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D ); } mCameraMode.setSelected( !mCameraMode.isSelected() ); - mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : - R.string.mode_north_up ) ); + mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) ); } ); - mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, - new IMogoIntentListener() { - @Override - public void onIntentReceived( String intentStr, Intent intent ) { - int key_type = intent.getIntExtra( "KEY_TYPE", 0 ); - int type = intent.getIntExtra( "EXTRA_TYPE", -1 ); - int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 ); - if ( key_type == 10027 ) { - if ( opera_type == 0 ) { - mCameraMode.setSelected( false ); - } else if ( opera_type == 1 ) { - mCameraMode.setSelected( true ); - } - mCameraMode.setText( getString( mCameraMode.isSelected() ? - R.string.mode_car_up : R.string.mode_north_up ) ); - } - } - } ); - MogoEntranceButtons.save( ButtonIndex.BUTTON1, - findViewById( R.id.module_entrance_id_button1 ) ); - MogoEntranceButtons.save( ButtonIndex.BUTTON2, - findViewById( R.id.module_entrance_id_button2 ) ); + mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, (( intentStr, intent ) -> { + int key_type = intent.getIntExtra( "KEY_TYPE", 0 ); + int type = intent.getIntExtra( "EXTRA_TYPE", -1 ); + int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 ); + if ( key_type == 10027 ) { + if ( opera_type == 0 ) { + mCameraMode.setSelected( false ); + } else if ( opera_type == 1 ) { + mCameraMode.setSelected( true ); + } + mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) ); + } else if( key_type == 10021 ){ + onStopNavi(); + } + }) ); + MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) ); + MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) ); mDisplayOverviewBounds = new Rect( ResourcesHelper.getDimensionPixelSize( getContext(), diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index e144f7534d..85bc1bf0f0 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -112,7 +112,6 @@ public class MapPresenter extends Presenter< MapView > implements } else if ( type == 1 ) { zoomMap( opera_type == 0 ); } else if ( type == 2 ) { -// mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent ); onChangeCameraMode( opera_type ); } } else if ( key_type == 10048 ) { @@ -183,6 +182,7 @@ public class MapPresenter extends Presenter< MapView > implements mMogoMapService.getNavi( getContext() ).reCalculateRoute( config ); } + mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent ); } }; From fc9b41b1f3463416578580bc860cc9fff12e9801 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 30 Jul 2020 16:05:40 +0800 Subject: [PATCH 3/8] bugfix --- .../src/main/java/com/mogo/module/map/MapPresenter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index 85bc1bf0f0..3e9378de92 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -156,6 +156,7 @@ public class MapPresenter extends Presenter< MapView > implements mLauncher.backToLauncher( getContext() ); } }, 500L ); + mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent ); return; } onStopNaviInternal(); From af6e2b00f986a5dd885e52956efa5be199602a43 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Sun, 2 Aug 2020 17:18:29 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=BC=80=E6=9C=BA=E6=88=96=E8=80=85accOn?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8A=A0=E8=BD=BD=E9=81=93=E8=B7=AF=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/amap/location/ALocationClient.java | 22 ++--- .../module/service/MogoServiceProvider.java | 36 +------- .../com/mogo/module/service/MogoServices.java | 87 ++++++++++++------- .../intent/AccStatusIntentHandler.java | 26 +++--- .../service/marker/MapMarkerManager.java | 7 +- 5 files changed, 92 insertions(+), 86 deletions(-) diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java index a551c302bc..89dfeac7f4 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java @@ -26,6 +26,7 @@ import java.util.Set; public class ALocationClient implements IMogoLocationClient { private static final String TAG = "LocationClient"; + private final Context mContext; private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 ); private MogoLocation mLastLocation; @@ -34,12 +35,7 @@ public class ALocationClient implements IMogoLocationClient { private boolean mIsDestroyed = false; public ALocationClient( Context context ) { - mClient = new AMapLocationClient( context ); - mClient.setLocationListener( mListener ); - mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() ); - if ( mLastLocation == null ) { - mLastLocation = new MogoLocation(); - } + mContext = context; } private AMapLocationClient mClient; @@ -51,11 +47,12 @@ public class ALocationClient implements IMogoLocationClient { @Override public void start( long interval ) { - if ( mIsDestroyed ) { - destroyWarming(); - return; + if ( mClient == null ) { + mClient = new AMapLocationClient( mContext ); + mClient.setLocationListener( mListener ); + mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() ); } - if ( mClient != null ) { + if ( !mClient.isStarted() ) { AMapLocationClientOption option = new AMapLocationClientOption(); option.setLocationMode( AMapLocationClientOption.AMapLocationMode.Hight_Accuracy ); option.setNeedAddress( true ); @@ -109,6 +106,9 @@ public class ALocationClient implements IMogoLocationClient { destroyWarming(); return null; } + if ( mLastLocation == null ) { + mLastLocation = new MogoLocation(); + } return mLastLocation; } @@ -140,7 +140,7 @@ public class ALocationClient implements IMogoLocationClient { aMapLocation.getLongitude() == 0.0D ) { return; } - Trace.beginSection("timer.onLocationChanged"); + Trace.beginSection( "timer.onLocationChanged" ); mLastLocation = ObjectUtils.fromAMap( aMapLocation ); synchronized ( sListeners ) { Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator(); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java index 79950ef3c4..2c026c357f 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java @@ -2,57 +2,22 @@ package com.mogo.module.service; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.text.TextUtils; -import android.view.MotionEvent; import android.view.View; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.AbsMogoApplication; -import com.mogo.map.MogoLatLng; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; -import com.mogo.map.location.MogoLocation; import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.map.marker.IMogoMarkerManager; -import com.mogo.map.model.MogoPoi; import com.mogo.map.navi.IMogoNaviListener; -import com.mogo.map.navi.MogoNaviInfo; -import com.mogo.map.navi.MogoTraffic; -import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.MogoModule; -import com.mogo.module.common.MogoModulePaths; -import com.mogo.module.service.network.RefreshCallback; -import com.mogo.module.service.network.RefreshModel; -import com.mogo.module.service.receiver.MogoReceiver; -import com.mogo.module.service.refresh.AutoRefreshStrategy; -import com.mogo.module.service.refresh.CustomRefreshStrategy; -import com.mogo.service.MogoServicePaths; -import com.mogo.service.intent.IMogoIntentListener; -import com.mogo.service.intent.IMogoIntentManager; -import com.mogo.service.map.IMogoMapService; import com.mogo.service.module.IMogoModuleLifecycle; import com.mogo.service.module.IMogoModuleProvider; -import com.mogo.service.module.IMogoRegisterCenter; import com.mogo.service.module.ModuleType; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.UiThreadHandler; -import com.mogo.utils.logger.Logger; - -import java.util.Iterator; -import java.util.List; /** * @author congtaowang @@ -128,6 +93,7 @@ public class MogoServiceProvider implements IMogoModuleProvider { @Override public void init( Context context ) { + MarkerServiceHandler.init( context ); UiThreadHandler.postDelayed( () -> { MogoServices.getInstance().init( AbsMogoApplication.getApp() ); }, 5_000L ); 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 e606546990..7c5a077101 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 @@ -56,6 +56,7 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.TipToast; +import com.mogo.utils.UiThreadHandler; import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; @@ -190,23 +191,25 @@ public class MogoServices implements IMogoMapListener, } } - /** - * 自动刷新:锁车、缩放比例:16、半径 2KM - */ - private void invokeAutoRefresh() { - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { - mStatusManager.setUserInteractionStatus( TAG, true, false ); - mUiController.recoverLockMode(); - return; - } - mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); - mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); - mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); + }; + + /** + * 自动刷新:锁车、缩放比例:16、半径 2KM + */ + private void invokeAutoRefresh() { + if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { mStatusManager.setUserInteractionStatus( TAG, true, false ); mUiController.recoverLockMode(); - notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback ); + return; } - }; + mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); + mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); + mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); + mStatusManager.setUserInteractionStatus( TAG, true, false ); + mUiController.recoverLockMode(); + notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback ); + } + private Context mContext; /** @@ -271,12 +274,13 @@ public class MogoServices implements IMogoMapListener, private boolean mIsMainPageFirstResume = true; + private boolean mIsFirstAccOn = true; + public void init( Context context ) { mContext = context; initWorkThread(); - MarkerServiceHandler.init( mContext ); mRefreshModel = new RefreshModel( context ); mMogoMapService = MarkerServiceHandler.getMapService(); mUiController = mMogoMapService.getMapUIController(); @@ -364,6 +368,7 @@ public class MogoServices implements IMogoMapListener, if ( msg.obj instanceof RefreshObject ) { RefreshObject ro = ( ( RefreshObject ) msg.obj ); if ( ro.mLonLat == null ) { + Logger.w( TAG, "lonLat is null." ); return; } mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback ); @@ -617,9 +622,7 @@ public class MogoServices implements IMogoMapListener, // 自动刷新触发 final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() ); if ( mLastAutoRefreshLocation == null ) { - mLastAutoRefreshLocation = point; - mLoopRequest = true; - notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + startFirstLocationRequest( point ); return; } float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point ); @@ -633,8 +636,27 @@ public class MogoServices implements IMogoMapListener, } } + /** + * 首次定位成功后,执行道路事件的刷新 + * + * @param point + */ + private void startFirstLocationRequest( MogoLatLng point ) { + mLastAutoRefreshLocation = point; + mLoopRequest = true; + notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + } + @Override public void onCarLocationChanged2( Location latLng ) { + if ( latLng == null ) { + return; + } + // poi 定位无法获取时,使用该定位 + if ( mLastAutoRefreshLocation == null ) { + MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() ); + startFirstLocationRequest( point ); + } } @Override @@ -715,17 +737,19 @@ public class MogoServices implements IMogoMapListener, break; case ACC_STATUS: if ( isTrue ) { - mADASController.showADAS(); - refreshStrategy(); - MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop(); - } else { - try { - MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); - MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + if ( mIsFirstAccOn ) { + mIsFirstAccOn = false; + return; } - refreshStrategy(); + mADASController.showADAS(); + MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start(); + MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); + UiThreadHandler.postDelayed( () -> { + refreshStrategy(); + }, 3_000L ); + } else { + MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop(); + MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); } break; } @@ -774,7 +798,12 @@ public class MogoServices implements IMogoMapListener, if ( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ) { delay = mRefreshRemainingTime; } - mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay ); + if ( time == 0 ) { + Logger.d( TAG, "立即刷新" ); + invokeAutoRefresh(); + } else { + mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay ); + } Logger.i( TAG, "下次刷新时间:%ss后", mRefreshRemainingTime ); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index 5a9def8162..fb950ef154 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -6,7 +6,6 @@ import android.content.Intent; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.receiver.AccStatusReceiver; -import com.mogo.module.service.receiver.MogoReceiver; import com.mogo.utils.logger.Logger; public @@ -18,16 +17,20 @@ public */ class AccStatusIntentHandler implements IntentHandler { + public static final byte ACC_ON = 1; + public static final byte ACC_OFF = 0; + private static final String TAG = "AccStatusIntentHandler"; private static volatile AccStatusIntentHandler sInstance; - private AccStatusIntentHandler(){} + private AccStatusIntentHandler() { + } - public static AccStatusIntentHandler getInstance(){ - if( sInstance == null ){ - synchronized( AccStatusIntentHandler.class ) { - if( sInstance == null ){ + public static AccStatusIntentHandler getInstance() { + if ( sInstance == null ) { + synchronized ( AccStatusIntentHandler.class ) { + if ( sInstance == null ) { sInstance = new AccStatusIntentHandler(); } } @@ -35,7 +38,7 @@ class AccStatusIntentHandler implements IntentHandler { return sInstance; } - public synchronized void release(){ + public synchronized void release() { sInstance = null; } @@ -49,9 +52,12 @@ class AccStatusIntentHandler implements IntentHandler { MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); Logger.d( TAG, "acc status: %s", false ); } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { - int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ( byte ) 0 ); - Logger.d( TAG, "acc status: %s", state == 1 ); - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == 1 ); + int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); + if ( state != ACC_OFF && state != ACC_ON ) { + return; + } + Logger.d( TAG, "acc status: %s", state == ACC_ON ); + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == ACC_ON ); } } } 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 43613ad77f..e3af1aa825 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 @@ -91,7 +91,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener, * @param context */ public void init( Context context ) { - mContext = context; + + if ( mContext != null ) { + return; + } + + mContext = context.getApplicationContext(); mRefreshModel = new RefreshModel( mContext ); // 长连接 From ed6cc20a9214e774609eaf0236bdeca5c8d65c61 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Sun, 2 Aug 2020 18:44:44 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E9=81=BF=E5=85=8Dacc=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=A2=AB=E5=8F=91=E4=B8=A4=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/service/intent/AccStatusIntentHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index fb950ef154..554d1ed5dd 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -56,8 +56,12 @@ class AccStatusIntentHandler implements IntentHandler { if ( state != ACC_OFF && state != ACC_ON ) { return; } - Logger.d( TAG, "acc status: %s", state == ACC_ON ); - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == ACC_ON ); + boolean accOn = state == ACC_ON; + if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) { + return; + } + Logger.d( TAG, "acc status: %s", accOn ); + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn ); } } } From 9169046175fa01fb3f8cb70437ab3f0c3683a3cd Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Sun, 2 Aug 2020 19:57:39 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=88=86=E4=BD=93?= =?UTF-8?q?=E6=9C=BAacc=E7=8A=B6=E6=80=81=E5=92=8C=E8=AF=BA=E7=BB=B4?= =?UTF-8?q?=E8=BE=BEaccDelay=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intent/AccStatusIntentHandler.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index 554d1ed5dd..5c7ed0e39b 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -3,9 +3,11 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; +import com.mogo.module.common.utils.CarSeries; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.receiver.AccStatusReceiver; +import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; public @@ -19,6 +21,7 @@ class AccStatusIntentHandler implements IntentHandler { public static final byte ACC_ON = 1; public static final byte ACC_OFF = 0; + public static final byte ACC_OFF_DELAY = 3; private static final String TAG = "AccStatusIntentHandler"; @@ -46,21 +49,26 @@ class AccStatusIntentHandler implements IntentHandler { public void handle( Context context, Intent intent ) { String action = intent.getAction(); if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) { - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true ); - Logger.d( TAG, "acc status: %s", true ); + if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) { + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true ); + Logger.d( TAG, "acc status: %s", true ); + } } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) { - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); - Logger.d( TAG, "acc status: %s", false ); + if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) { + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); + Logger.d( TAG, "acc status: %s", false ); + } } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); - if ( state != ACC_OFF && state != ACC_ON ) { + TipToast.shortTip( "收到acc状态变更:" + state ); + if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) { return; } boolean accOn = state == ACC_ON; if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) { return; } - Logger.d( TAG, "acc status: %s", accOn ); + Logger.d( TAG, "acc status: %s", state ); MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn ); } } From b7f33115bd3a16e14cfd9f42a923c348d6c21b7b Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Sun, 2 Aug 2020 20:06:30 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=90=90=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/module/service/intent/AccStatusIntentHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index 5c7ed0e39b..38a6de48b4 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -60,7 +60,6 @@ class AccStatusIntentHandler implements IntentHandler { } } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); - TipToast.shortTip( "收到acc状态变更:" + state ); if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) { return; } From aeb2f766dad55d65ebaaeec08c89e669f06a43ec Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Mon, 3 Aug 2020 09:51:53 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9acc=5Foff=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E5=BC=B9=E7=AA=97=E4=B8=8D=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extensions/entrance/EntranceFragment.java | 1 + .../extensions/utils/TopViewAnimHelper.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index e2d83eb720..4dcdc4feb7 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -443,6 +443,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent public void onDestroyView() { super.onDestroyView(); isClickShare = false; + TopViewAnimHelper.getInstance().removeAllView(); } @Override diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java index d669f9ecc3..0b6534ba26 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java @@ -682,4 +682,21 @@ public class TopViewAnimHelper { tvTurnInfo.setVisibility(visibility); } + + public void removeAllView(){ + Logger.d(TAG, "remove all view"); + isTopViewOut = true; + int lastCount = topContainer.getChildCount(); + for (int i = 0; i < lastCount; i++) { + View child = topContainer.getChildAt(i); + viewCaches.remove(child); + IMogoTopViewStatusListener listener = statusListenerMap.remove(child); + if (listener != null) { + listener.onViewRemoved(child); + } + } + topContainer.removeAllViews(); + hideNaviView(); + MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS); + } }