DialogLoading is a pop-up loading box, there will be multi style loading
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then add the dependency:
dependencies {
implementation 'com.github.Tobeyr1:DialogLoading:1.0.4'
}
Open a DialogLoading:
Dialog dialog = DialogUtils.Companion.createLoading(context,"text content");
When network or local data loading ends, use it to close the DialogLoading
DialogUtils.Companion.closeDialog(dialog);
Compared with 1.0.1, 1.0.2 adds a second loading box:
Open a AlertDialog:
AlertDialog dialog = AlertDialogUtil.Companion.createLoading(this,"登录中..."); //是androidx的分包alertdialog
When network or local data loading ends, use it to close the AlertLoading
AlertDialogUtil.Companion.closeDialog(dialog);
Added a new method to change the loading color gradient:
AlertDialogUtils.setProgressColor(getResources().getColor(R.color.colorAccent));
//used color
<color name="colorAccent">#1C66B6</color>
The effect is as follows:
详细使用效果等可以参考博文我的第一个开源库-DialogLoading弹出加载框(Kotlin版)