remove demo activity; debugger adjustment
This commit is contained in:
parent
328c232b8b
commit
c7db3405f7
@ -21,15 +21,6 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".DemoActivity"
|
|
||||||
android:theme="@style/Theme.Design.Light.NoActionBar">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2019] [Doric.Pub]
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package pub.doric.demo;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
|
||||||
import pub.doric.DoricPanel;
|
|
||||||
import pub.doric.utils.DoricUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: pub.doric.demo
|
|
||||||
* @Author: pengfei.zhou
|
|
||||||
* @CreateDate: 2019-11-19
|
|
||||||
*/
|
|
||||||
public class DemoActivity extends AppCompatActivity {
|
|
||||||
private DoricContext doricContext;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
String source = getIntent().getStringExtra("source");
|
|
||||||
DoricPanel doricPanel = new DoricPanel(this);
|
|
||||||
addContentView(doricPanel, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
|
||||||
doricPanel.config(DoricUtils.readAssetFile("demo/" + source), source, "");
|
|
||||||
doricContext = doricPanel.getDoricContext();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,15 @@
|
|||||||
package pub.doric.devkit;
|
package pub.doric.devkit;
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
|
import pub.doric.DoricContextManager;
|
||||||
import pub.doric.DoricNativeDriver;
|
import pub.doric.DoricNativeDriver;
|
||||||
|
|
||||||
public class DoricContextDebuggable {
|
public class DoricContextDebuggable {
|
||||||
private DoricContext doricContext;
|
private DoricContext doricContext;
|
||||||
private DoricDebugDriver doricDebugDriver;
|
private DoricDebugDriver doricDebugDriver;
|
||||||
|
|
||||||
public DoricContextDebuggable(DoricContext doricContext) {
|
public DoricContextDebuggable(String contextId) {
|
||||||
this.doricContext = doricContext;
|
this.doricContext = DoricContextManager.getContext(contextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDebug() {
|
public void startDebug() {
|
||||||
|
@ -79,7 +79,8 @@ public class WSClient extends WebSocketListener {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "SWITCH_TO_DEBUG": {
|
case "SWITCH_TO_DEBUG": {
|
||||||
EventBus.getDefault().post(new EnterDebugEvent());
|
String contextId = jsonObject.optString("contextId");
|
||||||
|
EventBus.getDefault().post(new EnterDebugEvent(contextId));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
package pub.doric.devkit.event;
|
package pub.doric.devkit.event;
|
||||||
|
|
||||||
public class EnterDebugEvent {
|
public class EnterDebugEvent {
|
||||||
|
|
||||||
|
private String contextId;
|
||||||
|
|
||||||
|
public EnterDebugEvent(String contextId) {
|
||||||
|
this.contextId = contextId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContextId() {
|
||||||
|
return contextId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,46 +17,35 @@ package pub.doric.devkit.ui;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import pub.doric.DoricActivity;
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
import pub.doric.DoricContextManager;
|
import pub.doric.DoricContextManager;
|
||||||
import pub.doric.DoricPanel;
|
|
||||||
import pub.doric.devkit.DoricContextDebuggable;
|
import pub.doric.devkit.DoricContextDebuggable;
|
||||||
import pub.doric.devkit.event.EnterDebugEvent;
|
import pub.doric.devkit.event.EnterDebugEvent;
|
||||||
import pub.doric.devkit.event.QuitDebugEvent;
|
import pub.doric.devkit.event.QuitDebugEvent;
|
||||||
import pub.doric.devkit.event.ReloadEvent;
|
import pub.doric.devkit.event.ReloadEvent;
|
||||||
import pub.doric.devkit.util.SensorManagerHelper;
|
import pub.doric.devkit.util.SensorManagerHelper;
|
||||||
import pub.doric.utils.DoricUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: pub.doric.demo
|
* @Description: pub.doric.demo
|
||||||
* @Author: pengfei.zhou
|
* @Author: pengfei.zhou
|
||||||
* @CreateDate: 2019-11-19
|
* @CreateDate: 2019-11-19
|
||||||
*/
|
*/
|
||||||
public class DemoDebugActivity extends AppCompatActivity {
|
public class DemoDebugActivity extends DoricActivity {
|
||||||
private DoricContext doricContext;
|
|
||||||
private SensorManagerHelper sensorHelper;
|
private SensorManagerHelper sensorHelper;
|
||||||
private DoricContextDebuggable doricContextDebuggable;
|
private DoricContextDebuggable doricContextDebuggable;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
String source = getIntent().getStringExtra("source");
|
|
||||||
DoricPanel doricPanel = new DoricPanel(this);
|
|
||||||
addContentView(doricPanel, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
|
||||||
doricPanel.config(DoricUtils.readAssetFile("demo/" + source), source);
|
|
||||||
doricContext = doricPanel.getDoricContext();
|
|
||||||
doricContextDebuggable = new DoricContextDebuggable(doricContext);
|
|
||||||
sensorHelper = new SensorManagerHelper(this);
|
sensorHelper = new SensorManagerHelper(this);
|
||||||
sensorHelper.setOnShakeListener(new SensorManagerHelper.OnShakeListener() {
|
sensorHelper.setOnShakeListener(new SensorManagerHelper.OnShakeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -73,19 +62,24 @@ public class DemoDebugActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
sensorHelper.stop();
|
sensorHelper.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) {
|
public void onEnterDebugEvent(EnterDebugEvent enterDebugEvent) {
|
||||||
|
doricContextDebuggable = new DoricContextDebuggable(enterDebugEvent.getContextId());
|
||||||
doricContextDebuggable.startDebug();
|
doricContextDebuggable.startDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user