Search in sources :

Example 1 with DashboardOnMap

use of net.osmand.plus.dashboard.DashboardOnMap in project Osmand by osmandapp.

the class MapLayers method showGPXFileLayer.

public AlertDialog showGPXFileLayer(@NonNull List<String> files, final MapActivity mapActivity) {
    final OsmandSettings settings = app.getSettings();
    OsmandMapTileView mapView = mapActivity.getMapView();
    DashboardOnMap dashboard = mapActivity.getDashboard();
    CallbackWithObject<GPXFile[]> callbackWithObject = result -> {
        WptPt locToShow = null;
        for (GPXFile g : result) {
            if (g.showCurrentTrack) {
                if (!settings.SAVE_TRACK_TO_GPX.get() && !settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) {
                    app.showToastMessage(R.string.gpx_monitoring_disabled_warn);
                }
                break;
            } else {
                locToShow = g.findPointToShow();
            }
        }
        app.getSelectedGpxHelper().setGpxFileToDisplay(result);
        if (locToShow != null) {
            mapView.getAnimatedDraggingThread().startMoving(locToShow.lat, locToShow.lon, mapView.getZoom(), true);
        }
        mapView.refreshMap();
        dashboard.refreshContent(true);
        return true;
    };
    return GpxUiHelper.selectGPXFiles(files, mapActivity, callbackWithObject, getThemeRes(), isNightMode());
}
Also used : FavouritesLayer(net.osmand.plus.views.layers.FavouritesLayer) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter) ShowQuickSearchMode(net.osmand.plus.activities.MapActivity.ShowQuickSearchMode) NonNull(androidx.annotation.NonNull) ItemClickListener(net.osmand.plus.ContextMenuAdapter.ItemClickListener) R(net.osmand.plus.R) WptPt(net.osmand.GPXUtilities.WptPt) Drawable(android.graphics.drawable.Drawable) TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer) UiUtilities(net.osmand.plus.utils.UiUtilities) MapVectorLayer(net.osmand.plus.views.layers.MapVectorLayer) CallbackWithObject(net.osmand.CallbackWithObject) DownloadedRegionsLayer(net.osmand.plus.views.layers.DownloadedRegionsLayer) IndexConstants(net.osmand.IndexConstants) Map(java.util.Map) Button(android.widget.Button) GPXFile(net.osmand.GPXUtilities.GPXFile) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) PreviewRouteLineLayer(net.osmand.plus.views.layers.PreviewRouteLineLayer) DashboardOnMap(net.osmand.plus.dashboard.DashboardOnMap) RenderingIcons(net.osmand.plus.render.RenderingIcons) OsmandApplication(net.osmand.plus.OsmandApplication) StyleRes(androidx.annotation.StyleRes) OsmandPlugin(net.osmand.plus.plugins.OsmandPlugin) OsmandRasterMapsPlugin(net.osmand.plus.plugins.rastermaps.OsmandRasterMapsPlugin) List(java.util.List) DistanceRulerControlLayer(net.osmand.plus.views.layers.DistanceRulerControlLayer) MapWidgetRegistry(net.osmand.plus.views.mapwidgets.MapWidgetRegistry) Nullable(androidx.annotation.Nullable) Entry(java.util.Map.Entry) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) ImpassableRoadsLayer(net.osmand.plus.views.layers.ImpassableRoadsLayer) MapInfoLayer(net.osmand.plus.views.layers.MapInfoLayer) ListView(android.widget.ListView) MapQuickActionLayer(net.osmand.plus.views.layers.MapQuickActionLayer) PointNavigationLayer(net.osmand.plus.views.layers.PointNavigationLayer) DialogListItemAdapter(net.osmand.plus.DialogListItemAdapter) Context(android.content.Context) PoiFiltersHelper(net.osmand.plus.poi.PoiFiltersHelper) PointLocationLayer(net.osmand.plus.views.layers.PointLocationLayer) AlertDialog(androidx.appcompat.app.AlertDialog) TileSourceTemplate(net.osmand.map.TileSourceManager.TileSourceTemplate) CommonPreference(net.osmand.plus.settings.backend.preferences.CommonPreference) RouteLayer(net.osmand.plus.views.layers.RouteLayer) MapMarkersLayer(net.osmand.plus.views.layers.MapMarkersLayer) GpxUiHelper(net.osmand.plus.helpers.GpxUiHelper) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) MeasurementToolLayer(net.osmand.plus.measurementtool.MeasurementToolLayer) Toast(android.widget.Toast) ContextMenuLayer(net.osmand.plus.views.layers.ContextMenuLayer) GPXLayer(net.osmand.plus.views.layers.GPXLayer) MapTileLayer(net.osmand.plus.views.layers.MapTileLayer) MapTextLayer(net.osmand.plus.views.layers.MapTextLayer) DialogInterface(android.content.DialogInterface) OsmandMapLayer(net.osmand.plus.views.layers.base.OsmandMapLayer) POIMapLayer(net.osmand.plus.views.layers.POIMapLayer) ITileSource(net.osmand.map.ITileSource) StateChangedListener(net.osmand.StateChangedListener) SQLiteTileSource(net.osmand.plus.resources.SQLiteTileSource) ContextThemeWrapper(androidx.appcompat.view.ContextThemeWrapper) ArrayAdapter(android.widget.ArrayAdapter) MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) RoutingHelper(net.osmand.plus.routing.RoutingHelper) ContextMenuItem(net.osmand.plus.ContextMenuItem) RadiusRulerControlLayer(net.osmand.plus.views.layers.RadiusRulerControlLayer) ResultMatcher(net.osmand.ResultMatcher) MapActivity(net.osmand.plus.activities.MapActivity) WptPt(net.osmand.GPXUtilities.WptPt) GPXFile(net.osmand.GPXUtilities.GPXFile) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) DashboardOnMap(net.osmand.plus.dashboard.DashboardOnMap)

Example 2 with DashboardOnMap

use of net.osmand.plus.dashboard.DashboardOnMap in project Osmand by osmandapp.

the class MapActivity method updateMapSettings.

public void updateMapSettings() {
    if (!app.isApplicationInitializing()) {
        UpdateVectorRendererAsyncTask task = new UpdateVectorRendererAsyncTask(app, changed -> {
            if (changed) {
                OsmandPlugin.registerRenderingPreferences(app);
            }
            DashboardOnMap dashboard = getDashboard();
            if (dashboard != null) {
                dashboard.onMapSettingsUpdated();
            }
            return true;
        });
        task.executeOnExecutor(singleThreadExecutor);
    }
}
Also used : UpdateVectorRendererAsyncTask(net.osmand.plus.render.UpdateVectorRendererAsyncTask) DashboardOnMap(net.osmand.plus.dashboard.DashboardOnMap)

Aggregations

DashboardOnMap (net.osmand.plus.dashboard.DashboardOnMap)2 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Drawable (android.graphics.drawable.Drawable)1 ArrayAdapter (android.widget.ArrayAdapter)1 Button (android.widget.Button)1 ListView (android.widget.ListView)1 Toast (android.widget.Toast)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 StyleRes (androidx.annotation.StyleRes)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 ContextThemeWrapper (androidx.appcompat.view.ContextThemeWrapper)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 CallbackWithObject (net.osmand.CallbackWithObject)1 GPXFile (net.osmand.GPXUtilities.GPXFile)1