1. 解决app列表内存泄漏问题
2. 独立APP在onPause时不关闭adas算法 3. 解决npe问题
This commit is contained in:
@@ -160,7 +160,7 @@ targetSdkVersion : 22,
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.1",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.0.9",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.4",
|
||||
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
|
||||
@@ -185,6 +185,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
aMap.setOnCameraChangeListener( this );
|
||||
aMap.setOnMyLocationChangeListener( this );
|
||||
}
|
||||
AMapMessageManager.getInstance().clear();
|
||||
AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
AMap.OnCameraChangeListener,
|
||||
AMap.OnMyLocationChangeListener {
|
||||
|
||||
private static boolean sIsCreated = false;
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
|
||||
private final MapView mMapView;
|
||||
@@ -200,6 +202,13 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
if ( sIsCreated ) {
|
||||
initMapView();
|
||||
initListeners();
|
||||
initMyLocation();
|
||||
return;
|
||||
}
|
||||
sIsCreated = true;
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
@@ -227,6 +236,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
sIsCreated = false;
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
@@ -362,6 +372,8 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 60 ) );
|
||||
break;
|
||||
case NorthUP_2D:
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 0 ) );
|
||||
break;
|
||||
case CarUp_2D:
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 0 ) );
|
||||
break;
|
||||
|
||||
@@ -47,6 +47,12 @@ public class AMapMessageManager {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void clear(){
|
||||
if ( mListeners != null ) {
|
||||
mListeners.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void unregisterAMapMessageListener( AMapMessageListener listener ) {
|
||||
mListeners.remove( listener );
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MainIndependentActivity extends MainActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( false );
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,21 +14,24 @@ public class AppsListChangedLiveData extends MutableLiveData {
|
||||
|
||||
private Observer mObserver;
|
||||
|
||||
private AppsListChangedLiveData(){
|
||||
// private constructor
|
||||
}
|
||||
private static volatile AppsListChangedLiveData sInstance;
|
||||
|
||||
private static final class InstanceHolder{
|
||||
private static final AppsListChangedLiveData INSTANCE = new AppsListChangedLiveData();
|
||||
}
|
||||
private AppsListChangedLiveData(){}
|
||||
|
||||
public static AppsListChangedLiveData getInstance(){
|
||||
return InstanceHolder.INSTANCE;
|
||||
if( sInstance == null ){
|
||||
synchronized( AppsListChangedLiveData.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new AppsListChangedLiveData();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Object readResolve(){
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,7 +40,9 @@ public class AppsListChangedLiveData extends MutableLiveData {
|
||||
mObserver = observer;
|
||||
}
|
||||
|
||||
public void release(){
|
||||
public synchronized void release(){
|
||||
removeObserver( mObserver );
|
||||
mObserver = null;
|
||||
sInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,12 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
` mAnalytics = null;
|
||||
mCardManager = null;
|
||||
if ( mLauncher != null ) {
|
||||
mLauncher.destroy();
|
||||
}
|
||||
mLauncher = null;
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
|
||||
@@ -103,6 +103,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
public void destroy() {
|
||||
if ( getNext() != null ) {
|
||||
getNext().destroy();
|
||||
setNext( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class AppsModel {
|
||||
private Map< Integer, List< AppInfo > > mPagedApps = new HashMap<>();
|
||||
|
||||
private AppsModel( Context context ) {
|
||||
mContext = context;
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
public static AppsModel getInstance( Context context ) {
|
||||
|
||||
@@ -703,7 +703,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} );
|
||||
}
|
||||
|
||||
public void onSyncMarkerResponse(MarkerResponse response){
|
||||
public void onSyncMarkerResponse( MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
return;
|
||||
}
|
||||
@@ -862,6 +862,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 平滑移动
|
||||
private void startSmooth( IMogoMarker iMogoMarker, MarkerOnlineCar markerOnlineCar,
|
||||
MarkerLocation markerLocation ) {
|
||||
if ( iMogoMarker == null ) {
|
||||
return;
|
||||
}
|
||||
List< MarkerCarPois > poiList = markerOnlineCar.getPois();
|
||||
if ( filterErrorPoint( poiList ) ) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user