1. 车聊聊电话和音乐浮窗的互斥
2. 添加模块资源释放回调
This commit is contained in:
@@ -357,5 +357,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
AIAssist.getInstance( this ).release();
|
||||
mServiceApis.getOnlineCarPanelApi().clear();
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,9 @@ public interface MogoModulesHandler {
|
||||
* @param containerId
|
||||
*/
|
||||
void loadSplashModule(int containerId);
|
||||
|
||||
/**
|
||||
* 释放各个模块资源
|
||||
*/
|
||||
void onDestroy();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.idst.nls.internal.utils.L;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
@@ -16,6 +17,7 @@ import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -131,25 +133,25 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadEventPanelModule(int containerId) {
|
||||
public void loadEventPanelModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_EVENT_PANEL)
|
||||
.build( MogoServicePaths.PATH_EVENT_PANEL )
|
||||
.navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadLeftPanelModule(int containerId) {
|
||||
public void loadLeftPanelModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_LEFT_PANEL)
|
||||
.build( MogoServicePaths.PATH_LEFT_PANEL )
|
||||
.navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSplashModule(int containerId) {
|
||||
public void loadSplashModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SPLASH)
|
||||
.build( MogoServicePaths.PATH_SPLASH )
|
||||
.navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
@@ -188,4 +190,25 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
.replace( containerId, fragment, provider.getModuleName() )
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mModuleNameProviders != null ) {
|
||||
Collection< IMogoModuleProvider > modules = mModuleNameProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMogoModuleProvider module : modules ) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getModuleName() );
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameProviders.clear();
|
||||
}
|
||||
if ( mModuleProviders != null ) {
|
||||
mModuleProviders.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user