Search in sources :

Example 6 with MapControlsLayer

use of net.osmand.plus.views.layers.MapControlsLayer 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 7 with MapControlsLayer

use of net.osmand.plus.views.layers.MapControlsLayer in project Osmand by osmandapp.

the class LauncherShortcutsHelper method navigateTo.

private void navigateTo(@NonNull MapActivity mapActivity, @Nullable FavouritePoint point) {
    if (point == null) {
        MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
        if (mapControlsLayer != null) {
            mapControlsLayer.doRoute(false);
        }
    } else {
        app.getRoutingHelper().setRoutePlanningMode(true);
        LatLon latLon = new LatLon(point.getLatitude(), point.getLongitude());
        PointDescription description = point.getPointDescription(app);
        app.getTargetPointsHelper().navigateToPoint(latLon, true, -1, description);
        OsmAndLocationProvider.requestFineLocationPermissionIfNeeded(mapActivity);
    }
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) LatLon(net.osmand.data.LatLon) PointDescription(net.osmand.data.PointDescription)

Example 8 with MapControlsLayer

use of net.osmand.plus.views.layers.MapControlsLayer 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)

Example 9 with MapControlsLayer

use of net.osmand.plus.views.layers.MapControlsLayer in project Osmand by osmandapp.

the class ChooseRouteFragment method onDestroyView.

@Override
public void onDestroyView() {
    super.onDestroyView();
    MapActivity mapActivity = getMapActivity();
    if (mapActivity != null) {
        MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
        mapControlsLayer.removeHudButtons(Arrays.asList(ZOOM_IN_BUTTON_ID, ZOOM_OUT_BUTTON_ID, BACK_TO_LOC_BUTTON_ID));
    }
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) MapActivity(net.osmand.plus.activities.MapActivity)

Example 10 with MapControlsLayer

use of net.osmand.plus.views.layers.MapControlsLayer in project Osmand by osmandapp.

the class ChooseRouteFragment method buildZoomButtons.

private void buildZoomButtons(@NonNull View view) {
    MapActivity mapActivity = getMapActivity();
    if (mapActivity == null) {
        return;
    }
    // Zoom buttons
    View zoomButtonsView = view.findViewById(R.id.map_hud_controls);
    this.zoomButtonsView = zoomButtonsView;
    ImageButton zoomInButton = view.findViewById(R.id.map_zoom_in_button);
    ImageButton zoomOutButton = view.findViewById(R.id.map_zoom_out_button);
    ImageButton backToLocation = view.findViewById(R.id.map_my_location_button);
    OsmandMapTileView mapTileView = mapActivity.getMapView();
    View.OnLongClickListener longClickListener = MapControlsLayer.getOnClickMagnifierListener(mapTileView);
    MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
    mapControlsLayer.setupZoomInButton(zoomInButton, longClickListener, ZOOM_IN_BUTTON_ID);
    mapControlsLayer.setupZoomOutButton(zoomOutButton, longClickListener, ZOOM_OUT_BUTTON_ID);
    mapControlsLayer.setupBackToLocationButton(backToLocation, false, BACK_TO_LOC_BUTTON_ID);
    AndroidUiHelper.updateVisibility(zoomButtonsView, true);
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) ImageButton(android.widget.ImageButton) AppCompatImageButton(androidx.appcompat.widget.AppCompatImageButton) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) ImageView(android.widget.ImageView) View(android.view.View) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

MapControlsLayer (net.osmand.plus.views.layers.MapControlsLayer)10 MapActivity (net.osmand.plus.activities.MapActivity)5 MapLayers (net.osmand.plus.views.MapLayers)4 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)4 View (android.view.View)3 MapInfoLayer (net.osmand.plus.views.layers.MapInfoLayer)3 LatLon (net.osmand.data.LatLon)2 Intent (android.content.Intent)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 AppCompatImageButton (androidx.appcompat.widget.AppCompatImageButton)1 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)1 FavouritePoint (net.osmand.data.FavouritePoint)1 PointDescription (net.osmand.data.PointDescription)1 ItemClickListener (net.osmand.plus.ContextMenuAdapter.ItemClickListener)1 ContextMenuItem (net.osmand.plus.ContextMenuItem)1 ItemBuilder (net.osmand.plus.ContextMenuItem.ItemBuilder)1 LockableScrollView (net.osmand.plus.LockableScrollView)1 IndexItem (net.osmand.plus.download.IndexItem)1 FirstUsageWizardFragment (net.osmand.plus.firstusage.FirstUsageWizardFragment)1