NodeInfo tree working (besides litho nodes)

Summary: The second tree has access to all AX NodeInfo properties (they are not in the sidebar yet). Infrastructure set up to customize displayed information bassed on what is most useful. Descriptors for views updated to include AX functionality and non-view descriptors AX functions defaulted to null/empty. Non-view nodes (like Fragments, Window, Appication) no longer included in AX tree. Corresponding nodes will be highlighted (although not expanded) on click in either tree.

Differential Revision: D8795800

fbshipit-source-id: cf2333f69bfecca3ff84aae62681c684dfa14bf3
This commit is contained in:
Sara Valderrama
2018-07-12 09:23:29 -07:00
committed by Facebook Github Bot
parent 9e673a07a8
commit 1c5ecce667
8 changed files with 284 additions and 8 deletions

View File

@@ -99,6 +99,12 @@ public class ViewGroupDescriptor extends NodeDescriptor<ViewGroup> {
return descriptor.getName(node);
}
@Override
public String getAXName(ViewGroup node) throws Exception {
NodeDescriptor descriptor = descriptorForClass(View.class);
return descriptor.getAXName(node);
}
@Override
public int getChildCount(ViewGroup node) {
int childCount = 0;
@@ -130,6 +136,21 @@ public class ViewGroupDescriptor extends NodeDescriptor<ViewGroup> {
return null;
}
@Override
public @Nullable Object getAXChildAt(ViewGroup node, int index) {
for (int i = 0, count = node.getChildCount(); i < count; i++) {
final View child = node.getChildAt(i);
if (child instanceof HiddenNode) {
continue;
}
if (i >= index) {
return child;
}
}
return null;
}
@Override
public List<Named<SonarObject>> getData(ViewGroup node) throws Exception {
final List<Named<SonarObject>> props = new ArrayList<>();
@@ -160,6 +181,14 @@ public class ViewGroupDescriptor extends NodeDescriptor<ViewGroup> {
return props;
}
@Override
public List<Named<SonarObject>> getAXData(ViewGroup node) throws Exception {
final List<Named<SonarObject>> props = new ArrayList<>();
final NodeDescriptor descriptor = descriptorForClass(View.class);
props.addAll(descriptor.getAXData(node));
return props;
}
@Override
public void setValue(ViewGroup node, String[] path, SonarDynamic value) throws Exception {
switch (path[0]) {
@@ -200,6 +229,12 @@ public class ViewGroupDescriptor extends NodeDescriptor<ViewGroup> {
return descriptor.getAttributes(node);
}
@Override
public List<Named<String>> getAXAttributes(ViewGroup node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(View.class);
return descriptor.getAXAttributes(node);
}
@Override
public void setHighlighted(ViewGroup node, boolean selected) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(View.class);