A ProgressDialog Library for Android API 24+ apps provided by Techiness Overloaded (Developer name : Arunprasadh C). Quite Useful for showing progress during any operation. Has support for both Determinate and Indeterminate ProgressBar, Dark Theme, and NegativeButton.
An easily customisable ProgressDialog Library for Android API 24 and above provided by Techiness Overloaded (Developer name: Arunprasadh C). Quite Useful for showing progress during any operation. Has support for both Determinate and Indeterminate ProgressBar. Also supports Dark Theme. Has javadoc Documentation for all public Constructors, Attributes and Methods, making it easy to learn about the Library from Android Studio IDE.
[!NOTE] It is highly recommended to use the Latest Release Version of the Library and it is strongly recommended NOT to use any Pre-release versions of the library as they are used for testing out changes and are not production-ready. It is readily observable that Pre-release versions have "a" or "rc" in their version code (Example: Version 1.4.0a4 or 1.4.4-rc1). It is strictly recommended not to use version 1.4.2 or 1.5.0 as the build artifacts are not properly published. You can instead prefer the latest version (1.5.1).
Usage examples available at Usage Examples Java Documentation of Class and Methods available at Java Documentation of Library Kotlin Documentation of Class and Methods available at Kotlin Documentation of Library You can find the Entire Change Log at ProgressDialog Library Change Log See the Contributing Guide to learn more about Contributing to this Project.
true
to the first parameter of setOnShowListener
method. The time elapsed will be updated until the progress
reaches maxValue
.You can find the Entire Change Log at ProgressDialog Library Change Log
Make Sure that you are using JDK Version 11 Include the following code in your Project-level Gradle Build file at the end of repositories:
Gradle Groovy DSL (If you have build.gradle file):
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Gradle Kotlin DSL (If you have build.gradle.kts file):
allprojects {
repositories {
maven { url = uri("https://jitpack.io") }
}
}
Now, include the following dependency in your App-level Gradle Build file:
[!NOTE] Current latest version is 1.5.1
Gradle Groovy DSL (If you have build.gradle file):
dependencies {
implementation 'com.github.techinessoverloaded:progress-dialog:1.5.1'
}
Gradle Kotlin DSL (If you have build.gradle.kts file):
dependencies {
implementation("com.github.techinessoverloaded:progress-dialog:1.5.1")
}
Gradle Groovy DSL (If you have build.gradle file):
dependencies {
def latest-version = "1.5.1"
implementation "com.github.techinessoverloaded:progress-dialog:$latest-version"
}
Gradle Kotlin DSL (If you have build.gradle.kts file):
dependencies {
val latest-version = "1.5.1"
implementation("com.github.techinessoverloaded:progress-dialog:$latest-version")
}
Now import ProgressDialog class in your Activity/Fragment:
import com.techiness.progressdialoglibrary.ProgressDialog;
[!NOTE] Theme can be changed after Instantiation using
setTheme(int themeConstant)
method.
[!IMPORTANT] If you want to Instantiate
ProgressDialog
Class in a Fragment, userequireContext()
method instead ofthis
keyword for passingContext
object. Similarly, for InstantiatingProgressDialog
Class in Inner Classes, useYourActivity.this
in Java orthis@YourActivity
in Kotlin instead of simplethis
keyword for passingContext
object.
ProgressDialog progressDialog = new ProgressDialog(this); //same as new ProgressDialog(this, ProgressDialog.THEME_LIGHT);
val progressDialog = ProgressDialog(this) //same as ProgressDialog(this, ProgressDialog.THEME_LIGHT)
ProgressDialog progressDialog = new ProgressDialog(this, ProgressDialog.THEME_DARK);
val progressDialog = ProgressDialog(this, ProgressDialog.THEME_DARK)
[!NOTE] Mode can be changed as and when necessary using in-built methods.
ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this); // for instantiating with Determinate mode
val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this) // for instantiating with Determinate mode
ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK);
val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK)
ProgressDialog.THEME_FOLLOW_SYSTEM
with Constructor ?if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30
{
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM); //This is optional. This will enable Android's Autotheming for the entire App
ProgressDialog progressDialog = new ProgressDialog(this,ProgressDialog.THEME_FOLLOW_SYSTEM); // Enables AutoTheming for the ProgressDialog instance.
}
else //Autotheming not compatible
{
ProgressDialog progressDialog = new ProgressDialog(this,ProgressDialog.THEME_DARK); // or any other constructors mentioned above
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30
{
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM) //This is optional. This will enable Android's Autotheming for the entire App
val progressDialog = ProgressDialog(this,ProgressDialog.THEME_FOLLOW_SYSTEM) // Enables AutoTheming for the ProgressDialog instance.
}
else //Autotheming not compatible
{
val progressDialog = ProgressDialog(this,ProgressDialog.THEME_DARK) // or any other constructors mentioned above
}
ProgressDialog.THEME_FOLLOW_SYSTEM
with setTheme(int themeConstant)
method ?if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30
{
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM); //This is optional. This will enable Android's Autotheming for the entire App
progressDialog.setTheme(ProgressDialog.THEME_FOLLOW_SYSTEM); // Enables AutoTheming for the ProgressDialog instance.
}
else //Autotheming not compatible
{
progressDialog.setTheme(ProgressDialog.THEME_DARK); // or ProgressDialog.THEME_LIGHT
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30
{
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM) //This is optional. This will enable Android's Autotheming for the entire App
progressDialog.theme = ProgressDialog.THEME_FOLLOW_SYSTEM) // Enables AutoTheming for the ProgressDialog instance.
}
else //Autotheming not compatible
{
progressDialog.theme = ProgressDialog.THEME_DARK // or ProgressDialog.THEME_LIGHT
}
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.show();
val progressDialog = ProgressDialog(this)
progressDialog.show()
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
show()
}
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.hideProgressText();
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_DETERMINATE
progress = 65
secondaryProgress = 80
hideProgressText()
show()
}
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.hideProgressText();
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_DETERMINATE
progress = 65
secondaryProgress = 80
hideProgressText()
show()
}
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_DETERMINATE
setprogress = 65
show()
}
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_DETERMINATE
progress = 65
show()
}
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setTitle("Indeterminate");
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_INDETERMINATE
setTitle("Indeterminate")
show()
}
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setTitle("Indeterminate");
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_INDETERMINATE
setTitle("Indeterminate")
show()
}
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setTitle("Determinate");
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.showProgressTextAsFraction(true);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_DETERMINATE
setTitle("Determinate")
progress = 65
secondaryProgress = 80
showProgressTextAsFraction(true)
show()
}
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setTitle("Determinate");
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.showProgressTextAsFraction(true);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_DETERMINATE
setTitle("Determinate")
progress = 65
secondaryProgress = 80
showProgressTextAsFraction(true)
show()
}
[!NOTE] Enabling NegativeButton will automatically enable TitleView.
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setNegativeButton("Dismiss","Indeterminate",v -> {
Toast.makeText(this,"Custom OnClickListener for Indeterminate",Toast.LENGTH_LONG).show();
progressDialog.dismiss();
});
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_INDETERMINATE
setNegativeButton("Dismiss", "Determinate") {
Toast.makeText(this@KotlinActivity, "Custom OnClickListener for Indeterminate", Toast.LENGTH_LONG).show()
dismiss()
}
show()
}
[!NOTE] Enabling NegativeButton will automatically enable TitleView.
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setNegativeButton("Dismiss","Indeterminate",v -> {
Toast.makeText(this,"Custom OnClickListener for Indeterminate",Toast.LENGTH_LONG).show();
progressDialog.dismiss();
});
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_INDETERMINATE
setNegativeButton("Dismiss", "Determinate") {
Toast.makeText(this@KotlinActivity, "Custom OnClickListener for Indeterminate", Toast.LENGTH_LONG).show()
dismiss()
}
show()
}
[!NOTE] Enabling NegativeButton will automatically enable TitleView.
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(54);
progressDialog.showProgressTextAsFraction(true);
progressDialog.setNegativeButton("Cancel","Determinate",null);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_LIGHT
mode = ProgressDialog.MODE_DETERMINATE
progress = 54
showProgressTextAsFraction(true)
setNegativeButton("Cancel","Determinate",null)
show()
}
progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(54);
progressDialog.showProgressTextAsFraction(true);
progressDialog.setNegativeButton("Cancel","Determinate",null);
progressDialog.show();
with(progressDialog)
{
theme = ProgressDialog.THEME_DARK
mode = ProgressDialog.MODE_DETERMINATE
progress = 54
showProgressTextAsFraction(true)
setNegativeButton("Cancel","Determinate",null)
show()
}