public void putAttributes()

in layout-hierarchy-common/src/main/java/com/facebook/testing/screenshot/layouthierarchy/common/TextViewAttributePlugin.java [56:78]


  public void putAttributes(JSONObject node, Object obj, Point offset) throws JSONException {
    if (!accept(obj)) {
      return;
    }
    final TextView textView = (TextView) obj;

    try {
      CharSequence text = textView.getText();
      if (text != null) {
        put(node, TEXT, text.toString());
      } else {
        put(node, TEXT, "null");
      }
    } catch (Exception e) {
      put(node, TEXT, e.getMessage());
    }

    put(node, TEXT_SIZE, String.valueOf(textView.getTextSize()));
    put(node, TEXT_COLOR, Integer.toHexString(textView.getCurrentTextColor()));
    if (Build.VERSION.SDK_INT >= 17) {
      put(node, TEXT_ALIGNMENT, nameForAlignment(textView.getTextAlignment()));
    }
  }