fix(automator): click always return true if the widget with text exists

This commit is contained in:
hyb1996 2018-04-13 22:55:08 +08:00
parent a00bd293b3
commit 34fb18cba3
2 changed files with 5 additions and 6 deletions

View File

@ -46,14 +46,14 @@ public class ActionFactory {
return new SearchTargetAction(action, new FilterAction.EditableFilter(index)) {
@Override
protected void performAction(UiObject node) {
protected boolean performAction(UiObject node) {
Bundle args = new Bundle();
if (action == AccessibilityNodeInfo.ACTION_SET_TEXT) {
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
} else {
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);
}
};
}

View File

@ -25,16 +25,15 @@ public abstract class SearchTargetAction extends FilterAction {
boolean performed = false;
for (UiObject node : nodes) {
node = searchTarget(node);
if (node != null) {
performAction(node);
if (node != null && performAction(node)) {
performed = true;
}
}
return performed;
}
protected void performAction(UiObject node) {
node.performAction(mAction);
protected boolean performAction(UiObject node) {
return node.performAction(mAction);
}
public int getAction() {