From 533571724b2a338233401c326007e3bbb0c38316 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Wed, 15 Jan 2020 19:08:25 +0200 Subject: [PATCH] Fix heading icon color on ProfileAppearanceFragment --- .../plus/settings/ProfileAppearanceFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java index ade7f3adde..f654d3eed9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Matrix; import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; @@ -413,6 +414,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { updateColorSelector(colorRes); updatePreference(findPreference(MASTER_PROFILE)); updatePreference(findPreference(LOCATION_ICON_ITEMS)); + updatePreference(findPreference(NAV_ICON_ITEMS)); } } }); @@ -486,12 +488,14 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { private View createLocationIconView(final ApplicationMode.LocationIcon locationIcon, ViewGroup rootView) { FrameLayout locationIconView = (FrameLayout) UiUtilities.getInflater(getContext(), isNightMode()) .inflate(R.layout.preference_select_icon_button, rootView, false); + int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor( + app.getDaynightHelper().isNightModeForMapControls())); LayerDrawable locationIconDrawable = (LayerDrawable) app.getResources().getDrawable(locationIcon.getIconId()); - DrawableCompat.setTint(locationIconDrawable.getDrawable(1), ContextCompat.getColor(app, changedProfile.color.getColor( - app.getDaynightHelper().isNightModeForMapControls()))); + DrawableCompat.setTint(locationIconDrawable.getDrawable(1), changedProfileColor); locationIconView.findViewById(R.id.icon).setImageDrawable(locationIconDrawable); - locationIconView.findViewById(R.id.headingIcon) - .setImageDrawable(ContextCompat.getDrawable(app, locationIcon.getHeadingIconId())); + ImageView headingIcon = locationIconView.findViewById(R.id.headingIcon); + headingIcon.setImageDrawable(ContextCompat.getDrawable(app, locationIcon.getHeadingIconId())); + headingIcon.setColorFilter(new PorterDuffColorFilter(changedProfileColor, PorterDuff.Mode.SRC_IN)); ImageView coloredRect = locationIconView.findViewById(R.id.backgroundRect); AndroidUtils.setBackground(coloredRect, UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_select_icon_button), @@ -506,8 +510,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { }); ImageView outlineRect = locationIconView.findViewById(R.id.outlineRect); GradientDrawable rectContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.bg_select_icon_button_outline); - int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor( - app.getDaynightHelper().isNightModeForMapControls())); if (rectContourDrawable != null) { rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 2), changedProfileColor); }