Manager of progress using Lottie JSON, compatible for Java and Kotlin.
Int Top | In Bottom |
---|---|
![]() |
![]() |
- Right-click the res folder.
- Choose New.
- Choose Android Resource Directory.
- Name the directory raw.
- In the Resource Types Section add raw.
- Click ok.
- Copy your JSON lottie in RAW folder
New options for personality:
- Size text message
- Style Dialog
- Color text message
- Add font for text
Add font for your project check documents: https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
ProgressLoadingIGB.startLoadingIGB(this){
message = "Good Morning!" // Center Message
srcLottieJson = R.raw.loading_a // Tour Source JSON Lottie
timer = 10000 // Time of live for progress.
hight = 500 // Optional
width = 500 // Optional
}
starLoadingSimpleIGB(R.raw.pork_dance)
finishLoadingIGB()
starLoadingSimpleIGB(R.raw.pork_dance)
Handler().postDelayed({
finishLoadingIGB()
}, 1500)
This method the user will active for cancel any process.
class MainActivity : AppCompatActivity(), IProgressLoadingActions {
fun click(view: View){
ProgressLoadingIGB.startLoadingIGB(this){
message = "Please Wait" // Center Message
sizeTextMessage = 50.0f // Size text // Optional
fontTextMessage = your font project// Set your personal font // Optional
srcLottieJson = R.raw.loader // Your Source JSON Lottie
fontColorMessage = Color.GREEN
timer = 10000 // Time of live for progress.
hight = 700 // Optional
width = 700 // Optional
cancelButton = true // Optional added cancel button
cancelButtonAlpha = 0.6f // Optional
cancelButtonHight = 75 // Optional
cancelButtonWidth = 60 // Optional
cancelButtonColor = R.color.colorAccent // Optional
// cancelButtonBackground = R.drawable.ic_launcher_background //OPTIONAL recommendable use vector xml
}
}
override fun CancelButton() {
val builder =
AlertDialog.Builder(this)
builder.setTitle("Cancel")
builder.setMessage("Here close any process")
builder.setPositiveButton("OK", null)
val dialog = builder.create()
dialog.show()
}
}
It is recommended to use Java 8 onwards.
ProgressLoadingJIGB.setupLoading = (setup) -> {
setup.srcLottieJson = R.raw.sun; // Tour Source JSON Lottie
setup.message = "Welcome Summer!";// Center Message
setup.timer = 0; // Time of live for progress.
setup.width = 200; // Optional
setup.hight = 200; // Optional
};
ProgressLoadingJIGB.startLoading(this);
ProgressLoadingJIGB.finishLoadingJIGB(context);
ProgressLoadingJIGB.setupLoading = (setup) -> {
setup.srcLottieJson = R.raw.sun; // Tour Source JSON Lottie
setup.message = "Welcome Summer!";// Center Message
setup.timer = 0; // Time of live for progress.
setup.width = 200; // Optional
setup.hight = 200; // Optional
};
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ProgressLoadingJIGB.finishLoadingJIGB(context);
}
}, 6000);
This method the user will active for cancel any process.
public class Main2Activity extends AppCompatActivity implements IProgressLoadingActions {
public void clickOption(View v){
ProgressLoadingJIGB.setupLoading = (setup) -> {
setup.srcLottieJson = R.raw.travel; // Your Source JSON Lottie
setup.message = "Welcome Summer!";// Center Message
setup.sizeTextMessage = 16.0f;// Size text // Optional
setup.styleDialog = Your Style; // Optional
setup.timer = 0; // Time of live for progress.
setup.width = 500; // Optional
setup.hight = 500; // Optional
setup.cancelButton = true; // Optional
setup.cancelButtonAlpha = 1f; // Optional
setup.cancelButtonHight = 75; // Optional
setup.cancelButtonWidth = 45; // Optional
// setup.cancelButtonBackground = R.drawable.ic_launcher_background; //OPTIONAL recomendable use vector xml
};
}
@Override
public void CancelButton() {
// setup the alert builder
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Cancel");
builder.setMessage("Here close any process");
// add a button
builder.setPositiveButton("OK", null);
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
}
}
- Add the JitPack repository to your project's build.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in your app's build.gradle file
dependencies {
implementation 'com.github.LordSaac:ProgressLottieIGB:v1.0.2'
}
You are most welcome to contribute to this project!
✳️ Do you need iOS Version for you project ?, check out here: https://github.com/LordSaac/IGProgressLottie-Swift
See more animations here: https://www.lottiefiles.com/
Copyright 2020 Isaac G. Banda
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.