Пример #1
0
  private void reportProgress(float progress) {
    if (isCompleted) {
      return;
    }

    if (progress > currentProgress) {
      currentProgress = progress;
    }

    if (notifyCancellable != null) {
      notifyCancellable.cancel();
      notifyCancellable = null;
    }

    long delta = im.actor.runtime.Runtime.getActorTime() - lastNotifyDate;
    if (delta > NOTIFY_THROTTLE) {
      lastNotifyDate = im.actor.runtime.Runtime.getActorTime();
      performReportProgress();
    } else {
      notifyCancellable = schedule((Runnable) () -> performReportProgress(), delta);
    }
  }