Use constant instead of hardcode

This commit is contained in:
Alex Sytnyk 2018-10-25 11:31:05 +03:00
parent 180a26077f
commit 3eb6f10a5d
6 changed files with 9 additions and 6 deletions

View file

@ -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) {

View file

@ -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);

View file

@ -634,7 +634,7 @@ public class TrackDetailsMenu {
@Override
public int getStatusBarColor(Context context, boolean night) {
return -1;
return NO_COLOR;
}
}

View file

@ -969,7 +969,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
@Override
public int getStatusBarColor(Context context, boolean night) {
return -1;
return NO_COLOR;
}
}
}

View file

@ -1583,7 +1583,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
@Override
public int getStatusBarColor(Context context, boolean night) {
return -1;
return NO_COLOR;
}
}
}

View file

@ -218,6 +218,9 @@ public class MapInfoWidgetsFactory {
}
public static class TopToolbarController {
public static final int NO_COLOR = -1;
private TopToolbarControllerType type;
@ColorRes