tashilapathum / PleaseWait

A simple and lightweight Material 3 progress dialog library for Android to replace now-deprecated android.app.ProgressDialog
Apache License 2.0
19 stars 3 forks source link
android android-library android-ui design dialog dialogfragment material material-components material-design material-ui progress

PleaseWait

Maven Central

PleaseWait is a lightweight library that can be used as a drop-in replacement for now-deprecated android.app.ProgressDialog. According to Google, the reason to deprecate the good old ProgressDialog is:

ProgressDialog is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like ProgressBar, which can be embedded in your app's UI.

I understand the reasoning but it means we have to do some more work to prevent the user from doing something unexpected before the operation is finished. But come on, using a progress dialog is so much easier. So I made this library to use in my apps to avoid those deprecation warnings everywhere and to improve the look of the progress dialog. Also I wanted to learn the process of publishing a library.

Preview

Indeterminate mode Determinate mode Dark and light modes
Preview Preview Preview

Features

How to use

  1. Add the dependency to the app-level build.gradle.
implementation 'io.github.tashilapathum:please-wait:0.5.0'
  1. Intitialize with Activity or Fragment context and show.

    val progressDialog = PleaseWaitDialog(context = this)
    progressDialog.show()
  2. Optionally set title and message

    progressDialog.setTitle("Please wait")
    progressDialog.setMessage("Loading...")
  3. Dismiss when the operation is complete

    progressDialog.dismiss()

Additional options

Java implementation

PleaseWaitDialog progressDialog = new PleaseWaitDialog(this);
progressDialog.setTitle("Please wait");
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();