@Override public void onHideChildren(ItemData itemData) { int position = getCurrentPosition(itemData.getUuid()); List<ItemData> children = itemData.getChildren(); if (children == null) { return; } removeAll(position + 1, getChildrenCount(itemData) - 1); if (onScrollToListener != null) { onScrollToListener.scrollTo(position); } itemData.setChildren(null); }
@Override public void onExpandChildren(ItemData itemData) { int position = getCurrentPosition(itemData.getUuid()); List<ItemData> children = getChildrenByPath(itemData.getPath(), itemData.getTreeDepth()); if (children == null) { return; } addAll(children, position + 1); // 插入到点击点的下方 itemData.setChildren(children); if (onScrollToListener != null) { onScrollToListener.scrollTo(position + 1); } }