Search in sources :

Example 6 with MapLayers

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);
}
Also used : BaseOsmAndFragment(net.osmand.plus.base.BaseOsmAndFragment) BaseSettingsFragment(net.osmand.plus.settings.fragments.BaseSettingsFragment) TargetPoint(net.osmand.plus.helpers.TargetPointsHelper.TargetPoint) QuadPoint(net.osmand.data.QuadPoint) NewGpxPoint(net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint) MapLayers(net.osmand.plus.views.MapLayers) TopToolbarController(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController)

Example 7 with MapLayers

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));
    }
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) MapInfoLayer(net.osmand.plus.views.layers.MapInfoLayer) MapActivity(net.osmand.plus.activities.MapActivity) MapLayers(net.osmand.plus.views.MapLayers)

Example 8 with MapLayers

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);
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) MapInfoLayer(net.osmand.plus.views.layers.MapInfoLayer) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) View(android.view.View) MapActivity(net.osmand.plus.activities.MapActivity) MapLayers(net.osmand.plus.views.MapLayers)

Aggregations

MapLayers (net.osmand.plus.views.MapLayers)8 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)5 MapControlsLayer (net.osmand.plus.views.layers.MapControlsLayer)4 View (android.view.View)3 MapActivity (net.osmand.plus.activities.MapActivity)3 ITileSource (net.osmand.map.ITileSource)2 MapInfoLayer (net.osmand.plus.views.layers.MapInfoLayer)2 MapTileLayer (net.osmand.plus.views.layers.MapTileLayer)2 ArrayAdapter (android.widget.ArrayAdapter)1 StringRes (androidx.annotation.StringRes)1 QuadPoint (net.osmand.data.QuadPoint)1 ContextMenuAdapter (net.osmand.plus.ContextMenuAdapter)1 ContextMenuItem (net.osmand.plus.ContextMenuItem)1 LockableScrollView (net.osmand.plus.LockableScrollView)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 BaseOsmAndFragment (net.osmand.plus.base.BaseOsmAndFragment)1 TargetPoint (net.osmand.plus.helpers.TargetPointsHelper.TargetPoint)1 LayerTransparencySeekbarMode (net.osmand.plus.plugins.rastermaps.LayerTransparencySeekbarMode)1 OsmandRasterMapsPlugin (net.osmand.plus.plugins.rastermaps.OsmandRasterMapsPlugin)1 OnMapSelectedCallback (net.osmand.plus.plugins.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback)1