From 8e79ce3bad69659543c7040d3106eee298e39b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 27 Feb 2020 17:22:41 +0800 Subject: [PATCH] remove doric dev init --- .../java/pub/doric/demo/MyApplication.java | 2 -- .../main/java/pub/doric/devkit/DoricDev.java | 29 +++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/doric-android/app/src/main/java/pub/doric/demo/MyApplication.java b/doric-android/app/src/main/java/pub/doric/demo/MyApplication.java index 698c712c..225a1cda 100644 --- a/doric-android/app/src/main/java/pub/doric/demo/MyApplication.java +++ b/doric-android/app/src/main/java/pub/doric/demo/MyApplication.java @@ -19,7 +19,6 @@ import android.app.Application; import pub.doric.Doric; import pub.doric.DoricRegistry; -import pub.doric.devkit.DoricDev; public class MyApplication extends Application { @Override @@ -27,6 +26,5 @@ public class MyApplication extends Application { super.onCreate(); Doric.init(this); DoricRegistry.register(new DemoLibrary()); - DoricDev.getInstance().init(); } } diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java b/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java index 011e0a26..859c6e4d 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/DoricDev.java @@ -1,6 +1,5 @@ package pub.doric.devkit; -import android.app.Application; import android.widget.Toast; import com.lahm.library.EasyProtectorLib; @@ -28,20 +27,7 @@ public class DoricDev { private DoricDev() { EventBus.getDefault().register(this); - } - - 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() { + DevKit.isRunningInEmulator = EasyProtectorLib.checkIsRunningInEmulator(Doric.application(), new EmulatorCheckCallback() { @Override public void findEmulator(String 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) public void onOpenEvent(OpenEvent openEvent) { 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) public void onEOFEvent(EOFExceptionEvent eofExceptionEvent) { 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) public void onConnectExceptionEvent(ConnectExceptionEvent connectExceptionEvent) { 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)