diff --git a/SJDialog/build.gradle b/SJDialog/build.gradle index 1608a82..af4aa05 100644 --- a/SJDialog/build.gradle +++ b/SJDialog/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdk 23 - versionCode 8 - versionName "1.3.1" + versionCode 9 + versionName "1.3.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java index 5857c75..07f57b5 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java @@ -118,6 +118,15 @@ public MessageDialog setButtonBackgroundResource(int drawable){ button.setBackgroundResource(drawable); return this; } + /** + * Set button color. + * @param color Color to use for tinting this drawable + * @return current class + * */ + public MessageDialog setButtonColor(int color){ + button.getBackground().setTint(color); + return this; + } public Button getButton() { return button; diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java index 278777f..62efb25 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java @@ -5,7 +5,9 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; +import android.graphics.PorterDuff; import android.graphics.drawable.ColorDrawable; +import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; @@ -13,6 +15,8 @@ import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.ColorInt; + import com.sjapps.library.R; /** @@ -211,6 +215,36 @@ public SetupDialog setDialogBackgroundResource(int drawable){ background.setBackgroundResource(drawable); return this; } + /** + * Set background color for all buttons. + * @param color Color to use for tinting buttons + * @return current class + * */ + public SetupDialog setButtonsColor(int color){ + button1.getBackground().setTint(color); + button2.getBackground().setTint(color); + return this; + } + + /** + * Set background color for left button. + * @param color Color to use for tinting this drawable + * @return current class + * */ + public SetupDialog setLeftButtonColor(int color){ + button1.getBackground().setTint(color); + return this; + } + /** + * Set background color for right button. + * @param color Color to use for tinting this drawable + * @return current class + * */ + public SetupDialog setRightButtonColor(int color){ + button2.getBackground().setTint(color); + return this; + } + /** * Set onClick listener for both buttons * @param dialogButtonEvents dialog button events