mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Tweak PluginManager.setPluginEntries()
to create startup plugins when called post init()
This commit is contained in:
parent
e1828696f7
commit
f764448ccc
@ -44,6 +44,7 @@ public class PluginManager {
|
|||||||
|
|
||||||
private final CordovaInterface ctx;
|
private final CordovaInterface ctx;
|
||||||
private final CordovaWebView app;
|
private final CordovaWebView app;
|
||||||
|
private boolean isInitialized;
|
||||||
|
|
||||||
public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection<PluginEntry> pluginEntries) {
|
public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection<PluginEntry> pluginEntries) {
|
||||||
this.ctx = cordova;
|
this.ctx = cordova;
|
||||||
@ -56,13 +57,18 @@ public class PluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPluginEntries(Collection<PluginEntry> pluginEntries) {
|
public void setPluginEntries(Collection<PluginEntry> pluginEntries) {
|
||||||
|
if (isInitialized) {
|
||||||
this.onPause(false);
|
this.onPause(false);
|
||||||
this.onDestroy();
|
this.onDestroy();
|
||||||
pluginMap.clear();
|
pluginMap.clear();
|
||||||
entryMap.clear();
|
entryMap.clear();
|
||||||
|
}
|
||||||
for (PluginEntry entry : pluginEntries) {
|
for (PluginEntry entry : pluginEntries) {
|
||||||
addService(entry);
|
addService(entry);
|
||||||
}
|
}
|
||||||
|
if (isInitialized) {
|
||||||
|
startupPlugins();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,6 +76,7 @@ public class PluginManager {
|
|||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
LOG.d(TAG, "init()");
|
LOG.d(TAG, "init()");
|
||||||
|
isInitialized = true;
|
||||||
this.onPause(false);
|
this.onPause(false);
|
||||||
this.onDestroy();
|
this.onDestroy();
|
||||||
pluginMap.clear();
|
pluginMap.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user