feat:In Android,after context finished,the popovered view must be removed
This commit is contained in:
@@ -26,6 +26,7 @@ import org.json.JSONObject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import pub.doric.async.AsyncResult;
|
||||
import pub.doric.navbar.IDoricNavBar;
|
||||
@@ -35,6 +36,7 @@ import pub.doric.shader.RootNode;
|
||||
import pub.doric.shader.ViewNode;
|
||||
import pub.doric.utils.DoricConstant;
|
||||
import pub.doric.utils.DoricMetaInfo;
|
||||
import pub.doric.utils.ThreadMode;
|
||||
|
||||
/**
|
||||
* @Description: Doric
|
||||
@@ -151,7 +153,16 @@ public class DoricContext {
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
mPluginMap.clear();
|
||||
getDriver().asyncCall(new Callable<Object>() {
|
||||
@Override
|
||||
public Object call() {
|
||||
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
|
||||
javaPlugin.onTearDown();
|
||||
}
|
||||
mPluginMap.clear();
|
||||
return null;
|
||||
}
|
||||
}, ThreadMode.UI);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -166,6 +177,10 @@ public class DoricContext {
|
||||
}
|
||||
|
||||
public void reload(String script) {
|
||||
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
|
||||
javaPlugin.onTearDown();
|
||||
}
|
||||
mPluginMap.clear();
|
||||
this.script = script;
|
||||
this.mRootNode.setId("");
|
||||
getDriver().createContext(mContextId, script, source);
|
||||
|
@@ -27,4 +27,8 @@ public abstract class DoricJavaPlugin extends DoricContextHolder {
|
||||
public DoricJavaPlugin(DoricContext doricContext) {
|
||||
super(doricContext);
|
||||
}
|
||||
|
||||
public void onTearDown() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package pub.doric.plugin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -14,7 +12,6 @@ import com.github.pengfeizhou.jscore.JavaValue;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import pub.doric.DoricContext;
|
||||
import pub.doric.async.AsyncCall;
|
||||
import pub.doric.async.AsyncResult;
|
||||
import pub.doric.extension.bridge.DoricMethod;
|
||||
import pub.doric.extension.bridge.DoricPlugin;
|
||||
@@ -48,7 +45,6 @@ public class PopoverPlugin extends DoricJavaPlugin {
|
||||
decorView.addView(mFullScreenView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
mFullScreenView.setVisibility(View.VISIBLE);
|
||||
mFullScreenView.bringToFront();
|
||||
String viewId = jsObject.getProperty("id").asString().value();
|
||||
String type = jsObject.getProperty("type").asString().value();
|
||||
@@ -127,7 +123,9 @@ public class PopoverPlugin extends DoricJavaPlugin {
|
||||
getDoricContext().removeHeadNode(node);
|
||||
mFullScreenView.removeView(node.getNodeView());
|
||||
if (getDoricContext().allHeadNodes().isEmpty()) {
|
||||
mFullScreenView.setVisibility(View.GONE);
|
||||
ViewGroup decorView = (ViewGroup) getDoricContext().getRootNode().getNodeView().getRootView();
|
||||
decorView.removeView(mFullScreenView);
|
||||
mFullScreenView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,4 +134,10 @@ public class PopoverPlugin extends DoricJavaPlugin {
|
||||
dismissViewNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTearDown() {
|
||||
super.onTearDown();
|
||||
this.dismissPopover();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user