in android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/ViewDescriptor.java [208:385]
public void setValue(
View node,
String[] path,
@Nullable SetDataOperations.FlipperValueHint kind,
FlipperDynamic value) {
if (path[0].equals(axViewPropsTitle)
|| path[0].equals(axNodeInfoPropsTitle)
|| path[0].equals(axTalkbackPropsTitle)) {
setAccessibilityValue(node, path, value);
return;
}
if (!path[0].equals("View")) {
return;
}
switch (path[1]) {
case "elevation":
node.setElevation(value.asFloat());
break;
case "alpha":
node.setAlpha(value.asFloat());
break;
case "visibility":
node.setVisibility(sVisibilityMapping.get(value.asString()));
break;
case "layoutParams":
// path is [view, layoutParams, value] and we only want the values
if (path.length > 2) {
setLayoutParams(node, Arrays.copyOfRange(path, 2, path.length), value);
}
break;
case "layoutDirection":
node.setLayoutDirection(sLayoutDirectionMapping.get(value.asString()));
break;
case "textDirection":
node.setTextDirection(sTextDirectionMapping.get(value.asString()));
break;
case "textAlignment":
node.setTextAlignment(sTextAlignmentMapping.get(value.asString()));
break;
case "background":
node.setBackground(new ColorDrawable(value.asInt()));
break;
case "foreground":
node.setForeground(new ColorDrawable(value.asInt()));
break;
case "state":
switch (path[2]) {
case "enabled":
node.setEnabled(value.asBoolean());
break;
case "activated":
node.setActivated(value.asBoolean());
break;
case "selected":
node.setSelected(value.asBoolean());
break;
}
break;
case "bounds":
switch (path[2]) {
case "left":
node.setLeft(value.asInt());
break;
case "top":
node.setTop(value.asInt());
break;
case "right":
node.setRight(value.asInt());
break;
case "bottom":
node.setBottom(value.asInt());
break;
}
break;
case "padding":
switch (path[2]) {
case "left":
node.setPadding(
value.asInt(),
node.getPaddingTop(),
node.getPaddingRight(),
node.getPaddingBottom());
break;
case "top":
node.setPadding(
node.getPaddingLeft(),
value.asInt(),
node.getPaddingRight(),
node.getPaddingBottom());
break;
case "right":
node.setPadding(
node.getPaddingLeft(),
node.getPaddingTop(),
value.asInt(),
node.getPaddingBottom());
break;
case "bottom":
node.setPadding(
node.getPaddingLeft(), node.getPaddingTop(), node.getPaddingRight(), value.asInt());
break;
}
break;
case "rotation":
switch (path[2]) {
case "x":
node.setRotationX(value.asFloat());
break;
case "y":
node.setRotationY(value.asFloat());
break;
case "z":
node.setRotation(value.asFloat());
break;
}
break;
case "translation":
switch (path[2]) {
case "x":
node.setTranslationX(value.asFloat());
break;
case "y":
node.setTranslationY(value.asFloat());
break;
case "z":
node.setTranslationZ(value.asFloat());
break;
}
break;
case "position":
switch (path[2]) {
case "x":
node.setX(value.asFloat());
break;
case "y":
node.setY(value.asFloat());
break;
case "z":
node.setZ(value.asFloat());
break;
}
break;
case "scale":
switch (path[2]) {
case "x":
node.setScaleX(value.asFloat());
break;
case "y":
node.setScaleY(value.asFloat());
break;
}
break;
case "pivot":
switch (path[2]) {
case "x":
node.setPivotY(value.asFloat());
break;
case "y":
node.setPivotX(value.asFloat());
break;
}
break;
case "width":
LayoutParams lpw = node.getLayoutParams();
lpw.width = value.asInt();
node.setLayoutParams(lpw);
break;
case "height":
LayoutParams lph = node.getLayoutParams();
lph.height = value.asInt();
node.setLayoutParams(lph);
break;
}
invalidate(node);
}