Skip to content

Commit

Permalink
Up to 1.0.7
Browse files Browse the repository at this point in the history
Add progress param to loading dialog
  • Loading branch information
nordan committed Aug 9, 2020
1 parent b0d3710 commit 81893cf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your module's `build.gradle` file:
```gradle
dependencies {
...
implementation 'com.github.Dan629pl:nordan-material-dialog-android:1.0.6'
implementation 'com.github.Dan629pl:nordan-material-dialog-android:1.0.7'
}
```
<h1>Nordan Alert Dialog</h1>
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "Nordan Material Dialog v1.0.6"
versionName "Nordan Material Dialog v1.0.7"
}

buildTypes {
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/nordan/dialog/NordanLoadingDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
public class NordanLoadingDialog {

public static Dialog createLoadingDialog(Activity activity, String loadingText) {
return createLoadingDialog(activity, loadingText, 0);
return createLoadingDialog(activity, loadingText, 0, -1);
}

public static Dialog createLoadingDialog(Activity activity, String loadingText, int accentColor) {
return createLoadingDialog(activity, loadingText, accentColor, -1);
}

public static Dialog createLoadingDialog(Activity activity, String loadingText, int accentColor, int progress) {
Dialog loadingDialog = new Dialog(activity);
loadingDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Optional.ofNullable(loadingDialog.getWindow())
Expand All @@ -33,6 +37,10 @@ public static Dialog createLoadingDialog(Activity activity, String loadingText,
if (accentColor > 0) {
loadingBar.getIndeterminateDrawable().setColorFilter(activity.getColor(accentColor), android.graphics.PorterDuff.Mode.MULTIPLY);
}
if (progress > -1) {
loadingBar.setIndeterminate(false);
loadingBar.setProgress(progress);
}
return loadingDialog;
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/nordan_loading_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:gravity="center"
android:text="Loading…"
android:textAlignment="center"
android:textSize="24sp" />
android:textSize="22sp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
2 changes: 1 addition & 1 deletion sampleapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "Nordan Material Dialog v1.0.6"
versionName "Nordan Material Dialog v1.0.7"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down

0 comments on commit 81893cf

Please sign in to comment.