private CoverHolder getHolder(ImageView coverView, FBTree tree) { CoverHolder holder = (CoverHolder) coverView.getTag(); if (holder == null) { holder = new CoverHolder(this, coverView, tree.getUniqueKey()); coverView.setTag(holder); } else { holder.setKey(tree.getUniqueKey()); } return holder; }
public boolean trySetCoverImage(ImageView coverView, FBTree tree) { final CoverHolder holder = getHolder(coverView, tree); Bitmap coverBitmap; try { coverBitmap = Cache.getBitmap(holder.Key); } catch (CoverCache.NullObjectException e) { return false; } if (coverBitmap == null) { final ZLImage cover = tree.getCover(); if (cover instanceof ZLLoadableImage) { final ZLLoadableImage img = (ZLLoadableImage) cover; if (img.isSynchronized()) { setCoverForView(holder, img); } else { img.startSynchronization(holder.new CoverSyncRunnable(img)); } } else if (cover != null) { coverBitmap = getBitmap(cover); } } if (coverBitmap != null) { holder.CoverView.setImageBitmap(coverBitmap); return true; } return false; }
public void updateVisibility() { final LinkedList<FBTree> toRemove = new LinkedList<FBTree>(); ListIterator<FBTree> nodeIterator = subTrees().listIterator(); FBTree currentNode = null; int nodeCount = 0; for (int i = 0; i < ChildrenItems.size(); ++i) { NetworkLibraryItem currentItem = ChildrenItems.get(i); if (!(currentItem instanceof NetworkCatalogItem)) { continue; } boolean processed = false; while (currentNode != null || nodeIterator.hasNext()) { if (currentNode == null) { currentNode = nodeIterator.next(); } if (!(currentNode instanceof NetworkCatalogTree)) { currentNode = null; ++nodeCount; continue; } NetworkCatalogTree child = (NetworkCatalogTree) currentNode; if (child.Item == currentItem) { switch (child.Item.getVisibility()) { case B3_TRUE: child.updateVisibility(); break; case B3_FALSE: toRemove.add(child); break; case B3_UNDEFINED: child.clear(); child.ChildrenItems.clear(); break; } currentNode = null; ++nodeCount; processed = true; break; } else { boolean found = false; for (int j = i + 1; j < ChildrenItems.size(); ++j) { if (child.Item == ChildrenItems.get(j)) { found = true; break; } } if (!found) { toRemove.add(currentNode); currentNode = null; ++nodeCount; } else { break; } } } final int nextIndex = nodeIterator.nextIndex(); if (!processed && NetworkTreeFactory.createNetworkTree(this, currentItem, nodeCount) != null) { ++nodeCount; nodeIterator = subTrees().listIterator(nextIndex + 1); } } while (currentNode != null || nodeIterator.hasNext()) { if (currentNode == null) { currentNode = nodeIterator.next(); } if (currentNode instanceof NetworkCatalogTree) { toRemove.add(currentNode); } currentNode = null; } for (FBTree tree : toRemove) { tree.removeSelf(); } }