Create and show and hide a loading animation(alternative to progressDialog that is deprecated).
We use Glide to load and play the gif!.
This class are tested with API 16 - 28, so i think it will be compatible with all android versions.
Import Glide library
How to install here.
Import LoadingDialog.java and custom_loading_dialog_layout.xml
Import a GIF to you Drawable folder (sample free loading gifs)
Call it on yout activity
LoadingDialog loadingDialog = new LoadingDialog(Activity.this);
loadingDialog.setLoadImage(R.drawable.loading);
loadingDialog.show();
//to dissmis use: loadingDialog.hide();
method name | Type | Default | Description |
---|---|---|---|
setLoadImage | int | 0 | Set the id of drawable(gif) to glide |
setCancelable | boolean | false | If user can cancel the dialog |
show | void | null | Show dialog |
hide | void | null | Hide the dialog |
Apache License 2.0