Java 类com.squareup.leakcanary.LeakTraceElement 实例源码

项目:boohee_v5.6    文件:DisplayLeakAdapter.java   
private String elementToHtmlString(LeakTraceElement element, boolean root, boolean opened) {
    String qualifier;
    String simpleName;
    String htmlString = "";
    if (element.referenceName == null) {
        htmlString = htmlString + "leaks ";
    } else if (!root) {
        htmlString = htmlString + "references ";
    }
    if (element.type == LeakTraceElement.Type.STATIC_FIELD) {
        htmlString = htmlString + "<font color='#c48a47'>static</font> ";
    }
    if (element.holder == Holder.ARRAY || element.holder == Holder.THREAD) {
        htmlString = htmlString + "<font color='#f3cf83'>" + element.holder.name()
                .toLowerCase() + "</font> ";
    }
    int separator = element.className.lastIndexOf(46);
    if (separator == -1) {
        qualifier = "";
        simpleName = element.className;
    } else {
        qualifier = element.className.substring(0, separator + 1);
        simpleName = element.className.substring(separator + 1);
    }
    if (opened) {
        htmlString = htmlString + "<font color='#919191'>" + qualifier + "</font>";
    }
    htmlString = htmlString + ("<font color='#ffffff'>" + simpleName + "</font>");
    if (element.referenceName != null) {
        htmlString = htmlString + ".<font color='#998bb5'>" + element.referenceName
                .replaceAll("<", "&lt;").replaceAll(">", "&gt;") + "</font>";
    } else {
        htmlString = htmlString + " <font color='#f3cf83'>instance</font>";
    }
    if (!opened || element.extra == null) {
        return htmlString;
    }
    return htmlString + " <font color='#919191'>" + element.extra + "</font>";
}
项目:leakcannary    文件:DisplayLeakAdapter.java   
public void update(LeakTrace leakTrace, String referenceKey, String referenceName) {
  if (referenceKey.equals(this.referenceKey)) {
    // Same data, nothing to change.
    return;
  }
  this.referenceKey = referenceKey;
  this.referenceName = referenceName;
  this.elements = new ArrayList<LeakTraceElement>(leakTrace.elements);
  opened = new boolean[1 + elements.size()];
  notifyDataSetChanged();
}
项目:LeakCanary4Eclipse    文件:DisplayLeakAdapter.java   
public void update(LeakTrace leakTrace, String referenceKey, String referenceName) {
  if (referenceKey.equals(this.referenceKey)) {
    // Same data, nothing to change.
    return;
  }
  this.referenceKey = referenceKey;
  this.referenceName = referenceName;
  this.elements = new ArrayList<LeakTraceElement>(leakTrace.elements);
  opened = new boolean[1 + elements.size()];
  notifyDataSetChanged();
}
项目:boohee_v5.6    文件:DisplayLeakAdapter.java   
public LeakTraceElement getItem(int position) {
    if (getItemViewType(position) == 0) {
        return null;
    }
    return (LeakTraceElement) this.elements.get(position - 1);
}
项目:leakcannary    文件:DisplayLeakAdapter.java   
private String elementToHtmlString(LeakTraceElement element, boolean root, boolean opened) {
  String htmlString = "";

  if (element.referenceName == null) {
    htmlString += "leaks ";
  } else if (!root) {
    htmlString += "references ";
  }

  if (element.type == STATIC_FIELD) {
    htmlString += "<font color='#c48a47'>static</font> ";
  }

  if (element.holder == ARRAY || element.holder == THREAD) {
    htmlString += "<font color='#f3cf83'>" + element.holder.name().toLowerCase() + "</font> ";
  }

  int separator = element.className.lastIndexOf('.');
  String qualifier;
  String simpleName;
  if (separator == -1) {
    qualifier = "";
    simpleName = element.className;
  } else {
    qualifier = element.className.substring(0, separator + 1);
    simpleName = element.className.substring(separator + 1);
  }

  if (opened) {
    htmlString += "<font color='#919191'>" + qualifier + "</font>";
  }

  String styledClassName = "<font color='#ffffff'>" + simpleName + "</font>";

  htmlString += styledClassName;

  if (element.referenceName != null) {
    htmlString += ".<font color='#998bb5'>" + element.referenceName.replaceAll("<", "&lt;")
        .replaceAll(">", "&gt;") + "</font>";
  } else {
    htmlString += " <font color='#f3cf83'>instance</font>";
  }

  if (opened && element.extra != null) {
    htmlString += " <font color='#919191'>" + element.extra + "</font>";
  }

  Exclusion exclusion = element.exclusion;
  if (exclusion != null) {
    if (opened) {
      htmlString += "<br/><br/>Excluded by rule";
      if (exclusion.name != null) {
        htmlString += " <font color='#ffffff'>" + exclusion.name + "</font>";
      }
      htmlString += " matching <font color='#f3cf83'>" + exclusion.matching + "</font>";
      if (exclusion.reason != null) {
        htmlString += " because <font color='#f3cf83'>" + exclusion.reason + "</font>";
      }
    } else {
      htmlString += " (excluded)";
    }
  }

  return htmlString;
}
项目:leakcannary    文件:DisplayLeakAdapter.java   
@Override public LeakTraceElement getItem(int position) {
  if (getItemViewType(position) == TOP_ROW) {
    return null;
  }
  return elements.get(position - 1);
}
项目:LeakCanary4Eclipse    文件:DisplayLeakAdapter.java   
private String elementToHtmlString(LeakTraceElement element, boolean root, boolean opened) {
  String htmlString = "";

  if (element.referenceName == null) {
    htmlString += "leaks ";
  } else if (!root) {
    htmlString += "references ";
  }

  if (element.type == STATIC_FIELD) {
    htmlString += "<font color='#c48a47'>static</font> ";
  }

  if (element.holder == ARRAY || element.holder == THREAD) {
    htmlString += "<font color='#f3cf83'>" + element.holder.name().toLowerCase() + "</font> ";
  }

  int separator = element.className.lastIndexOf('.');
  String qualifier;
  String simpleName;
  if (separator == -1) {
    qualifier = "";
    simpleName = element.className;
  } else {
    qualifier = element.className.substring(0, separator + 1);
    simpleName = element.className.substring(separator + 1);
  }

  if (opened) {
    htmlString += "<font color='#919191'>" + qualifier + "</font>";
  }

  String styledClassName = "<font color='#ffffff'>" + simpleName + "</font>";

  htmlString += styledClassName;

  if (element.referenceName != null) {
    htmlString += ".<font color='#998bb5'>" + element.referenceName.replaceAll("<", "&lt;")
        .replaceAll(">", "&gt;") + "</font>";
  } else {
    htmlString += " <font color='#f3cf83'>instance</font>";
  }

  if (opened && element.extra != null) {
    htmlString += " <font color='#919191'>" + element.extra + "</font>";
  }

  Exclusion exclusion = element.exclusion;
  if (exclusion != null) {
    if (opened) {
      htmlString += "<br/><br/>Excluded by rule";
      if (exclusion.name != null) {
        htmlString += " <font color='#ffffff'>" + exclusion.name + "</font>";
      }
      htmlString += " matching <font color='#f3cf83'>" + exclusion.matching + "</font>";
      if (exclusion.reason != null) {
        htmlString += " because <font color='#f3cf83'>" + exclusion.reason + "</font>";
      }
    } else {
      htmlString += " (excluded)";
    }
  }

  return htmlString;
}
项目:LeakCanary4Eclipse    文件:DisplayLeakAdapter.java   
@Override public LeakTraceElement getItem(int position) {
  if (getItemViewType(position) == TOP_ROW) {
    return null;
  }
  return elements.get(position - 1);
}
项目:leakcanary-for-eclipse    文件:DisplayLeakAdapter.java   
private String elementToHtmlString(LeakTraceElement element, boolean root, boolean opened) {
  String htmlString = "";

  if (element.referenceName == null) {
    htmlString += "leaks ";
  } else if (!root) {
    htmlString += "references ";
  }

  if (element.type == STATIC_FIELD) {
    htmlString += "<font color='#c48a47'>static</font> ";
  }

  if (element.holder == ARRAY || element.holder == THREAD) {
    htmlString += "<font color='#f3cf83'>" + element.holder.name().toLowerCase() + "</font> ";
  }

  int separator = element.className.lastIndexOf('.');
  String qualifier;
  String simpleName;
  if (separator == -1) {
    qualifier = "";
    simpleName = element.className;
  } else {
    qualifier = element.className.substring(0, separator + 1);
    simpleName = element.className.substring(separator + 1);
  }

  if (opened) {
    htmlString += "<font color='#919191'>" + qualifier + "</font>";
  }

  String styledClassName = "<font color='#ffffff'>" + simpleName + "</font>";

  htmlString += styledClassName;

  if (element.referenceName != null) {
    htmlString += ".<font color='#998bb5'>" + element.referenceName.replaceAll("<", "&lt;")
        .replaceAll(">", "&gt;") + "</font>";
  } else {
    htmlString += " <font color='#f3cf83'>instance</font>";
  }

  if (opened && element.extra != null) {
    htmlString += " <font color='#919191'>" + element.extra + "</font>";
  }
  return htmlString;
}
项目:leakcanary-for-eclipse    文件:DisplayLeakAdapter.java   
@Override public LeakTraceElement getItem(int position) {
  if (getItemViewType(position) == TOP_ROW) {
    return null;
  }
  return elements.get(position - 1);
}
项目:leakcanary    文件:DisplayLeakAdapter.java   
private String elementToHtmlString(LeakTraceElement element, boolean root, boolean opened) {
  String htmlString = "";

  if (element.referenceName == null) {
    htmlString += "leaks ";
  } else if (!root) {
    htmlString += "references ";
  }

  if (element.type == STATIC_FIELD) {
    htmlString += "<font color='#c48a47'>static</font> ";
  }

  if (element.holder == ARRAY || element.holder == THREAD) {
    htmlString += "<font color='#f3cf83'>" + element.holder.name().toLowerCase() + "</font> ";
  }

  int separator = element.className.lastIndexOf('.');
  String qualifier;
  String simpleName;
  if (separator == -1) {
    qualifier = "";
    simpleName = element.className;
  } else {
    qualifier = element.className.substring(0, separator + 1);
    simpleName = element.className.substring(separator + 1);
  }

  if (opened) {
    htmlString += "<font color='#919191'>" + qualifier + "</font>";
  }

  String styledClassName = "<font color='#ffffff'>" + simpleName + "</font>";

  htmlString += styledClassName;

  if (element.referenceName != null) {
    htmlString += ".<font color='#998bb5'>" + element.referenceName.replaceAll("<", "&lt;")
        .replaceAll(">", "&gt;") + "</font>";
  } else {
    htmlString += " <font color='#f3cf83'>instance</font>";
  }

  if (opened && element.extra != null) {
    htmlString += " <font color='#919191'>" + element.extra + "</font>";
  }

  Exclusion exclusion = element.exclusion;
  if (exclusion != null) {
    if (opened) {
      htmlString += "<br/><br/>Excluded by rule";
      if (exclusion.name != null) {
        htmlString += " <font color='#ffffff'>" + exclusion.name + "</font>";
      }
      htmlString += " matching <font color='#f3cf83'>" + exclusion.matching + "</font>";
      if (exclusion.reason != null) {
        htmlString += " because <font color='#f3cf83'>" + exclusion.reason + "</font>";
      }
    } else {
      htmlString += " (excluded)";
    }
  }

  return htmlString;
}
项目:leakcanary    文件:DisplayLeakAdapter.java   
@Override public LeakTraceElement getItem(int position) {
  if (getItemViewType(position) == TOP_ROW) {
    return null;
  }
  return elements.get(position - 1);
}