int getTotalUnseen(TreeNode n) { int unseen = 0; for (int i = 0; i < n.getChildCount(); i++) { TreeNode child = n.getChildAt(i); if (child instanceof PlaylistTreeNode) unseen += ((PlaylistTreeNode) child).numUnseenTracks; else if (child instanceof LibraryTreeNode) unseen += ((LibraryTreeNode) child).numUnseenTracks; else unseen += getTotalUnseen(child); } return unseen; }
boolean anyComments(TreeNode n) { for (int i = 0; i < n.getChildCount(); i++) { TreeNode child = n.getChildAt(i); if (child instanceof PlaylistTreeNode) { if (((PlaylistTreeNode) child).hasComments) return true; } else if (child instanceof LibraryTreeNode) { if (((LibraryTreeNode) child).hasComments) return true; } else { if (anyComments(child)) return true; } } return false; }