Progress view will only be shown during task is executing

@param progress
@return
425075
public CocoTask<T> progress(final View progress) {
        if (progress != null) {
            this.progress = new WeakReference<Object>(progress);
        }
        return this;
    }
1056016
@Override
  public synchronized void onProgressUpdate(float progress) {
    if (mIsFinished) {
      return;
    }
    try {
      onProgressUpdateImpl(progress);
    } catch (Exception e) {
      onUnhandledException(e);
    }
  }
930941
private void progressTaskStatus(SimulatorTaskInProgress tip, long now) {
    TaskStatus status = tip.getTaskStatus();
    if (status.getRunState() != State.RUNNING) {
      return; // nothing to be done
    }

    boolean isMap = tip.isMapTask();
    // Time when the user space code started
    long startTime = -1;
    // Time spent in map or just in the REDUCE phase of a reduce task
    long runTime = tip.getUserSpaceRunTime();
    float progress = 0.0f;
    if (isMap) {
      // We linearly estimate the progress of maps since their start 
      startTime = status.getStartTime();
      progress = ((float)(now - startTime)) / runTime;
    } else {
      // We don't model reduce progress in the SHUFFLE or SORT phases
      // We use linear estimate for the 3rd, REDUCE phase
      Phase reducePhase = status.getPhase();
      switch (reducePhase) {
      case SHUFFLE:
        progress = 0.0f; // 0 phase is done out of 3
        break;
      case SORT:
        progress = 1.0f/3; // 1 phase is done out of 3
        break;
      case REDUCE: {
        // REDUCE phase with the user code started when sort finished
        startTime = status.getSortFinishTime();
        // 0.66f : 2 phases are done out of of 3
        progress = 2.0f/3 + (((float) (now - startTime)) / runTime) / 3.0f;
      }
        break;
      default:
        // should never get here
        throw new IllegalArgumentException("Invalid reducePhase=" + reducePhase);
      }
    }
    
    final float EPSILON = 0.0001f;
    if (progress < -EPSILON || progress > 1 + EPSILON) {
      throw new IllegalStateException("Task progress out of range: " + progress);
    }
    progress = Math.max(Math.min(1.0f, progress), 0.0f);
    status.setProgress(progress);
    
    if (LOG.isDebugEnabled()) {
      LOG.debug("Updated task progress, taskId=" + status.getTaskID()
          + ", progress=" + status.getProgress());
    }
  }
363133
private void bindProgressBar(final ServiceTaskBase<?> task, final ProgressBar progressBar) {

        // Perform this binding into the JAT to respect widget and task API
        JRebirth.runIntoJAT("Bind ProgressBar to " + task.getServiceHandlerName(),
                            () -> {
                                // Avoid the progress bar to display 100% at start up
                                task.updateProgress(0, 0);
                                // Bind the progress bar
                                progressBar.progressProperty().bind(task.workDoneProperty().divide(task.totalWorkProperty()));
                            });

    }
446292
public ImageHelper load(ImageView v, ProgressBar progress, Request request) {
        RequestProgressListener listener = new RequestProgressListener(progress);
        if (loadInternal(v, request, listener, listener) == null) {
            listener.showProgress(v);
        } else {
            listener.showImage(v);
        }

        return this;
    }
596461
@Override
    public void onTaskComplete() {
        progressBar.dismiss();
        progressBar = null;
        Toast.makeText(getActivity(), "Download complete!", Toast.LENGTH_LONG).show();
    }
1372195
private void updateProgressBars(int value) {
        ProgressBar circularProgressBar = getCircularProgressBar();
        ProgressBar horizontalProgressBar = getHorizontalProgressBar();

        if (value == Window.PROGRESS_VISIBILITY_ON) {
            if (mFeatureProgress) {
                int level = horizontalProgressBar.getProgress();
                int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ?
                        View.VISIBLE : View.INVISIBLE;
                horizontalProgressBar.setVisibility(visibility);
            }
            if (mFeatureIndeterminateProgress) {
                circularProgressBar.setVisibility(View.VISIBLE);
            }
        } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
            if (mFeatureProgress) {
                horizontalProgressBar.setVisibility(View.GONE);
            }
            if (mFeatureIndeterminateProgress) {
                circularProgressBar.setVisibility(View.GONE);
            }
        } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
            horizontalProgressBar.setIndeterminate(true);
        } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
            horizontalProgressBar.setIndeterminate(false);
        } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
            // We want to set the progress value before testing for visibility
            // so that when the progress bar becomes visible again, it has the
            // correct level.
            horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

            if (value < Window.PROGRESS_END) {
                showProgressBars(horizontalProgressBar, circularProgressBar);
            } else {
                hideProgressBars(horizontalProgressBar, circularProgressBar);
            }
        }
    }
701127
private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
    requireNonNull(indexAction);
    String entityTypeId = indexAction.getEntityTypeId();
    updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
    try {
      if (dataService.hasEntityType(entityTypeId)) {
        EntityType entityType = dataService.getEntityType(entityTypeId);
        if (indexAction.getEntityId() != null) {
          progress.progress(
              progressCount,
              format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId()));
          rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId());
        } else {
          progress.progress(progressCount, format("Indexing {0}", entityType.getId()));
          final Repository<Entity> repository = dataService.getRepository(entityType.getId());
          indexService.rebuildIndex(repository);
        }
      } else {
        EntityType entityType = getEntityType(indexAction);
        if (indexService.hasIndex(entityType)) {
          progress.progress(
              progressCount, format("Dropping entityType with id: {0}", entityType.getId()));
          indexService.deleteIndex(entityType);
        } else {
          // Index Job is finished, here we concluded that we don't have enough info to continue the
          // index job
          progress.progress(
              progressCount,
              format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId()));
        }
      }
      updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED);
      return true;
    } catch (Exception ex) {
      LOG.error("Index job failed", ex);
      updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED);
      return false;
    }
  }
1088934
public Progress addPhase(String status) {
    Progress phase = addPhase();
    phase.setStatus(status);
    return phase;
  }
423369
def get_progress(start, finish):
    
    now = datetime.now()
    dif_time_start = start - now
    dif_time_finish = finish - now

    if dif_time_start.days < 0 and dif_time_finish.days < 0:
        return PROGRESS_STATES[3][0]
    elif dif_time_start.days < 0 and dif_time_finish.days >= 1:
        return PROGRESS_STATES[2][0]
    elif dif_time_start.days >= 1 and dif_time_finish.days >= 1:
        return PROGRESS_STATES[0][0]
    else:
        return PROGRESS_STATES[2][0]
358462
public void showProgress(final int id, final int sofar, final int total) {
        final T notification = get(id);

        if (notification == null) {
            return;
        }

        notification.updateStatus(FileDownloadStatus.progress);
        notification.update(sofar, total);
    }
138713
public void setProgressWithAnimation(float progress, int duration) {
        if (progressAnimator != null) {
            progressAnimator.cancel();
        }
        progressAnimator = ValueAnimator.ofFloat(this.progress, progress);
        progressAnimator.setDuration(duration);
        progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float progress = (Float) animation.getAnimatedValue();
                setProgress(progress, true);
                if (indeterminateMode) {
                    float updateAngle = progress * 360 / 100;
                    startAngle = DEFAULT_START_ANGLE + (rightToLeft ? updateAngle : -updateAngle);
                }
            }
        });
        progressAnimator.start();
    }
879108
public void showProgress(boolean show) {
        if (actionButton != null) {
            actionButton.showProgress(show);
        }
        if (formLayout != null) {
            formLayout.setEnabled(!show);
        }
    }
772793
def progress(self, p):
        '''
        
        '''
        self.task_stack[-1] = self.task_stack[-1]._replace(progress=p)
        self.progress_report()
162912
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
    public void enableProgressBar() {
        showProgressBar = true;

        if (searchBoxViewModel != null) {
            progressController = new SearchProgressController(new SearchProgressController.ProgressListener() {
                @Override
                public void onStart() {
                    updateProgressBar(searchBoxViewModel, true);
                }

                @Override
                public void onStop() {
                    updateProgressBar(searchBoxViewModel, false);
                }
            }, progressBarDelay);
        }
    }
1012967
private void bindProgressProperty(final ServiceTaskBase<?> task, final DoubleProperty progressProperty) {

        // Perform this binding into the JAT to respect widget and task API
        JRebirth.runIntoJAT("Bind Progress Property to " + task.getServiceHandlerName(),
                            () -> {
                                // Avoid the progress bar to display 100% at start up
                                task.updateProgress(0, 0);
                                // Bind the progress bar
                                progressProperty.bind(task.workDoneProperty().divide(task.totalWorkProperty()));
                            });

    }
1230322
def _finish_progress(self):
        

        if self._show_progressbar:
            if self._progressbar is None:
                self._initialize_progressbar()
            if self._progressbar is not None:
                self._progressbar.finish()

        if self._progress_callback is not None:
            self._progress_callback(100.0)