解决内存泄漏2
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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -25,6 +25,7 @@ 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;
|
||||
@@ -45,7 +46,8 @@ import java.util.List;
|
||||
*/
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
IMogoADASControlStatusChangedListener,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
protected static final String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
@@ -184,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(){
|
||||
|
||||
@@ -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