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; } this.strategy.clearText(); this.strategy.setPosition(0); if (this.spine.navigateByHref(href)) { loadText(); } else { new LoadTextTask().execute(href); } }
public void goBackInHistory() { this.strategy.clearText(); this.spine.navigateByIndex(this.prevIndex); strategy.setPosition(this.prevPos); this.storedAnchor = null; this.prevIndex = -1; this.prevPos = -1; loadText(); }
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(); }
/** Loads the text and saves the restored position. */ public void restore() { strategy.clearText(); loadText(); }