diff --git a/.gitignore b/.gitignore
index 32b1dd61..b2c8c080 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,7 @@ output.json
# IntelliJ
*.iml
-.idea/
+/.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml
diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml
deleted file mode 100644
index 806ea4b4..00000000
--- a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml
deleted file mode 100644
index f14c928e..00000000
--- a/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_2_9_1_aar.xml
deleted file mode 100644
index 0ef9a76f..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_2_9_1_aar.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_core_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_core_2_9_1_aar.xml
deleted file mode 100644
index a1515135..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_core_2_9_1_aar.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_utils_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_utils_2_9_1_aar.xml
deleted file mode 100644
index 0e5ed06f..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_android_utils_2_9_1_aar.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_2_9_1.xml
deleted file mode 100644
index 57c70a1b..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_2_9_1_aar.xml
deleted file mode 100644
index 288597e9..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_2_9_1_aar.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_androidx_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_androidx_2_9_1_aar.xml
deleted file mode 100644
index 4af15e95..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_androidx_2_9_1_aar.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_core_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_core_2_9_1_aar.xml
deleted file mode 100644
index 62da8b9b..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_core_2_9_1_aar.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_support_fragments_2_9_1_aar.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_support_fragments_2_9_1_aar.xml
deleted file mode 100644
index 547d1dfc..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_leakcanary_object_watcher_android_support_fragments_2_9_1_aar.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_shark_2_9_1.xml
deleted file mode 100644
index 7a67875a..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_android_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_shark_android_2_9_1.xml
deleted file mode 100644
index 5bba0829..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_android_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_graph_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_shark_graph_2_9_1.xml
deleted file mode 100644
index 49cbd8bc..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_graph_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_hprof_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_shark_hprof_2_9_1.xml
deleted file mode 100644
index 586984c3..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_hprof_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_log_2_9_1.xml b/.idea/libraries/Gradle__com_squareup_leakcanary_shark_log_2_9_1.xml
deleted file mode 100644
index 6d97df29..00000000
--- a/.idea/libraries/Gradle__com_squareup_leakcanary_shark_log_2_9_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_6_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_6_21.xml
deleted file mode 100644
index e9f77dc3..00000000
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_6_21.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_6_21.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_6_21.xml
deleted file mode 100644
index 5ea0bbf7..00000000
--- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_6_21.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index e85f7ddf..4d28613c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,5 +3,4 @@ android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
-android.disableAutomaticComponentCreation=true
-org.gradle.java.home=C\:\\Program Files\\Java\\jdk-11.0.12
\ No newline at end of file
+android.disableAutomaticComponentCreation=true
\ No newline at end of file
diff --git a/library/src/main/java/com/developer/kalert/KAlertDialog.java b/library/src/main/java/com/developer/kalert/KAlertDialog.java
index cf79d8f8..84248df1 100644
--- a/library/src/main/java/com/developer/kalert/KAlertDialog.java
+++ b/library/src/main/java/com/developer/kalert/KAlertDialog.java
@@ -26,11 +26,13 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.AppCompatButton;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.drawable.DrawableCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
@@ -54,7 +56,7 @@ public class KAlertDialog extends AlertDialog implements View.OnClickListener {
private ImageView mErrorX, mSuccessTick, mCustomImage, mCustomBigImage;
private Drawable mCustomImgDrawable;
private AppCompatButton mConfirmButton, mCancelButton;
- private Drawable mColor, mCancelColor;
+ private Drawable mConfirmButtonDrawable, mCancelButtonDrawable;
private View mDialogView;
private FrameLayout mCustomViewContainer;
//private ViewTreeObserver mCancelButtonObserver, mConfirmButtonObserver;
@@ -156,8 +158,8 @@ protected void onCreate(Bundle savedInstanceState) {
setCancelText(mCancelText, cancelTextColor);
setConfirmText(mConfirmText);
setConfirmText(mConfirmText, confirmTextColor);
- setConfirmButtonColor(mColor);
- setCancelButtonColor(mCancelColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
+ setCancelButtonDrawable(mCancelButtonDrawable);
//setButtonMatchingHeight();
changeAlertType(mAlertType, true);
setInputFieldHint(mInputFieldHint);
@@ -243,37 +245,37 @@ private void changeAlertType(int alertType, boolean fromCreate) {
}
switch (mAlertType) {
case NORMAL_TYPE:
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case ERROR_TYPE:
mErrorFrame.setVisibility(View.VISIBLE);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case SUCCESS_TYPE:
mSuccessFrame.setVisibility(View.VISIBLE);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case WARNING_TYPE:
mWarningFrame.setVisibility(View.VISIBLE);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case CUSTOM_IMAGE_TYPE:
setCustomImage1(mCustomImgDrawable);
setCustomImageColorFilter(drawableColor);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case URL_IMAGE_TYPE:
setURLImage1(imageURL, displayType);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case PROGRESS_TYPE:
mProgressFrame.setVisibility(View.VISIBLE);
mConfirmButton.setVisibility(GONE);
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
case INPUT_TYPE:
showInputView();
- setConfirmButtonColor(mColor);
+ setConfirmButtonDrawable(mConfirmButtonDrawable);
break;
}
if (!fromCreate) {
@@ -695,18 +697,32 @@ public void cancel() {
dismissWithAnimation(true);
}
- private KAlertDialog setConfirmButtonColor(Drawable background) {
- mColor = background;
- if (mConfirmButton != null && mColor != null) {
- mConfirmButton.setBackground(mColor);
+ private KAlertDialog setConfirmButtonColor(@ColorInt int tintColor) {
+ if (mConfirmButton != null) {
+ DrawableCompat.setTint(mConfirmButton.getBackground(), tintColor);
+ }
+ return this;
+ }
+
+ private KAlertDialog setCancelButtonColor(@ColorInt int tintColor) {
+ if (mCancelButton != null) {
+ DrawableCompat.setTint(mCancelButton.getBackground(), tintColor);
}
return this;
}
- private KAlertDialog setCancelButtonColor(Drawable background) {
- mCancelColor = background;
- if (mCancelButton != null && mCancelColor != null) {
- mCancelButton.setBackground(mCancelColor);
+ private KAlertDialog setConfirmButtonDrawable(Drawable background) {
+ mConfirmButtonDrawable = background;
+ if (mConfirmButton != null && mConfirmButtonDrawable != null) {
+ mConfirmButton.setBackground(mConfirmButtonDrawable);
+ }
+ return this;
+ }
+
+ private KAlertDialog setCancelButtonDrawable(Drawable background) {
+ mCancelButtonDrawable = background;
+ if (mCancelButton != null && mCancelButtonDrawable != null) {
+ mCancelButton.setBackground(mCancelButtonDrawable);
}
return this;
}
@@ -807,21 +823,20 @@ public KAlertDialog setConfirmText(String text, int color) {
return this;
}
-
public KAlertDialog confirmButtonColor(int color) {
- //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- return setConfirmButtonColor(ContextCompat.getDrawable(context, color));
- //}else {
- //return setConfirmButtonColor(ContextCompat.getDrawable(context, color));
- //}
+ return setConfirmButtonColor(color);
+ }
+
+ public KAlertDialog confirmButtonDrawable(int drawableResId) {
+ return setConfirmButtonDrawable(ContextCompat.getDrawable(context, drawableResId));
}
public KAlertDialog cancelButtonColor(int color) {
- //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- return setCancelButtonColor(ContextCompat.getDrawable(context, color));
- //}else {
- //return setCancelButtonColor(getContext().getResources().getDrawable(color));
- //}
+ return setCancelButtonColor(color);
+ }
+
+ public KAlertDialog cancelButtonDrawable(int drawableResId) {
+ return setCancelButtonDrawable(ContextCompat.getDrawable(context, drawableResId));
}
public KAlertDialog setTitleColor(int color) {