From d9a69dd154b7588f7cf55baf80676f451e6f4867 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Thu, 25 Mar 2021 16:17:14 +0200 Subject: [PATCH 1/2] Use different colors for route line appearance --- .../plus/routing/RouteLineDrawInfo.java | 66 ++++++++++++++----- .../routing/cards/RouteLineColorCard.java | 58 +++++++++++----- .../routing/cards/RouteLineWidthCard.java | 15 ++--- .../plus/settings/backend/OsmandSettings.java | 2 + .../fragments/ProfileAppearanceFragment.java | 30 ++++++--- .../RouteLineAppearanceFragment.java | 5 ++ .../src/net/osmand/plus/track/ColorsCard.java | 1 + .../osmand/plus/views/layers/RouteLayer.java | 13 ++-- 8 files changed, 137 insertions(+), 53 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteLineDrawInfo.java b/OsmAnd/src/net/osmand/plus/routing/RouteLineDrawInfo.java index 92cb926fa1..838e553b5b 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteLineDrawInfo.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteLineDrawInfo.java @@ -10,17 +10,20 @@ import net.osmand.util.Algorithms; public class RouteLineDrawInfo { - private static final String LINE_COLOR = "line_color"; + private static final String LINE_COLOR_DAY = "line_color_day"; + private static final String LINE_COLOR_NIGHT = "line_color_night"; private static final String LINE_WIDTH = "line_width"; private static final String NAVIGATION_ICON_ID = "navigation_icon_id"; private static final String NAVIGATION_ICON_COLOR = "navigation_icon_color"; private static final String CENTER_X = "center_x"; private static final String CENTER_Y = "center_y"; private static final String SCREEN_HEIGHT = "screen_height"; + private static final String USE_DEFAULT_COLOR = "use_default_color"; // parameters to save @ColorInt - private Integer color; + private Integer colorDay; + private Integer colorNight; private String width; // temporally parameters to show in preview @@ -30,10 +33,13 @@ public class RouteLineDrawInfo { private int centerX; private int centerY; private int screenHeight; + private boolean useDefaultColor; - public RouteLineDrawInfo(@Nullable @ColorInt Integer color, + public RouteLineDrawInfo(@Nullable @ColorInt Integer colorDay, + @Nullable @ColorInt Integer colorNight, @Nullable String width) { - this.color = color; + this.colorDay = colorDay; + this.colorNight = colorNight; this.width = width; } @@ -42,17 +48,27 @@ public class RouteLineDrawInfo { } public RouteLineDrawInfo(@NonNull RouteLineDrawInfo existed) { - this.color = existed.color; + this.colorDay = existed.colorDay; + this.colorNight = existed.colorNight; this.width = existed.width; this.iconId = existed.iconId; this.iconColor = existed.iconColor; this.centerX = existed.centerX; this.centerY = existed.centerY; this.screenHeight = existed.screenHeight; + this.useDefaultColor = existed.useDefaultColor; } - public void setColor(@Nullable Integer color) { - this.color = color; + public void setColor(@ColorInt int color, boolean nightMode) { + if (nightMode) { + colorNight = color; + } else { + colorDay = color; + } + } + + public void setUseDefaultColor(boolean useDefaultColor) { + this.useDefaultColor = useDefaultColor; } public void setWidth(@Nullable String width) { @@ -80,8 +96,16 @@ public class RouteLineDrawInfo { } @Nullable - public Integer getColor() { - return color; + public Integer getColor(boolean nightMode) { + if (!useDefaultColor) { + return getColorIgnoreDefault(nightMode); + } + return null; + } + + @Nullable + public Integer getColorIgnoreDefault(boolean nightMode) { + return nightMode ? colorNight : colorDay; } @Nullable @@ -111,8 +135,11 @@ public class RouteLineDrawInfo { } private void readBundle(@NonNull Bundle bundle) { - if (bundle.containsKey(LINE_COLOR)) { - color = bundle.getInt(LINE_COLOR); + if (bundle.containsKey(LINE_COLOR_DAY)) { + colorDay = bundle.getInt(LINE_COLOR_DAY); + } + if (bundle.containsKey(LINE_COLOR_NIGHT)) { + colorNight = bundle.getInt(LINE_COLOR_NIGHT); } width = bundle.getString(LINE_WIDTH); iconId = bundle.getInt(NAVIGATION_ICON_ID); @@ -120,11 +147,15 @@ public class RouteLineDrawInfo { centerX = bundle.getInt(CENTER_X); centerY = bundle.getInt(CENTER_Y); screenHeight = bundle.getInt(SCREEN_HEIGHT); + useDefaultColor = bundle.getBoolean(USE_DEFAULT_COLOR); } public void saveToBundle(@NonNull Bundle bundle) { - if (color != null) { - bundle.putInt(LINE_COLOR, color); + if (colorDay != null) { + bundle.putInt(LINE_COLOR_DAY, colorDay); + } + if (colorNight != null) { + bundle.putInt(LINE_COLOR_NIGHT, colorNight); } if (width != null) { bundle.putString(LINE_WIDTH, width); @@ -134,6 +165,7 @@ public class RouteLineDrawInfo { bundle.putInt(CENTER_X, centerX); bundle.putInt(CENTER_Y, centerY); bundle.putInt(SCREEN_HEIGHT, screenHeight); + bundle.putBoolean(USE_DEFAULT_COLOR, useDefaultColor); } @Override @@ -143,13 +175,15 @@ public class RouteLineDrawInfo { RouteLineDrawInfo that = (RouteLineDrawInfo) o; - if (!Algorithms.objectEquals(getColor(), that.getColor())) return false; - return Algorithms.objectEquals(getWidth(), that.getWidth()); + if (!Algorithms.objectEquals(colorDay, that.colorDay)) return false; + if (!Algorithms.objectEquals(colorNight, that.colorNight)) return false; + return Algorithms.objectEquals(width, that.width); } @Override public int hashCode() { - int result = color != null ? color.hashCode() : 0; + int result = colorDay != null ? colorDay.hashCode() : 0; + result = 31 * result + (colorNight != null ? colorNight.hashCode() : 0); result = 31 * result + (width != null ? width.hashCode() : 0); return result; } diff --git a/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineColorCard.java b/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineColorCard.java index 3eabe283e3..d8abad16e4 100644 --- a/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineColorCard.java +++ b/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineColorCard.java @@ -10,6 +10,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; @@ -22,7 +23,6 @@ import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.ColorDialogs; import net.osmand.plus.helpers.enums.DayNightMode; -import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.routing.RouteLineDrawInfo; @@ -110,7 +110,7 @@ public class RouteLineColorCard extends BaseCard implements CardListener, ColorP } private void initSelectedMode() { - selectedMode = routeLineDrawInfo.getColor() == null ? ColorMode.DEFAULT : ColorMode.CUSTOM; + selectedMode = getRouteLineColor() == null ? ColorMode.DEFAULT : ColorMode.CUSTOM; modeChanged(); } @@ -118,13 +118,15 @@ public class RouteLineColorCard extends BaseCard implements CardListener, ColorP if (selectedMode == ColorMode.DEFAULT) { themeToggleContainer.setVisibility(View.GONE); cardsContainer.setVisibility(View.GONE); + routeLineDrawInfo.setUseDefaultColor(true); changeMapTheme(initMapTheme); } else { themeToggleContainer.setVisibility(View.VISIBLE); cardsContainer.setVisibility(View.VISIBLE); + routeLineDrawInfo.setUseDefaultColor(false); changeMapTheme(isNightMap() ? DayNightMode.NIGHT : DayNightMode.DAY); } - updateSelectedColor(); + updateColorItems(); updateDescription(); } @@ -156,6 +158,12 @@ public class RouteLineColorCard extends BaseCard implements CardListener, ColorP if (targetFragment instanceof OnMapThemeUpdateListener) { ((OnMapThemeUpdateListener) targetFragment).onMapThemeUpdated(mapTheme); } + if (selectedMode == ColorMode.CUSTOM) { + Integer color = getRouteLineColor(); + if (color != null) { + colorsCard.setSelectedColor(color); + } + } } private void createColorSelector(ViewGroup container) { @@ -165,14 +173,9 @@ public class RouteLineColorCard extends BaseCard implements CardListener, ColorP for (int color : ColorDialogs.pallette) { colors.add(color); } - Integer selectedColor = routeLineDrawInfo.getColor(); - if (selectedColor != null) { - if (!ColorDialogs.isPaletteColor(selectedColor)) { - colors.add(selectedColor); - } - } else { - selectedColor = colors.get(0); - } + int selectedColorDay = getSelectedColorForTheme(colors, false); + int selectedColorNight = getSelectedColorForTheme(colors, true); + int selectedColor = isNightMap() ? selectedColorNight : selectedColorDay; ListStringPreference preference = app.getSettings().CUSTOM_ROUTE_LINE_COLORS; colorsCard = new ColorsCard(mapActivity, selectedColor, targetFragment, colors, preference, null); colorsCard.setListener(this); @@ -180,26 +183,49 @@ public class RouteLineColorCard extends BaseCard implements CardListener, ColorP } } + private int getSelectedColorForTheme(List colors, boolean nightMode) { + Integer color = routeLineDrawInfo.getColorIgnoreDefault(nightMode); + if (color != null) { + if (!ColorDialogs.isPaletteColor(color)) { + colors.add(color); + } + } else { + color = colors.get(0); + routeLineDrawInfo.setUseDefaultColor(true); + routeLineDrawInfo.setColor(color, nightMode); + } + return color; + } + @Override public void onColorSelected(Integer prevColor, int newColor) { colorsCard.onColorSelected(prevColor, newColor); updateSelectedColor(); } + @Nullable + private Integer getRouteLineColor() { + return routeLineDrawInfo.getColor(isNightMap()); + } + private void updateSelectedColor() { - Integer color = selectedMode == ColorMode.CUSTOM ? colorsCard.getSelectedColor() : null; - routeLineDrawInfo.setColor(color); - updateColorName(); + int selectedColor = colorsCard.getSelectedColor(); + routeLineDrawInfo.setColor(selectedColor, isNightMap()); + updateColorItems(); + } + + private void updateColorItems() { if (targetFragment instanceof OnSelectedColorChangeListener) { ((OnSelectedColorChangeListener) targetFragment).onSelectedColorChanged(); } + updateColorName(); } private void updateColorName() { if (selectedMode == ColorMode.DEFAULT) { tvColorName.setText(app.getString(R.string.map_widget_renderer)); - } else if (routeLineDrawInfo.getColor() != null) { - int colorNameId = ColorDialogs.getColorName(routeLineDrawInfo.getColor()); + } else if (getRouteLineColor() != null) { + int colorNameId = ColorDialogs.getColorName(getRouteLineColor()); tvColorName.setText(app.getString(colorNameId)); } } diff --git a/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineWidthCard.java b/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineWidthCard.java index 95c20783a4..72055da936 100644 --- a/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineWidthCard.java +++ b/OsmAnd/src/net/osmand/plus/routing/cards/RouteLineWidthCard.java @@ -24,7 +24,6 @@ import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routing.RouteLineDrawInfo; import net.osmand.plus.track.AppearanceViewHolder; @@ -201,6 +200,10 @@ public class RouteLineWidthCard extends BaseCard { return WidthMode.DEFAULT; } + private boolean isNightMode() { + return app.getDaynightHelper().isNightModeForMapControls(); + } + private class WidthAdapter extends RecyclerView.Adapter { private final List items = Arrays.asList(WidthMode.values()); @@ -268,13 +271,9 @@ public class RouteLineWidthCard extends BaseCard { } private int getIconColor(@NonNull WidthMode mode, @ColorInt int defaultColor) { - return mode.widthKey != null ? getRouteLineColor() : defaultColor; - } - - private int getRouteLineColor() { - Integer color = routeLineDrawInfo.getColor(); - return color != null ? color : - mapActivity.getMapLayers().getRouteLayer().getRouteLineColor(nightMode); + return mode.widthKey != null ? + mapActivity.getMapLayers().getRouteLayer().getRouteLineColor(isNightMode()) : + defaultColor; } private void updateButtonBg(AppearanceViewHolder holder, WidthMode item) { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 5fbc34e674..b5ea05fb09 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -2691,8 +2691,10 @@ public class OsmandSettings { public final CommonPreference ROUTE_RECALCULATION_DISTANCE = new FloatPreference(this, "routing_recalc_distance", 0.f).makeProfile(); public final CommonPreference ROUTE_STRAIGHT_ANGLE = new FloatPreference(this, "routing_straight_angle", 30.f).makeProfile(); + public final ListStringPreference CUSTOM_ROUTE_LINE_COLORS = (ListStringPreference) new ListStringPreference(this, "custom_route_line_colors", null, ",").makeShared().makeGlobal(); public final CommonPreference ROUTE_LINE_COLOR = new IntPreference(this, "route_line_color", 0).makeProfile(); + public final CommonPreference ROUTE_LINE_COLOR_NIGHT = new IntPreference(this, "route_line_color_night", 0).makeProfile(); public final CommonPreference ROUTE_LINE_WIDTH = new StringPreference(this, "route_line_width", null).makeProfile(); public final OsmandPreference USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference(this, "enable_osmc_routing", true).makeProfile(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java index f4b38a32b8..01d9229eb0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java @@ -1019,23 +1019,35 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O } private RouteLineDrawInfo createRouteLineDrawInfo(@NonNull ApplicationMode appMode) { - int storedValue = settings.ROUTE_LINE_COLOR.getModeValue(appMode); - Integer color = storedValue != 0 ? storedValue : null; + Integer colorDay = getRouteLineColor(appMode, settings.ROUTE_LINE_COLOR); + Integer colorNight = getRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_NIGHT); String widthKey = settings.ROUTE_LINE_WIDTH.getModeValue(appMode); - return new RouteLineDrawInfo(color, widthKey); + return new RouteLineDrawInfo(colorDay, colorNight, widthKey); + } + + private Integer getRouteLineColor(@NonNull ApplicationMode appMode, + @NonNull CommonPreference preference) { + int storedValue = preference.getModeValue(appMode); + return storedValue != 0 ? storedValue : null; } private void saveRouteLineAppearance(@NonNull ApplicationMode appMode, @NonNull RouteLineDrawInfo drawInfo) { - Integer color = drawInfo.getColor(); - if (color != null) { - settings.ROUTE_LINE_COLOR.setModeValue(appMode, color); - } else { - settings.ROUTE_LINE_COLOR.resetModeToDefault(appMode); - } + saveRouteLineColor(appMode, settings.ROUTE_LINE_COLOR, drawInfo.getColor(false)); + saveRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_NIGHT, drawInfo.getColor(true)); settings.ROUTE_LINE_WIDTH.setModeValue(appMode, drawInfo.getWidth()); } + private void saveRouteLineColor(@NonNull ApplicationMode appMode, + @NonNull CommonPreference preference, + @Nullable @ColorInt Integer color) { + if (color != null) { + preference.setModeValue(appMode, color); + } else { + preference.resetModeToDefault(appMode); + } + } + public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable String appMode, boolean imported) { try { Fragment fragment = Fragment.instantiate(activity, screenType.fragmentName); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteLineAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteLineAppearanceFragment.java index b0587eacde..2975815bb4 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteLineAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteLineAppearanceFragment.java @@ -385,6 +385,10 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple @Override public void onSelectedColorChanged() { + updateColorItems(); + } + + private void updateColorItems() { if (widthCard != null) { widthCard.updateItems(); } @@ -415,6 +419,7 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple @Override public void onMapThemeUpdated(@NonNull DayNightMode mapTheme) { changeMapTheme(mapTheme); + updateColorItems(); } private void changeMapTheme(@NonNull DayNightMode mapTheme) { diff --git a/OsmAnd/src/net/osmand/plus/track/ColorsCard.java b/OsmAnd/src/net/osmand/plus/track/ColorsCard.java index 7651775f6c..dd832da27f 100644 --- a/OsmAnd/src/net/osmand/plus/track/ColorsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/ColorsCard.java @@ -72,6 +72,7 @@ public class ColorsCard extends BaseCard implements ColorPickerListener { public void setSelectedColor(int selectedColor) { this.selectedColor = selectedColor; + updateContent(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java index 2a432c8041..816327eda6 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java @@ -42,6 +42,7 @@ import net.osmand.plus.routing.RouteLineDrawInfo; import net.osmand.plus.routing.RouteService; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.TransportRoutingHelper; +import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.layers.geometry.PublicTransportGeometryWay; @@ -315,14 +316,16 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont QuadPoint c = tileBox.getCenterPixelPoint(); canvas.rotate(-angle, c.x, c.y); - drawRouteLinePreview(canvas, tileBox, routeLineDrawInfo); + drawRouteLinePreview(canvas, tileBox, settings, routeLineDrawInfo); canvas.rotate(angle, c.x, c.y); } } private void drawRouteLinePreview(Canvas canvas, RotatedTileBox tileBox, + DrawSettings settings, RouteLineDrawInfo drawInfo) { + updateAttrs(settings, tileBox); paintRouteLinePreview.setColor(getRouteLineColor(nightMode)); paintRouteLinePreview.setStrokeWidth(getRouteLineWidth(tileBox)); @@ -417,12 +420,14 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont public int getRouteLineColor(boolean night) { Integer color; if (routeLineDrawInfo != null) { - color = routeLineDrawInfo.getColor(); + color = routeLineDrawInfo.getColor(night); } else { - int storedValue = view.getSettings().ROUTE_LINE_COLOR.getModeValue(helper.getAppMode()); + CommonPreference colorPreference = night ? + view.getSettings().ROUTE_LINE_COLOR_NIGHT : + view.getSettings().ROUTE_LINE_COLOR; + int storedValue = colorPreference.getModeValue(helper.getAppMode()); color = storedValue != 0 ? storedValue : null; } - if (color == null) { updateAttrs(new DrawSettings(night), view.getCurrentRotatedTileBox()); color = attrs.paint.getColor(); From 483f33bccd4b9a88c974c848c2dee1b486f81424 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Thu, 25 Mar 2021 20:49:28 +0200 Subject: [PATCH 2/2] small fixes --- .../src/net/osmand/plus/settings/backend/OsmandSettings.java | 4 ++-- .../plus/settings/fragments/ProfileAppearanceFragment.java | 4 ++-- OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index b5ea05fb09..d1cd8fd622 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -2693,8 +2693,8 @@ public class OsmandSettings { public final CommonPreference ROUTE_STRAIGHT_ANGLE = new FloatPreference(this, "routing_straight_angle", 30.f).makeProfile(); public final ListStringPreference CUSTOM_ROUTE_LINE_COLORS = (ListStringPreference) new ListStringPreference(this, "custom_route_line_colors", null, ",").makeShared().makeGlobal(); - public final CommonPreference ROUTE_LINE_COLOR = new IntPreference(this, "route_line_color", 0).makeProfile(); - public final CommonPreference ROUTE_LINE_COLOR_NIGHT = new IntPreference(this, "route_line_color_night", 0).makeProfile(); + public final CommonPreference ROUTE_LINE_COLOR_DAY = new IntPreference(this, "route_line_color", 0).cache().makeProfile(); + public final CommonPreference ROUTE_LINE_COLOR_NIGHT = new IntPreference(this, "route_line_color_night", 0).cache().makeProfile(); public final CommonPreference ROUTE_LINE_WIDTH = new StringPreference(this, "route_line_width", null).makeProfile(); public final OsmandPreference USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference(this, "enable_osmc_routing", true).makeProfile(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java index 01d9229eb0..c8d600315c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java @@ -1019,7 +1019,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O } private RouteLineDrawInfo createRouteLineDrawInfo(@NonNull ApplicationMode appMode) { - Integer colorDay = getRouteLineColor(appMode, settings.ROUTE_LINE_COLOR); + Integer colorDay = getRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_DAY); Integer colorNight = getRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_NIGHT); String widthKey = settings.ROUTE_LINE_WIDTH.getModeValue(appMode); return new RouteLineDrawInfo(colorDay, colorNight, widthKey); @@ -1033,7 +1033,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O private void saveRouteLineAppearance(@NonNull ApplicationMode appMode, @NonNull RouteLineDrawInfo drawInfo) { - saveRouteLineColor(appMode, settings.ROUTE_LINE_COLOR, drawInfo.getColor(false)); + saveRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_DAY, drawInfo.getColor(false)); saveRouteLineColor(appMode, settings.ROUTE_LINE_COLOR_NIGHT, drawInfo.getColor(true)); settings.ROUTE_LINE_WIDTH.setModeValue(appMode, drawInfo.getWidth()); } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java index 816327eda6..d7393b2cc9 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java @@ -424,7 +424,7 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont } else { CommonPreference colorPreference = night ? view.getSettings().ROUTE_LINE_COLOR_NIGHT : - view.getSettings().ROUTE_LINE_COLOR; + view.getSettings().ROUTE_LINE_COLOR_DAY; int storedValue = colorPreference.getModeValue(helper.getAppMode()); color = storedValue != 0 ? storedValue : null; }