Example #1
0
  private void progressUpdate() {

    if (this.spine != null
        && this.strategy.getText() != null
        && this.strategy.getText().length() > 0) {

      double progressInPart =
          (double) this.getPosition() / (double) this.strategy.getText().length();

      if (strategy.getText().length() > 0 && strategy.isAtEnd()) {
        progressInPart = 1d;
      }

      int progress = spine.getProgressPercentage(progressInPart);

      if (progress != -1) {

        int pageNumber = spine.getPageNumberFor(getIndex(), getPosition());

        for (BookViewListener listener : this.listeners) {
          listener.progressUpdate(progress, pageNumber, spine.getTotalNumberOfPages());
        }
      }
    }
  }
Example #2
0
  private void progressUpdate() {

    if (this.spine != null
        && this.strategy.getText() != null
        && this.strategy.getText().length() > 0) {

      double progressInPart =
          (double) this.getPosition() / (double) this.strategy.getText().length();

      if (strategy.getText().length() > 0 && strategy.isAtEnd()) {
        progressInPart = 1d;
      }

      int progress = spine.getProgressPercentage(progressInPart);

      if (progress != -1) {
        for (BookViewListener listener : this.listeners) {
          listener.progressUpdate(progress);
        }
      }
    }
  }