Giter VIP home page Giter VIP logo

techinessoverloaded / progress-dialog Goto Github PK

View Code? Open in Web Editor NEW
99.0 2.0 5.0 2.08 MB

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.

Home Page: https://techinessoverloaded.github.io/progress-dialog/

License: Apache License 2.0

Java 20.54% Kotlin 79.46%
progressdialog-library theme fragment android-studio gradle java android progress progressdialog dialog

progress-dialog's Introduction

ProgressDialog Library ProgressDialog Library Build Status Generate Docs and Deploy to GH Pages Dependabot

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.

Key Features

  • Highly Customisable.
  • Has support for Dark Theme.
  • Has support for AutoTheming from Android 11 (API Level 30).
  • Can be set in both Determinate and Indeterminate Mode.
  • Has support for Time Tracking in Determinate Mode.
  • Has support for Negative Button, Title, and ProgressView.
  • Desgined for usage in both Java and Kotlin Android Projects.
  • Clear Documentation is available.

What's New in Version 1.5.1 (Feature Update) ?

Features

  • Added Time Tracking feature for Determinate Mode ProgressDialog as suggested by @vzool in Issue #13. Time tracking can be enabled by passing true to the first parameter of setOnShowListener method. The time elapsed will be updated until the progress reaches maxValue.

Bug Fixes

  • Fixed an Issue where unwanted views got displayed on the ProgressDialog, as pointed out by @soenkegissel and @mg2000 in Issue #16.

Maintenance

  • Merged Pull Requests #11, #12, #14, #15, #17 given by @dependabot to update Material Version, Gradle Version, Gradle Build Action Version, ConstraintLayout Version and AppCompat Version.

You can find the Entire Change Log at ProgressDialog Library Change Log

Steps to add ProgressDialog Library to your Android Studio Project

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")
	     }

Or you can also define the version as a String like this(You can copy either this code or the above one):

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;

Various Constructors available

Simple Constructor

Uses Light Theme by Default.

Note

Theme can be changed after Instantiation using setTheme(int themeConstant) method.

Important

If you want to Instantiate ProgressDialog Class in a Fragment, use requireContext() method instead of this keyword for passing Context object. Similarly, for Instantiating ProgressDialog Class in Inner Classes, use YourActivity.this in Java or this@YourActivity in Kotlin instead of simple this keyword for passing Context object.

Java Code:

ProgressDialog progressDialog = new ProgressDialog(this); //same as new ProgressDialog(this, ProgressDialog.THEME_LIGHT);

Kotlin Code:

val progressDialog = ProgressDialog(this) //same as ProgressDialog(this, ProgressDialog.THEME_LIGHT)

Constructor for Alternate Theme

This Constructor can be used for setting Dark Theme.

Java Code:

ProgressDialog progressDialog = new ProgressDialog(this, ProgressDialog.THEME_DARK);

Kotlin Code:

val progressDialog = ProgressDialog(this, ProgressDialog.THEME_DARK)

Constructor for Alternate Mode

Default mode is Indeterminate mode.

Note

Mode can be changed as and when necessary using in-built methods.

Java Code:

ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this); // for instantiating with Determinate mode

Kotlin Code:

val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this) // for instantiating with Determinate mode

Constructor for Alternate Mode and Theme

This constructor can be used to customise both Mode and Theme of ProgressDialog.

Java Code:

ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK); 

Kotlin Code:

val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK)

Simple Examples

Note: These examples are for simple illustration of ProgressDialog Library. For completely knowing about the Library, refer to the JavaDoc/KDoc Documentation of the Library through Android Studio.

How to use ProgressDialog.THEME_FOLLOW_SYSTEM with Constructor ?

Java Code:

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
}

Kotlin Code:

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
}

How to use ProgressDialog.THEME_FOLLOW_SYSTEM with setTheme(int themeConstant) method ?

Java Code:

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
}

Kotlin Code:

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
}

Indeterminate ProgressDialog without Title (Light Theme)

Java Code:

ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.show();

Kotlin Code:

val progressDialog = ProgressDialog(this)
progressDialog.show()

Output:

Indeterminate ProgressDialog without Title (Dark Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.show();

Kotlin Code:

with(progressDialog) 
{
   theme = ProgressDialog.THEME_DARK
   show()
}

Output:

Determinate ProgressDialog without Title, without ProgressView, with Secondary Progress (Light Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.hideProgressText();
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_LIGHT
   mode = ProgressDialog.MODE_DETERMINATE
   progress = 65
   secondaryProgress = 80
   hideProgressText()
   show()
}

Output:

Determinate ProgressDialog without Title, without ProgressView, with Secondary Progress (Dark Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.hideProgressText();
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_DARK
   mode = ProgressDialog.MODE_DETERMINATE
   progress = 65
   secondaryProgress = 80
   hideProgressText()
   show()
}

Output:

Determinate ProgressDialog without Title, with ProgressView as Percentage (Light Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_LIGHT
   mode = ProgressDialog.MODE_DETERMINATE
   setprogress = 65
   show()
}

Output:

Determinate ProgressDialog without Title, with ProgressView as Percentage (Dark Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(65);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_DARK
   mode = ProgressDialog.MODE_DETERMINATE
   progress = 65
   show()
}

Output:

Indeterminate ProgressDialog with Title (Light Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setTitle("Indeterminate");
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_LIGHT
   mode = ProgressDialog.MODE_INDETERMINATE
   setTitle("Indeterminate")
   show()
}

Output:

Indeterminate ProgressDialog with Title (Dark Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE);
progressDialog.setTitle("Indeterminate");
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_DARK
   mode = ProgressDialog.MODE_INDETERMINATE
   setTitle("Indeterminate")
   show()
}

Output:

Determinate ProgressDialog with Title, Secondary Progress and ProgressView as Fraction (Light Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setTitle("Determinate");
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.showProgressTextAsFraction(true);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_LIGHT
   mode = ProgressDialog.MODE_DETERMINATE
   setTitle("Determinate")
   progress = 65
   secondaryProgress = 80
   showProgressTextAsFraction(true)
   show()
}

Output:

Determinate ProgressDialog with Title, Secondary Progress and ProgressView as Fraction (Dark Theme)

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setTitle("Determinate");
progressDialog.setProgress(65);
progressDialog.setSecondaryProgress(80);
progressDialog.showProgressTextAsFraction(true);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_DARK
   mode = ProgressDialog.MODE_DETERMINATE
   setTitle("Determinate")
   progress = 65
   secondaryProgress = 80
   showProgressTextAsFraction(true)
   show()
}

Output:

Indeterminate ProgressDialog with NegativeButton and Custom OnClickListener for NegativeButton (Light Theme)

Note

Enabling NegativeButton will automatically enable TitleView.

Java Code:

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();

Kotlin Code:

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()
}

Output:

Indeterminate ProgressDialog with NegativeButton and Custom OnClickListener for NegativeButton (Dark Theme)

Note

Enabling NegativeButton will automatically enable TitleView.

Java Code:

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();

Kotlin Code:

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()
}

Output:

Determinate ProgressDialog with NegativeButton and Default OnClickListener for NegativeButton (Light Theme)

Note

Enabling NegativeButton will automatically enable TitleView.

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(54);
progressDialog.showProgressTextAsFraction(true);
progressDialog.setNegativeButton("Cancel","Determinate",null);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_LIGHT
   mode = ProgressDialog.MODE_DETERMINATE
   progress = 54
   showProgressTextAsFraction(true)
   setNegativeButton("Cancel","Determinate",null)
   show()
}

Output:

Determinate ProgressDialog with NegativeButton and Default OnClickListener for NegativeButton (Dark Theme)

Note: Enabling NegativeButton will automatically enable TitleView.

Java Code:

progressDialog.setTheme(ProgressDialog.THEME_DARK);
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
progressDialog.setProgress(54);
progressDialog.showProgressTextAsFraction(true);
progressDialog.setNegativeButton("Cancel","Determinate",null);
progressDialog.show();

Kotlin Code:

with(progressDialog)
{
   theme = ProgressDialog.THEME_DARK
   mode = ProgressDialog.MODE_DETERMINATE
   progress = 54
   showProgressTextAsFraction(true)
   setNegativeButton("Cancel","Determinate",null)
   show()
}

Output:

progress-dialog's People

Contributors

dependabot[bot] avatar techinessoverloaded avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

progress-dialog's Issues

A suggestion to update the minSdk

Is there any particular reason for adding minSdk = 24?

The application worked with minSdk = 21. Is it possible to change the minSdk version?

[BUG] Loading bar, title - everything showing.

Using API 28 Simulator and Samsung S10 API 31.
Init like this:

ProgressDialog progressDialog;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
            progressDialog = new ProgressDialog(requireContext(), ProgressDialog.THEME_FOLLOW_SYSTEM);
        } else {
            progressDialog = new ProgressDialog(requireContext(), ProgressDialog.THEME_LIGHT);
        }
progressDialog.show()

Same for both devices:
image

Library issue

Iam facing an issue with your library when iam cloning it its showing me an error and that is "Library not found in saved repositories" hope u will solve this ASAP...
Thank you !

Cancel button is always shown.

I programmed like below.

val progressDialog = ProgressDialog(requireContext())
progressDialog.show()

But 'Cancel' button is shown. I don't know why.

Could not find com.github.techinessoverloaded:progress-dialog:1.2.2.

[FEATURE REQUEST] Add Timer Increasing Mod

Is your feature request related to a problem? Please describe.
Yes, I think so. This will solve how much time the process is taken if a user complains.

Describe the solution you'd like
Add a new mod for a timer that increases and updates the UI every second, so the UI is just a text like this 00:00:00

Describe alternatives you've considered
None.

Additional context
None.

Cannot tell if the dialog is being displayed

Is your feature request related to a problem? Please describe.
It is not possible to determine whether the dialog box is being displayed

Describe the solution you'd like
Add the isShowing method to see if it is showing

Describe alternatives you've considered
Or set dialog object parts private

Additional context
null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.