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());
}
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);
}
}
Aggregations