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("<", "<").replaceAll(">", ">") + "</font>"; } else { htmlString = htmlString + " <font color='#f3cf83'>instance</font>"; } if (!opened || element.extra == null) { return htmlString; } return htmlString + " <font color='#919191'>" + element.extra + "</font>"; }
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(); }
public LeakTraceElement getItem(int position) { if (getItemViewType(position) == 0) { return null; } return (LeakTraceElement) this.elements.get(position - 1); }
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("<", "<") .replaceAll(">", ">") + "</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; }
@Override public LeakTraceElement getItem(int position) { if (getItemViewType(position) == TOP_ROW) { return null; } return elements.get(position - 1); }
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("<", "<") .replaceAll(">", ">") + "</font>"; } else { htmlString += " <font color='#f3cf83'>instance</font>"; } if (opened && element.extra != null) { htmlString += " <font color='#919191'>" + element.extra + "</font>"; } return htmlString; }