spare DoricDev class for further usage
This commit is contained in:
parent
fa2171b3ff
commit
3134a0044b
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user