1. 独立app内存泄漏优化
This commit is contained in:
@@ -346,6 +346,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mMogoMapService.getHostListenerRegister().unregisterMarkerClickListener();
|
||||
mMogoStatusManager.setMainPageLaunchedStatus( TAG, false );
|
||||
mMogoMapService = null;
|
||||
mMogoMapUIController = null;
|
||||
@@ -359,5 +360,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mServiceApis.getOnlineCarPanelApi().clear();
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
SchemeIntent.getInstance().clear();
|
||||
FloatingViewHandler.clear();
|
||||
mServiceApis.getShareManager().releaseContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,16 +55,23 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private SchemeIntent() {
|
||||
// private constructor
|
||||
private static volatile SchemeIntent sInstance;
|
||||
|
||||
private SchemeIntent(){}
|
||||
|
||||
public static SchemeIntent getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( SchemeIntent.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new SchemeIntent();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final SchemeIntent INSTANCE = new SchemeIntent();
|
||||
}
|
||||
|
||||
public static SchemeIntent getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init( Context context, IMogoServiceApis apis ) {
|
||||
@@ -73,9 +80,11 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
mApis.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
public void clear(){
|
||||
mApis.getStatusManagerApi().unregisterStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
mContext = null;
|
||||
mApis = null;
|
||||
|
||||
}
|
||||
|
||||
public void handle( Intent intent ) {
|
||||
|
||||
@@ -41,6 +41,10 @@ public class FloatingViewHandler {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
sFloatingLayout = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加任意view到布局,不考虑优先级
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user