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)
public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) {
((FrameLayout) findViewById(R.id.root)).removeAllViews();
DoricDriver.getInstance().changeJSEngine(false);
doricContext.init(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
doricContext.getRootNode().setRootView((FrameLayout) findViewById(R.id.root));
}
@Override

View File

@ -211,13 +211,18 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
return mDoricRegistry;
}
public void changeJSEngine(boolean isNative) {
mDoricJSE.teardown();
if (isNative) {
mDoricJSE = new DoricNativeJSExecutor();
} else {
mDoricJSE = new DoricRemoteJSExecutor();
}
injectGlobal();
public void changeJSEngine(final boolean isNative) {
mJSHandler.post(new Runnable() {
@Override
public void run() {
mDoricJSE.teardown();
if (isNative) {
mDoricJSE = new DoricNativeJSExecutor();
} else {
mDoricJSE = new DoricRemoteJSExecutor();
}
injectGlobal();
}
});
}
}