From 86d5bea322f792861dcfd8d865cbb47f230b6415 Mon Sep 17 00:00:00 2001 From: Nazar Date: Mon, 7 Oct 2019 16:23:27 +0300 Subject: [PATCH] Fix setupDialogButton --- OsmAnd/src/net/osmand/plus/UiUtilities.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index 9802be2854..e62507ce44 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -357,14 +357,16 @@ public class UiUtilities { textAndIconColorResId = nightMode ? R.color.dlg_btn_secondary_text_dark : R.color.dlg_btn_secondary_text_light; break; } - ColorStateList colorStateList = ContextCompat.getColorStateList(ctx, textAndIconColorResId); - buttonTextView.setText(buttonText); - buttonTextView.setTextColor(colorStateList); - buttonTextView.setEnabled(buttonView.isEnabled()); - if (iconResId != INVALID_ID) { - Drawable icon = tintDrawable(ContextCompat.getDrawable(ctx, iconResId), ContextCompat.getColor(ctx, textAndIconColorResId)); - buttonTextView.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); - buttonTextView.setCompoundDrawablePadding(AndroidUtils.dpToPx(ctx, ctx.getResources().getDimension(R.dimen.content_padding_half))); + if (textAndIconColorResId != INVALID_ID) { + ColorStateList colorStateList = ContextCompat.getColorStateList(ctx, textAndIconColorResId); + buttonTextView.setText(buttonText); + buttonTextView.setTextColor(colorStateList); + buttonTextView.setEnabled(buttonView.isEnabled()); + if (iconResId != INVALID_ID) { + Drawable icon = tintDrawable(ContextCompat.getDrawable(ctx, iconResId), ContextCompat.getColor(ctx, textAndIconColorResId)); + buttonTextView.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); + buttonTextView.setCompoundDrawablePadding(AndroidUtils.dpToPx(ctx, ctx.getResources().getDimension(R.dimen.content_padding_half))); + } } }