fix(automator): click always return true if the widget with text exists
This commit is contained in:
@@ -46,14 +46,14 @@ public class ActionFactory {
|
|||||||
return new SearchTargetAction(action, new FilterAction.EditableFilter(index)) {
|
return new SearchTargetAction(action, new FilterAction.EditableFilter(index)) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performAction(UiObject node) {
|
protected boolean performAction(UiObject node) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
if (action == AccessibilityNodeInfo.ACTION_SET_TEXT) {
|
if (action == AccessibilityNodeInfo.ACTION_SET_TEXT) {
|
||||||
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
|
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
|
||||||
} else {
|
} else {
|
||||||
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, node.text() + text);
|
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, node.text() + text);
|
||||||
}
|
}
|
||||||
node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
|
return node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,16 +25,15 @@ public abstract class SearchTargetAction extends FilterAction {
|
|||||||
boolean performed = false;
|
boolean performed = false;
|
||||||
for (UiObject node : nodes) {
|
for (UiObject node : nodes) {
|
||||||
node = searchTarget(node);
|
node = searchTarget(node);
|
||||||
if (node != null) {
|
if (node != null && performAction(node)) {
|
||||||
performAction(node);
|
|
||||||
performed = true;
|
performed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return performed;
|
return performed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performAction(UiObject node) {
|
protected boolean performAction(UiObject node) {
|
||||||
node.performAction(mAction);
|
return node.performAction(mAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAction() {
|
public int getAction() {
|
||||||
|
|||||||
Reference in New Issue
Block a user