Dying...
This commit is contained in:
@@ -154,11 +154,7 @@ public class HoverMenuService extends Service {
|
||||
}
|
||||
|
||||
private void captureCurrentWindow() {
|
||||
NodeInfo nodeInfo = AutoJs.getInstance().getLayoutInspector().captureCurrentWindow();
|
||||
if (nodeInfo == null)
|
||||
return;
|
||||
mFloatingLayoutHierarchyView.setRootNode(nodeInfo);
|
||||
mFloatingLayoutBoundsView.setRootNode(nodeInfo);
|
||||
AutoJs.getInstance().getLayoutInspector().captureCurrentWindow();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -216,11 +212,13 @@ public class HoverMenuService extends Service {
|
||||
}
|
||||
|
||||
private void showLayoutBounds() {
|
||||
mFloatingLayoutBoundsView.setRootNode(AutoJs.getInstance().getLayoutInspector().getCapture());
|
||||
mWindowHoverMenu.getHoverMenuView().setVisibility(View.GONE);
|
||||
showView(mFloatingLayoutBoundsView);
|
||||
}
|
||||
|
||||
public void showLayoutHierarchy() {
|
||||
mFloatingLayoutHierarchyView.setRootNode(AutoJs.getInstance().getLayoutInspector().getCapture());
|
||||
mWindowHoverMenu.getHoverMenuView().setVisibility(View.GONE);
|
||||
showView(mFloatingLayoutHierarchyView);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.stardust.scriptdroid.App;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.autojs.AutoJs;
|
||||
import com.stardust.scriptdroid.external.floating_window.menu.HoverMenuService;
|
||||
import com.stardust.scriptdroid.layout_inspector.LayoutInspector;
|
||||
import com.stardust.util.ClipboardUtil;
|
||||
import com.stardust.scriptdroid.ui.main.MainActivity;
|
||||
import com.stardust.util.MessageEvent;
|
||||
@@ -47,20 +48,31 @@ public class MainMenuNavigatorContent implements NavigatorContent {
|
||||
|
||||
@ViewBinding.Click(R.id.layout_hierarchy)
|
||||
private void showLayoutHierarchy() {
|
||||
if (AutoJs.getInstance().getLayoutInspector().getCapture() == null) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_no_accessibility_permission_to_capture, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_SHOW_LAYOUT_HIERARCHY));
|
||||
if (!ensureCapture()) {
|
||||
return;
|
||||
}
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_SHOW_LAYOUT_HIERARCHY));
|
||||
}
|
||||
|
||||
private boolean ensureCapture() {
|
||||
LayoutInspector inspector = AutoJs.getInstance().getLayoutInspector();
|
||||
if (inspector.isDumping()) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_layout_inspector_is_dumping, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
if (inspector.getCapture() == null) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_no_accessibility_permission_to_capture, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ViewBinding.Click(R.id.layout_bounds)
|
||||
private void showLayoutBounds() {
|
||||
if (AutoJs.getInstance().getLayoutInspector().getCapture() == null) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_no_accessibility_permission_to_capture, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_SHOW_LAYOUT_BOUNDS));
|
||||
if (!ensureCapture()) {
|
||||
return;
|
||||
}
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_SHOW_LAYOUT_BOUNDS));
|
||||
}
|
||||
|
||||
@ViewBinding.Click(R.id.stop_all_running_scripts)
|
||||
|
||||
@@ -118,7 +118,7 @@ public class RecordNavigatorContent implements NavigatorContent, Recorder.OnStat
|
||||
private void resumeRecord() {
|
||||
mRecorder.resume();
|
||||
setState(Recorder.STATE_RECORDING);
|
||||
EventBus.getDefault().post(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
}
|
||||
|
||||
private void pauseRecord() {
|
||||
@@ -131,7 +131,7 @@ public class RecordNavigatorContent implements NavigatorContent, Recorder.OnStat
|
||||
mRecorder.setOnStateChangedListener(this);
|
||||
mRecorder.start();
|
||||
setState(Recorder.STATE_RECORDING);
|
||||
EventBus.getDefault().post(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
}
|
||||
|
||||
private void setState(int state) {
|
||||
@@ -147,7 +147,7 @@ public class RecordNavigatorContent implements NavigatorContent, Recorder.OnStat
|
||||
private void stopRecord() {
|
||||
mRecorder.stop();
|
||||
setState(Recorder.STATE_STOPPED);
|
||||
EventBus.getDefault().post(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
HoverMenuService.postEvent(new MessageEvent(HoverMenuService.MESSAGE_COLLAPSE_MENU));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user