CustomLottieDialogBox is an android library which facilitate developers to add customized loading Dialog-Boxes to their android apps. Users can add Lottie Animations of thier wish or can choose from the already existing animation. They can change the backgroung color, text color, size of dialog box or can add thier own custom text using this library.
- Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Step 2. Add the dependency:
dependencies {
implementation 'com.github.SiddyDevelops:CustomLottieDialogBox-Android:0.2.0'
}
In your activity.java
follow the steps given below to add the custom Dialog:
-
To add an animation from the library-builtin:
CustomLottieDialog customLottieDialog; customLottieDialog = new CustomLottieDialog(context, "LO01"); customLottieDialog.show();
-
To add your own custom Lottie animation: First download Lottie JSON of your preferred animation and add the downloaded file to
raw
insideres
.
CustomLottieDialog customLottieDialog;
customLottieDialog = new CustomLottieDialog(context,R.raw.heartbeat_loader);
customLottieDialog.show();
-
To customize the Loading Text:
customLottieDialog.setLoadingText("Custom Text"); OR customLottieDialog.setLoadingText(""); //-----> To remove custom text
-
To change text-color of custom loading text:
customLottieDialog.setLoadingTextColor("{HexColorCode}");
-
To change Lottie animation background color:
customLottieDialog.setLottieBackgroundColor("{HexColorCode}");
-
To change the dimensions of the dialog box:
customLottieDialog.setDialogLayoutDimensions({width in dp (int)},{height in dp (int));
-
To dismiss the dialog box:
customLottieDialog.dismiss();
-
Example:
CustomLottieDialog customLottieDialog; customLottieDialog = new CustomLottieDialog(MainActivity.this, "LO01"); customLottieDialog.setLottieBackgroundColor("#7AC89E"); customLottieDialog.setLoadingText("Custom Text"); customLottieDialog.setLoadingTextColor("#FFFFFF");
|
|
This Android Library is developed by Siddharth Singh. The animation included in this library is taken from https://lottiefiles.com/ .
Follow my Social Handles for more projects.
Enjoy Coding!! 🚀 ✨