Beispiel #1
0
  /**
   * Scrolls to a previously stored point.
   *
   * <p>Call this after setPosition() to actually go there.
   */
  private void restorePosition() {

    if (this.storedAnchor != null && this.anchors.containsKey(storedAnchor)) {
      strategy.setPosition(anchors.get(storedAnchor));
      this.storedAnchor = null;
    }

    this.strategy.updatePosition();
  }
Beispiel #2
0
  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();
  }
Beispiel #3
0
  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();
    }
  }