remove doric dev init

This commit is contained in:
王劲鹏 2020-02-27 17:22:41 +08:00 committed by osborn
parent a5f122b627
commit 8e79ce3bad
2 changed files with 11 additions and 20 deletions

View File

@ -19,7 +19,6 @@ import android.app.Application;
import pub.doric.Doric; import pub.doric.Doric;
import pub.doric.DoricRegistry; import pub.doric.DoricRegistry;
import pub.doric.devkit.DoricDev;
public class MyApplication extends Application { public class MyApplication extends Application {
@Override @Override
@ -27,6 +26,5 @@ public class MyApplication extends Application {
super.onCreate(); super.onCreate();
Doric.init(this); Doric.init(this);
DoricRegistry.register(new DemoLibrary()); DoricRegistry.register(new DemoLibrary());
DoricDev.getInstance().init();
} }
} }

View File

@ -1,6 +1,5 @@
package pub.doric.devkit; package pub.doric.devkit;
import android.app.Application;
import android.widget.Toast; import android.widget.Toast;
import com.lahm.library.EasyProtectorLib; import com.lahm.library.EasyProtectorLib;
@ -28,20 +27,7 @@ public class DoricDev {
private DoricDev() { private DoricDev() {
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
} DevKit.isRunningInEmulator = EasyProtectorLib.checkIsRunningInEmulator(Doric.application(), new EmulatorCheckCallback() {
public static DoricDev getInstance() {
return Inner.sInstance;
}
private Application application;
public boolean devKitConnected = false;
private DoricContextDebuggable doricContextDebuggable;
public void init() {
this.application = Doric.application();
DevKit.isRunningInEmulator = EasyProtectorLib.checkIsRunningInEmulator(application, new EmulatorCheckCallback() {
@Override @Override
public void findEmulator(String emulatorInfo) { public void findEmulator(String emulatorInfo) {
System.out.println(emulatorInfo); System.out.println(emulatorInfo);
@ -49,22 +35,29 @@ public class DoricDev {
}); });
} }
public static DoricDev getInstance() {
return Inner.sInstance;
}
public boolean devKitConnected = false;
private DoricContextDebuggable doricContextDebuggable;
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenEvent(OpenEvent openEvent) { public void onOpenEvent(OpenEvent openEvent) {
devKitConnected = true; devKitConnected = true;
Toast.makeText(application, "dev kit connected", Toast.LENGTH_LONG).show(); Toast.makeText(Doric.application(), "dev kit connected", Toast.LENGTH_LONG).show();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEOFEvent(EOFExceptionEvent eofExceptionEvent) { public void onEOFEvent(EOFExceptionEvent eofExceptionEvent) {
devKitConnected = false; devKitConnected = false;
Toast.makeText(application, "dev kit eof exception", Toast.LENGTH_LONG).show(); Toast.makeText(Doric.application(), "dev kit eof exception", Toast.LENGTH_LONG).show();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onConnectExceptionEvent(ConnectExceptionEvent connectExceptionEvent) { public void onConnectExceptionEvent(ConnectExceptionEvent connectExceptionEvent) {
devKitConnected = false; devKitConnected = false;
Toast.makeText(application, "dev kit connection exception", Toast.LENGTH_LONG).show(); Toast.makeText(Doric.application(), "dev kit connection exception", Toast.LENGTH_LONG).show();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)