From 3eb6f10a5d2fbc2e5974eece9b58ccc980bd0be0 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Thu, 25 Oct 2018 11:31:05 +0300 Subject: [PATCH] Use constant instead of hardcode --- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 4 ++-- OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java | 2 +- .../osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java | 2 +- OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 2 +- .../osmand/plus/measurementtool/MeasurementToolFragment.java | 2 +- .../osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java | 3 +++ 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 2b27d6963b..7f15f47692 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -859,14 +859,14 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven getWindow().setStatusBarColor(ContextCompat.getColor(this, colorId)); return; } - int color = -1; + int color = TopToolbarController.NO_COLOR; boolean mapControlsVisible = findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE; boolean night = app.getDaynightHelper().isNightModeForMapControls(); TopToolbarController toolbarController = getMapLayers().getMapInfoLayer().getTopToolbarController(); if (toolbarController != null && mapControlsVisible) { color = toolbarController.getStatusBarColor(this, night); } - if (color == -1) { + if (color == TopToolbarController.NO_COLOR) { boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE; boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE; if (mapTopBar && mapControlsVisible) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java index beb4c5daba..0585ff1b45 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java @@ -333,7 +333,7 @@ public class DiscountHelper { public static class DiscountBarController extends TopToolbarController { - private int statusBarColor = -1; + private int statusBarColor = NO_COLOR; DiscountBarController() { super(TopToolbarControllerType.DISCOUNT); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index 1841a03a62..75de1fac5d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -634,7 +634,7 @@ public class TrackDetailsMenu { @Override public int getStatusBarColor(Context context, boolean night) { - return -1; + return NO_COLOR; } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index a64608fd90..deb525d6b8 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -969,7 +969,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat @Override public int getStatusBarColor(Context context, boolean night) { - return -1; + return NO_COLOR; } } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index bca4a93a86..9e34b5bbd4 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1583,7 +1583,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { @Override public int getStatusBarColor(Context context, boolean night) { - return -1; + return NO_COLOR; } } } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 9c0aba6baa..a5376dd5eb 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -218,6 +218,9 @@ public class MapInfoWidgetsFactory { } public static class TopToolbarController { + + public static final int NO_COLOR = -1; + private TopToolbarControllerType type; @ColorRes