public void initialUpdate(LinkFilter linkFilterAll, Util.Lang lang) { hasBeenInitialized = true; List<LinkFilter> yo = Settings.Link.getLinks(activity.getBook().getTitle(Util.Lang.EN), linkFilterAll); linkSelectorQueue = new LinkedList<>(yo); currLinkCount = null; // initialize to all grayed update(lang); }
// if currLinkCount == null, all linkSelectorBarButtons will be gray public void update(LinkFilter currLinkCount, Util.Lang lang) { this.currLinkCount = currLinkCount; selectorListLayout.removeAllViews(); if (linkSelectorQueue == null) return; ListIterator<LinkFilter> linkIt = linkSelectorQueue.listIterator(linkSelectorQueue.size()); while (linkIt.hasPrevious()) { // add children in reverse order LinkFilter tempLC = linkIt.previous(); LinkSelectorBarButton lssb = new LinkSelectorBarButton(activity, tempLC, activity.getBook(), lang); lssb.setOnClickListener(linkSelectorBarButtonClick); selectorListLayout.addView(lssb); if (!LinkFilter.pseudoEquals(tempLC, currLinkCount)) { lssb.setTextColor(Util.getColor(activity, R.attr.text_chapter_header_color)); } } Settings.Link.setLinks(activity.getBook().getTitle(Util.Lang.EN), linkSelectorQueue); }