解决内存泄漏2
# Conflicts: # modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
This commit is contained in:
@@ -45,7 +45,7 @@ public class AMapWrapper implements IMogoMap {
|
||||
public AMapWrapper( AMap map, Context context, IMogoMapUIController controller ) {
|
||||
this.mAMap = map;
|
||||
sAMap = map;
|
||||
mContext = context;
|
||||
mContext = context.getApplicationContext();
|
||||
mUIcontroller = controller;
|
||||
// 设置实现自定义 info window
|
||||
if(mAMap!=null) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
|
||||
switch ( product ) {
|
||||
case "f80x":
|
||||
case "f8xx":
|
||||
case "f8Amap":
|
||||
BackToMainHomeManager.addMainHomeView();
|
||||
break;
|
||||
case "changanauto":
|
||||
|
||||
@@ -28,13 +28,11 @@ import com.mogo.service.module.ModuleType;
|
||||
@Route( path = MogoModulePaths.PATH_ENTRANCE )
|
||||
public class EntranceProvider implements IMogoModuleProvider {
|
||||
|
||||
EntranceFragment mFragment;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
mFragment = new EntranceFragment();
|
||||
EntranceFragment mFragment = new EntranceFragment();
|
||||
mFragment.setArguments( data );
|
||||
ExtensionServiceManager.init(context);
|
||||
ExtensionServiceManager.init( context );
|
||||
return mFragment;
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ public class EntranceProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
ExtensionServiceManager.init(context);
|
||||
ExtensionServiceManager.init( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -474,6 +474,7 @@ public class TopViewAnimHelper {
|
||||
topContainer = null;
|
||||
cameraMode = null;
|
||||
animNavInfoView = null;
|
||||
vrModeNavInfoView = null;
|
||||
}
|
||||
|
||||
public void enterVrMode() {
|
||||
|
||||
@@ -3,14 +3,11 @@ package com.mogo.module.main;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.LayoutInflaterCompat;
|
||||
|
||||
import com.mogo.commons.context.ContextHolderUtil;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -18,8 +15,6 @@ import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
@@ -30,12 +25,12 @@ import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.log.LoggerController;
|
||||
@@ -43,9 +38,6 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -54,8 +46,8 @@ import androidx.annotation.Nullable;
|
||||
*/
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
IMogoADASControlStatusChangedListener,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
protected static final String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
@@ -139,10 +131,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
ContextHolderUtil.holdContext(this);
|
||||
ContextHolderUtil.holdContext( this );
|
||||
mPresenter.postLoadModuleMsg();
|
||||
|
||||
NetworkUtils.listenNetStrength(this);
|
||||
NetworkUtils.listenNetStrength( this );
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -170,7 +162,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() );
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener( EventDispatchCenter.getInstance() );
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener( EventDispatchCenter.getInstance() );
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener( this );
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener( EventDispatchCenter.getInstance() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,14 +186,16 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
mMogoFragmentManager.initMessageHistoryContainerId( R.id.module_main_id_message_history_fragment_container );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
showLayout();
|
||||
} else if ( size == 1 ) {
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
if ( size == 0 ) {
|
||||
showLayout();
|
||||
} else if ( size == 1 ) {
|
||||
hideLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetMapUiStyle(){
|
||||
@@ -272,12 +266,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
EventDispatchCenter.getInstance().onLocationChanged( location );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
EventDispatchCenter.getInstance().onMarkerClicked( marker );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
switch ( mapUI ) {
|
||||
|
||||
@@ -271,6 +271,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
mediator?.detach()
|
||||
// 避免内存泄漏
|
||||
fragment = null
|
||||
mClPanelContainer = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class V2XScenarioHistoryFragment
|
||||
private RecyclerView mRecyclerView;
|
||||
private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter;
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData = new ArrayList<>();
|
||||
private IMoGoV2XStatusChangedListener mListener;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -88,24 +89,25 @@ public class V2XScenarioHistoryFragment
|
||||
});
|
||||
|
||||
|
||||
mListener = new IMoGoV2XStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged( V2XStatusDescriptor descriptor, boolean isTrue ) {
|
||||
Logger.d( TAG, descriptor + " initViews --------> " + isTrue );
|
||||
if ( descriptor == V2XStatusDescriptor.EventPanelWindow_UI ) {
|
||||
mPresenter.loadHistory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init --------> " );
|
||||
}
|
||||
};
|
||||
V2XServiceManager.getMoGoV2XStatusManager()
|
||||
.registerStatusChangedListener(
|
||||
TAG,
|
||||
V2XStatusDescriptor.EventPanelWindow_UI,
|
||||
new IMoGoV2XStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue) {
|
||||
Logger.d(TAG, descriptor + " initViews --------> " + isTrue);
|
||||
if (descriptor == V2XStatusDescriptor.EventPanelWindow_UI) {
|
||||
mPresenter.loadHistory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "init --------> ");
|
||||
}
|
||||
});
|
||||
mListener );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,4 +182,13 @@ public class V2XScenarioHistoryFragment
|
||||
protected ScenarioHistoryPresenter createPresenter() {
|
||||
return new ScenarioHistoryPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
V2XServiceManager.getMoGoV2XStatusManager().unregisterStatusChangedListener( TAG,
|
||||
V2XStatusDescriptor.EventPanelWindow_UI,
|
||||
mListener
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user