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

@@ -13,6 +13,7 @@ import com.facebook.sonar.plugins.inspector.NodeDescriptor;
import com.facebook.sonar.plugins.inspector.Touch;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
@@ -39,6 +40,12 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
return descriptor.getName(node);
}
@Override
public String getAXName(LithoView node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXName(node);
}
@Override
public int getChildCount(LithoView node) {
return DebugComponent.getRootInstance(node) == null ? 0 : 1;
@@ -49,6 +56,11 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
return DebugComponent.getRootInstance(node);
}
@Override
public @Nullable Object getAXChildAt(LithoView node, int index) {
return DebugComponent.getRootInstance(node);
}
@Override
public List<Named<SonarObject>> getData(LithoView node) throws Exception {
final List<Named<SonarObject>> props = new ArrayList<>();
@@ -74,6 +86,14 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
return props;
}
@Override
public List<Named<SonarObject>> getAXData(LithoView node) throws Exception {
final List<Named<SonarObject>> props = new ArrayList<>();
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
props.addAll(descriptor.getAXData(node));
return props;
}
@Override
public void setValue(LithoView node, String[] path, SonarDynamic value) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
@@ -86,6 +106,12 @@ public class LithoViewDescriptor extends NodeDescriptor<LithoView> {
return descriptor.getAttributes(node);
}
@Override
public List<Named<String>> getAXAttributes(LithoView node) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);
return descriptor.getAXAttributes(node);
}
@Override
public void setHighlighted(LithoView node, boolean selected) throws Exception {
final NodeDescriptor descriptor = descriptorForClass(ViewGroup.class);