use of net.osmand.plus.views.MapLayers in project Osmand by osmandapp.
the class MapActivity method updateStatusBarColor.
public void updateStatusBarColor() {
int colorId = -1;
MapLayers mapLayers = getMapLayers();
BaseOsmAndFragment fragmentAboveDashboard = getVisibleBaseOsmAndFragment(R.id.fragmentContainer);
BaseSettingsFragment settingsFragmentAboveDashboard = getVisibleBaseSettingsFragment(R.id.fragmentContainer);
BaseOsmAndFragment fragmentBelowDashboard = getVisibleBaseOsmAndFragment(R.id.routeMenuContainer, R.id.topFragmentContainer, R.id.bottomFragmentContainer);
if (fragmentAboveDashboard != null) {
colorId = fragmentAboveDashboard.getStatusBarColorId();
} else if (settingsFragmentAboveDashboard != null) {
colorId = settingsFragmentAboveDashboard.getStatusBarColorId();
} else if (dashboardOnMap.isVisible()) {
colorId = dashboardOnMap.getStatusBarColor();
} else if (fragmentBelowDashboard != null) {
colorId = fragmentBelowDashboard.getStatusBarColorId();
} else if (mapLayers.getMapQuickActionLayer() != null && mapLayers.getMapQuickActionLayer().isWidgetVisible()) {
colorId = R.color.status_bar_transparent_gradient;
}
if (colorId != -1) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorId));
return;
}
int color = TopToolbarController.NO_COLOR;
boolean mapControlsVisible = findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE;
boolean topToolbarVisible = getMapLayers().getMapInfoLayer().isTopToolbarViewVisible();
boolean night = app.getDaynightHelper().isNightModeForMapControls();
TopToolbarController toolbarController = getMapLayers().getMapInfoLayer().getTopToolbarController();
if (toolbarController != null && mapControlsVisible && topToolbarVisible) {
color = toolbarController.getStatusBarColor(this, night);
}
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;
boolean coordinatesTopBar = findViewById(R.id.coordinates_top_bar).getVisibility() == View.VISIBLE;
if (coordinatesTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_main_dark : R.color.status_bar_main_dark;
} else if (mapTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (markerTopBar && mapControlsVisible) {
colorId = R.color.status_bar_color_dark;
} else {
colorId = night ? R.color.status_bar_transparent_dark : R.color.status_bar_transparent_light;
}
color = ContextCompat.getColor(this, colorId);
}
getWindow().setStatusBarColor(color);
}
use of net.osmand.plus.views.MapLayers in project Osmand by osmandapp.
the class ContextMenuScrollFragment method onDestroyView.
@Override
public void onDestroyView() {
super.onDestroyView();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
MapLayers mapLayers = mapActivity.getMapLayers();
MapControlsLayer mapControlsLayer = mapLayers.getMapControlsLayer();
mapControlsLayer.removeHudButtons(Arrays.asList(ZOOM_IN_BUTTON_ID, ZOOM_OUT_BUTTON_ID, BACK_TO_LOC_BUTTON_ID));
MapInfoLayer mapInfoLayer = mapLayers.getMapInfoLayer();
mapInfoLayer.removeRulerWidgets(Collections.singletonList(rulerWidget));
}
}
use of net.osmand.plus.views.MapLayers in project Osmand by osmandapp.
the class SnapTrackWarningFragment method setupControlButtons.
private void setupControlButtons(@NonNull View view) {
MapActivity mapActivity = getMapActivity();
View zoomInButtonView = view.findViewById(R.id.map_zoom_in_button);
View zoomOutButtonView = view.findViewById(R.id.map_zoom_out_button);
View myLocButtonView = view.findViewById(R.id.map_my_location_button);
View mapRulerView = view.findViewById(R.id.map_ruler_layout);
MapLayers mapLayers = mapActivity.getMapLayers();
OsmandMapTileView mapTileView = mapActivity.getMapView();
View.OnLongClickListener longClickListener = MapControlsLayer.getOnClickMagnifierListener(mapTileView);
MapControlsLayer mapControlsLayer = mapLayers.getMapControlsLayer();
mapControlsLayer.setupZoomInButton(zoomInButtonView, longClickListener, ZOOM_IN_BUTTON_ID);
mapControlsLayer.setupZoomOutButton(zoomOutButtonView, longClickListener, ZOOM_OUT_BUTTON_ID);
mapControlsLayer.setupBackToLocationButton(myLocButtonView, false, BACK_TO_LOC_BUTTON_ID);
MapInfoLayer mapInfoLayer = mapLayers.getMapInfoLayer();
mapInfoLayer.setupRulerWidget(mapRulerView);
}
Aggregations