debug via vscode done

This commit is contained in:
王劲鹏 2019-11-13 17:06:00 +08:00
parent 6ba6995d10
commit 0b2d447e2a
2 changed files with 13 additions and 10 deletions

View File

@ -75,10 +75,8 @@ public class MainActivity extends AppCompatActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) { public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) {
((FrameLayout) findViewById(R.id.root)).removeAllViews();
DoricDriver.getInstance().changeJSEngine(false); DoricDriver.getInstance().changeJSEngine(false);
doricContext.init(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); doricContext.init(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
doricContext.getRootNode().setRootView((FrameLayout) findViewById(R.id.root));
} }
@Override @Override

View File

@ -211,7 +211,10 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
return mDoricRegistry; return mDoricRegistry;
} }
public void changeJSEngine(boolean isNative) { public void changeJSEngine(final boolean isNative) {
mJSHandler.post(new Runnable() {
@Override
public void run() {
mDoricJSE.teardown(); mDoricJSE.teardown();
if (isNative) { if (isNative) {
mDoricJSE = new DoricNativeJSExecutor(); mDoricJSE = new DoricNativeJSExecutor();
@ -220,4 +223,6 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
} }
injectGlobal(); injectGlobal();
} }
});
}
} }