use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class SearchTargetAction method perform.
@Override
public boolean perform(List<UiObject> nodes) {
boolean performed = false;
for (UiObject node : nodes) {
node = searchTarget(node);
if (node != null) {
performAction(node);
performed = true;
}
}
return performed;
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class SearchUpTargetAction method searchTarget.
@Override
public UiObject searchTarget(UiObject n) {
UiObject node = n;
int i = 0;
while (node != null && !mAble.isAble(node)) {
i++;
if (i > LOOP_MAX) {
return null;
}
node = node.parent();
}
return node;
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class DfsFilter method filterChildren.
private void filterChildren(UiObject parent, List<UiObject> list) {
for (int i = 0; i < parent.getChildCount(); i++) {
UiObject child = parent.child(i);
if (child == null)
continue;
boolean included = isIncluded(child);
if (included) {
list.add(child);
}
filterChildren(child, list);
if (!included) {
child.recycle();
}
}
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class ScrollMaxActionTest method perform.
@Test
public void perform() throws Exception {
ScrollMaxAction action = new ScrollMaxAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
UiObject root = new TestUiObject(20);
action.perform(root);
System.out.println(TestUiObject.max);
assertEquals(1, TestUiObject.count);
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class DepthFirstSearchTargetActionTest method perform.
@Test
public void perform() {
DepthFirstSearchTargetAction action = new DepthFirstSearchTargetAction(AccessibilityNodeInfo.ACTION_CLICK, new FilterAction.Filter() {
@Override
public List<UiObject> filter(UiObject root) {
List<UiObject> list = new ArrayList<>();
for (int i = 0; i < root.getChildCount(); i++) {
list.add(root.child(i));
}
return list;
}
});
TestUiObject root = new TestUiObject(5);
action.perform(root);
System.out.println(TestUiObject.max);
assertEquals(1, TestUiObject.count);
}
Aggregations