public int incrementProgress(int increment) { if (subNotifications.isEmpty()) { if (!isCompleted()) { // Log.d("Aptoide-ViewNotification", "current progress: "+this.currentProgress.get()+" // increment: "+increment+" notificationprogress: "+this.notificationUpdateProgress.get()+" // progressUpdateTrigger: "+(this.progressCompletionTarget/20)+" progressCompletionTarget: // "+this.progressCompletionTarget); if ((this.progressCompletionTarget / 20) > 0 && (((this.currentProgress.get() + increment) - this.notificationUpdateProgress.get()) / (this.progressCompletionTarget / 20) >= 1)) { // Log.d("Aptoide-ViewNotification", "updating notification"); this.currentProgress.addAndGet(increment); this.notificationUpdateProgress.set(this.currentProgress.get()); managerNotifications.updateDisplay(this); // Log.d("Aptoide-ViewNotification", "target size: "+progressCompletionTarget+" // current progress: "+currentProgress); } else { // Log.d("Aptoide-ViewNotification", "not updating notification"); this.currentProgress.addAndGet(increment); } if (this.currentProgress.get() >= this.progressCompletionTarget) { // Log.d("Aptoide-ViewNotification", "target size: "+progressCompletionTarget+" // current progress: "+currentProgress); setCompleted( true); // TODO send Message to listening clients in Managing class if iscompleted // after this invocation } } return this.currentProgress.get(); } else { return -1; // TODO raise exception } }
public void setCompleted(boolean completed) { if (completed) { this.currentProgress.set(this.progressCompletionTarget); dissociateFromParent(); managerNotifications.dismissNotification(targetsHashid); } this.completed = completed; }
public void progressSetCurrent(int currentProgress) { // if(currentProgress > this.currentProgress.get()){ // //TODO raise exception // } if ((this.progressCompletionTarget / 20) > 0 && ((currentProgress - this.notificationUpdateProgress.get()) / (this.progressCompletionTarget / 20)) >= 1) { this.notificationUpdateProgress.set(currentProgress); managerNotifications.updateDisplay(this); } this.currentProgress.set(currentProgress); }
public void setProgressCompletionTarget(int target) { this.progressCompletionTarget = target; managerNotifications.startDisplay(this); // managerNotifications.updateDisplay(this); }