You can use this class I wrote. It offers only the basic functions. If you want a fully functional ProgressDialog, then use this lightweight library.
Add the following dependency to module/build.gradle:
compile 'com.lmntrx.android.library.livin.missme:missme:0.1.5'
Usage is similar to original ProgressDialog
ProgressDialog progressDialog = new
progressDialog(YourActivity.this);
progressDialog.setMessage("Please wait");
progressDialog.setCancelable(false);
progressDialog.show();
progressDialog.dismiss();
NB: You must override activity's onBackPressed()
Java8 Implementation:
@Override
public void onBackPressed() {
progressDialog.onBackPressed(
() -> {
super.onBackPressed();
return null;
}
);
}
Kotlin Implementation:
override fun onBackPressed() {
progressDialog.onBackPressed { super.onBackPressed() }
}