Merge branch 'dev' into dev_1.1.2
# Conflicts: # app/functions/eventpanel.gradle
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -4,9 +4,11 @@ import android.content.Context;
|
||||
|
||||
import com.amap.api.services.core.AMapException;
|
||||
import com.amap.api.services.geocoder.GeocodeAddress;
|
||||
import com.amap.api.services.geocoder.GeocodeQuery;
|
||||
import com.amap.api.services.geocoder.GeocodeResult;
|
||||
import com.amap.api.services.geocoder.GeocodeSearch;
|
||||
import com.amap.api.services.geocoder.RegeocodeAddress;
|
||||
import com.amap.api.services.geocoder.RegeocodeQuery;
|
||||
import com.amap.api.services.geocoder.RegeocodeResult;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
@@ -16,6 +18,7 @@ import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -28,6 +31,8 @@ import java.util.List;
|
||||
*/
|
||||
public class GeocodeSearchClient implements IMogoGeoSearch, GeocodeSearch.OnGeocodeSearchListener {
|
||||
|
||||
private static final String TAG = "GeocodeSearchClient";
|
||||
|
||||
private GeocodeSearch mClient;
|
||||
private IMogoGeoSearchListener mListener;
|
||||
|
||||
@@ -74,14 +79,32 @@ public class GeocodeSearchClient implements IMogoGeoSearch, GeocodeSearch.OnGeoc
|
||||
@Override
|
||||
public void getFromLocationAsyn( MogoRegeocodeQuery query ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.getFromLocationAsyn( ObjectUtils.fromMogo( query ) );
|
||||
if ( query == null ) {
|
||||
Logger.e( TAG, "query parameter is null." );
|
||||
return;
|
||||
}
|
||||
RegeocodeQuery origin = ObjectUtils.fromMogo( query );
|
||||
if ( origin == null || !query.check() ) {
|
||||
Logger.e( TAG, "query parameter is null or no point parameter." );
|
||||
return;
|
||||
}
|
||||
mClient.getFromLocationAsyn( origin );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFromLocationNameAsyn( MogoGeocodeQuery query ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.getFromLocationNameAsyn( ObjectUtils.fromMogo( query ) );
|
||||
if ( query == null ) {
|
||||
Logger.e( TAG, "query parameter is null." );
|
||||
return;
|
||||
}
|
||||
GeocodeQuery origin = ObjectUtils.fromMogo( query );
|
||||
if ( origin == null || !query.check() ) {
|
||||
Logger.e( TAG, "query parameter is null or locationName is empty." );
|
||||
return;
|
||||
}
|
||||
mClient.getFromLocationNameAsyn( origin );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.search.geo.query;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -29,6 +30,12 @@ public class MogoGeocodeQuery implements Parcelable {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public boolean check(){
|
||||
if ( TextUtils.isEmpty( locationName ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
@@ -50,6 +50,18 @@ public class MogoRegeocodeQuery implements Parcelable {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public boolean check() {
|
||||
if ( point == null ) {
|
||||
return false;
|
||||
}
|
||||
if ( point.lat < 1 && point.lon < 1 ) {
|
||||
return false;
|
||||
}
|
||||
if ( radius < 0 ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.view.OnAiAssistClickListener;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
|
||||
@@ -33,7 +34,9 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavigatorPresenter > implements AppNavigatorView {
|
||||
public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavigatorPresenter >
|
||||
implements AppNavigatorView,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
private static final String TAG = "AppNavigatorFragment";
|
||||
|
||||
@@ -74,14 +77,17 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mAIAssist.performClick();
|
||||
} );
|
||||
|
||||
AppServiceHandler.getApis().getFragmentManagerApi().addMainFragmentStackTransactionListener( size -> {
|
||||
// 主页 fragment 栈变化的时候,改变动画状态
|
||||
if ( size == 0 ) {
|
||||
mAnim.start();
|
||||
} else {
|
||||
mAnim.stop();
|
||||
}
|
||||
} );
|
||||
AppServiceHandler.getApis().getFragmentManagerApi().addMainFragmentStackTransactionListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
// 主页 fragment 栈变化的时候,改变动画状态
|
||||
if ( size == 0 ) {
|
||||
mAnim.start();
|
||||
} else {
|
||||
mAnim.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,5 +157,6 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
if ( mPresenter != null ) {
|
||||
mPresenter.onDestroy( getViewLifecycleOwner() );
|
||||
}
|
||||
AppServiceHandler.getApis().getFragmentManagerApi().removeMainFragmentStackTransactionListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
AppServiceHandler.getApis().getRegisterCenterApi().unregisterMogoNaviListener( TAG );
|
||||
AppServiceHandler.getApis().getIntentManagerApi().unregisterIntentListener( AppsConst.COMMAND_OPERATION, this );
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
private IMogoServiceApis mApis;
|
||||
|
||||
private IMogoCardManager mCardManager;
|
||||
private IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
@@ -71,7 +70,6 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
} );
|
||||
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -44,6 +45,7 @@ import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -72,7 +74,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoStatusChangedListener {
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -192,7 +195,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
MapCenterPointStrategy.restoreLastScene( mMApUIController );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
});
|
||||
@@ -241,23 +243,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
});
|
||||
|
||||
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 ) );
|
||||
|
||||
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
|
||||
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(),
|
||||
@@ -355,6 +346,22 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
TopViewAnimHelper.getInstance().removeAllView();
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
if (naviinfo == null) {
|
||||
@@ -374,7 +381,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
TopViewAnimHelper.getInstance().showNaviView();
|
||||
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
|
||||
EnumMapUI.CarUp_2D);
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500, () -> {
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
|
||||
, () -> {
|
||||
return !mMogoNavi.isNaviing();
|
||||
});
|
||||
if (CustomNaviInterrupter.getInstance().interrupt()) {
|
||||
@@ -575,4 +583,23 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
|
||||
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mMogoRegisterCenter != null ) {
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoAimlessModeListener(TAG);
|
||||
}
|
||||
if ( mStatusManager != null ) {
|
||||
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
|
||||
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
|
||||
}
|
||||
if ( mApis != null ) {
|
||||
if ( mApis.getIntentManagerApi() != null ) {
|
||||
mApis.getIntentManagerApi().unregisterIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +311,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapUIController = null;
|
||||
mMogoFragmentManager = null;
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d( TAG, "destroy." );
|
||||
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
|
||||
@@ -2,58 +2,24 @@ 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
|
||||
* @since 2020-01-03
|
||||
@@ -128,6 +94,8 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
MarkerServiceHandler.init( context );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
}, 5_000L );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -63,6 +64,8 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
@@ -273,12 +276,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();
|
||||
@@ -366,6 +370,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 );
|
||||
@@ -619,9 +624,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 );
|
||||
@@ -635,8 +638,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
|
||||
@@ -717,18 +739,20 @@ public class MogoServices implements IMogoMapListener,
|
||||
break;
|
||||
case ACC_STATUS:
|
||||
if ( isTrue ) {
|
||||
if ( mIsFirstAccOn ) {
|
||||
mIsFirstAccOn = false;
|
||||
return;
|
||||
}
|
||||
initLocationServiceProcess( mContext );
|
||||
mADASController.showADAS();
|
||||
refreshStrategy();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
refreshStrategy();
|
||||
}, 3_000L );
|
||||
} else {
|
||||
try {
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
refreshStrategy();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,10 +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.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
@@ -18,16 +19,21 @@ public
|
||||
*/
|
||||
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";
|
||||
|
||||
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 +41,7 @@ class AccStatusIntentHandler implements IntentHandler {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -43,15 +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, ( 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 && state != ACC_OFF_DELAY ) {
|
||||
return;
|
||||
}
|
||||
boolean accOn = state == ACC_ON;
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "acc status: %s", state );
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
private Rect mMarkerDisplayBounds;
|
||||
|
||||
private MapMarkerManager() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
public static synchronized MapMarkerManager getInstance() {
|
||||
@@ -96,6 +95,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param context
|
||||
*/
|
||||
public void init( Context context ) {
|
||||
|
||||
if ( mContext != null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "初始化" );
|
||||
|
||||
mContext = context.getApplicationContext();
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
|
||||
// 长连接
|
||||
|
||||
@@ -7,14 +7,14 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.module.v2x.scenario.IV2XScenario;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XButton;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
|
||||
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
|
||||
eventEntity.setExpireTime(30000);
|
||||
eventEntity.setTts("发现其他车主的求助信息");
|
||||
eventEntity.setAlarmContent("其他车主求助");
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user