Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #69
Wiki page draft:
Progress dialog
extends CustomViewDialog
A dialog showing a progress
Building dialogs
The progress is indeterminate by default, but can be updated either before the dialog is shown or while it is being shown.
In addition, an
AsyncTaskcan easily be connected to the dialog, such that the progress and state is automatically synced with the task.By default, a cancel button is shown, but the dialog can not be dismissed by (accidentally) clicking outside it or via the back button. This button can be removed via
.neut(null).The dialog is meant to be dismissed by calling
.dismiss(), but an auto-dismiss option exists.Example
More examples can be found in the testApp
Available customizations
SimpleProgressDialog.bar()SimpleProgressDialog.indeterminateCircle().type(Type type)Please note that the circle type can only show an indeterminate progress
.percentage(boolean visible)See also CustomViewDialog
Updating the progress
These methods can be called either before the dialog is shown or afterwards.
Progress
.updateProgress(int progress).updateProgress(int progress, int max).updateMax(int max).updateSecondaryProgress(int progress).updateIndeterminate().updateFinished()Text
.updateProgressText(String text)for a short text, e.g. 5% or 8MB (by default, this shows the progress unless manually set).updateInfoText(String text)for a longer text, e.g. "Loading data…" or "5 seconds left"Working with AsyncTask
Derive a task from
SimpleProgressTask.and link it to the dialog:
If
cancelableis set and the cancel button is pressed, the task is canceled withmayInterruptIfRunning=false, so make sure to frequently check forìsCancelled()in your tasksdoInBackgroundmethod.If
autoDismissis set, the dialog will be dismissed once the task is finished and theonResultmethod will be called withwhich=SimpleProgressDialog.COMPLETED.Receiving results
See SimpleDialog