public void navigateTo(String rawHref) { this.prevIndex = this.getIndex(); this.prevPos = this.getPosition(); // URLDecode the href, so it does not contain %20 etc. String href = URLDecoder.decode(StringUtil.substringBefore(rawHref, Constants.FRAGMENT_SEPARATOR_CHAR)); // Don't decode the anchor. String anchor = StringUtil.substringAfterLast(rawHref, Constants.FRAGMENT_SEPARATOR_CHAR); if (!"".equals(anchor)) { this.storedAnchor = anchor; } // Just an anchor and no href; resolve it on this page if (href.length() == 0) { restorePosition(); } else { this.strategy.clearText(); this.strategy.setPosition(0); if (this.spine.navigateByHref(href)) { loadText(); } else { executeTask(new LoadTextTask(), href); } } }
private void doNavigation(int index) { // Check if we're already in the right part of the book if (index == this.getIndex()) { restorePosition(); return; } this.prevIndex = this.getIndex(); this.storedIndex = index; this.strategy.clearText(); this.spine.navigateByIndex(index); loadText(); }
public void goBackInHistory() { if (this.prevIndex == this.getIndex()) { strategy.setPosition(prevPos); this.storedAnchor = null; this.prevIndex = -1; this.prevPos = -1; restorePosition(); } else { this.strategy.clearText(); this.spine.navigateByIndex(this.prevIndex); strategy.setPosition(this.prevPos); this.storedAnchor = null; this.prevIndex = -1; this.prevPos = -1; loadText(); } }
private void onInnerViewResize() { restorePosition(); int tableWidth = (int) (this.getWidth() * 0.9); tableHandler.setTableWidth(tableWidth); }