Skip to content

Commit d2c23f6

Browse files
New Version v20.1.0
1 parent 6fc5052 commit d2c23f6

File tree

5 files changed

+69
-24
lines changed

5 files changed

+69
-24
lines changed

.idea/assetWizardSettings.xml

+46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

+3-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/src/main/java/com/developer/kalert/KAlertDialog.java

+18
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class KAlertDialog extends AlertDialog implements View.OnClickListener {
6262
private String titleFont, contentFont;
6363
private int displayType;
6464
private int titleColor = 0, contentColor = 0;
65+
private int drawableColor = 0;
6566
private Integer contentAlignment, contentGravity;
6667
private int titleTextGravity = Gravity.CENTER;
6768

@@ -232,6 +233,7 @@ private void changeAlertType(int alertType, boolean fromCreate) {
232233
break;
233234
case CUSTOM_IMAGE_TYPE:
234235
setCustomImage1(mCustomImgDrawable);
236+
setCustomImageColorFilter(drawableColor);
235237
setConfirmButtonColor(mColor);
236238
break;
237239
case URL_IMAGE_TYPE:
@@ -309,6 +311,13 @@ public KAlertDialog setCustomImage(int resourceId) {
309311
}
310312
}
311313

314+
public KAlertDialog setDrawableTintOnNightMode(boolean isTinted, int tintColor) {
315+
if ( isTinted && isNightMode(context) ) {
316+
setCustomImageColorFilter( tintColor );
317+
}
318+
return this;
319+
}
320+
312321
public KAlertDialog setURLImage(String imageURL, int displayType) {
313322
return setURLImage1(imageURL, displayType);
314323
}
@@ -322,6 +331,15 @@ private KAlertDialog setCustomImage1(Drawable drawable) {
322331
return this;
323332
}
324333

334+
private KAlertDialog setCustomImageColorFilter(int color) {
335+
drawableColor = color;
336+
if (mCustomImage != null && drawableColor != 0) {
337+
mCustomImage.setColorFilter(ContextCompat.getColor(context, drawableColor),
338+
android.graphics.PorterDuff.Mode.SRC_IN);
339+
}
340+
return this;
341+
}
342+
325343
private KAlertDialog setURLImage1(String imageURL, int displayType) {
326344
this.imageURL = imageURL;
327345
this.displayType = displayType;

sample/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.developer.kalert.alert"
88
minSdkVersion 19
99
targetSdkVersion 33
10-
versionCode 25
11-
versionName "20.0.0"
10+
versionCode 26
11+
versionName "20.1.0"
1212
}
1313

1414

0 commit comments

Comments
 (0)