From 3134a0044b4696982d627ebe68afbd8df56cd103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Mon, 24 Feb 2020 17:39:20 +0800 Subject: [PATCH] spare DoricDev class for further usage --- .../src/main/java/pub/doric/devkit/DoricDev.java | 12 ------------ .../java/pub/doric/devkit/ui/DebugContextPanel.java | 4 ++-- .../src/main/java/pub/doric/devkit/ui/DevPanel.java | 3 +-- .../java/pub/doric/devkit/ui/ScanQRCodeActivity.java | 3 +-- 4 files changed, 4 insertions(+), 18 deletions(-) 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 d122da11..d0c90775 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,17 +1,5 @@ package pub.doric.devkit; -import com.google.gson.JsonObject; - public class DoricDev { - public static void connectDevKit(String url) { - DevKit.getInstance().connectDevKit(url); - } - public static void sendDevCommand(IDevKit.Command command, JsonObject jsonObject) { - DevKit.getInstance().sendDevCommand(command, jsonObject); - } - - public static void disconnectDevKit() { - DevKit.getInstance().disconnectDevKit(); - } } diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DebugContextPanel.java b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DebugContextPanel.java index eec9e225..de6f2a27 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DebugContextPanel.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DebugContextPanel.java @@ -19,7 +19,7 @@ import org.greenrobot.eventbus.EventBus; import pub.doric.DoricContext; import pub.doric.DoricContextManager; -import pub.doric.devkit.DoricDev; +import pub.doric.devkit.DevKit; import pub.doric.devkit.IDevKit; import pub.doric.devkit.R; import pub.doric.devkit.event.StartDebugEvent; @@ -75,7 +75,7 @@ public class DebugContextPanel extends DialogFragment { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("contextId", doricContext.getContextId()); jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts")); - DoricDev.sendDevCommand(IDevKit.Command.DEBUG, jsonObject); + DevKit.getInstance().sendDevCommand(IDevKit.Command.DEBUG, jsonObject); dismissAllowingStateLoss(); } }); diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DevPanel.java b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DevPanel.java index 5c3c925f..17242276 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DevPanel.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/DevPanel.java @@ -24,7 +24,6 @@ import org.greenrobot.eventbus.ThreadMode; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import pub.doric.devkit.DevKit; -import pub.doric.devkit.DoricDev; import pub.doric.devkit.R; import pub.doric.devkit.event.ConnectExceptionEvent; import pub.doric.devkit.event.EOFExceptionEvent; @@ -58,7 +57,7 @@ public class DevPanel extends BottomSheetDialogFragment { public void onClick(View v) { if (DevKit.isRunningInEmulator) { DevKit.ip = "10.0.2.2"; - DoricDev.connectDevKit("ws://" + DevKit.ip + ":7777"); + DevKit.getInstance().connectDevKit("ws://" + DevKit.ip + ":7777"); } else { final RxPermissions rxPermissions = new RxPermissions(DevPanel.this); Disposable disposable = rxPermissions diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java index 21547411..c0a5d8e4 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java @@ -9,7 +9,6 @@ import androidx.appcompat.app.AppCompatActivity; import cn.bingoogolapple.qrcode.core.QRCodeView; import cn.bingoogolapple.qrcode.zbar.ZBarView; import pub.doric.devkit.DevKit; -import pub.doric.devkit.DoricDev; import pub.doric.devkit.R; public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView.Delegate { @@ -52,7 +51,7 @@ public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView. setTitle("扫描结果为:" + result); DevKit.ip = result; Toast.makeText(this, "dev kit connecting to " + result, Toast.LENGTH_LONG).show(); - DoricDev.connectDevKit("ws://" + result + ":7777"); + DevKit.getInstance().connectDevKit("ws://" + result + ":7777"); finish(); }