use of net.osmand.plus.settings.backend.OsmandSettings in project Osmand by osmandapp.
the class TripRecordingStartingBottomSheet method showTripRecordingDialog.
public static void showTripRecordingDialog(@NonNull FragmentManager fragmentManager, OsmandApplication app) {
if (!fragmentManager.isStateSaved()) {
OsmandSettings settings = app.getSettings();
boolean showStartDialog = settings.SHOW_TRIP_REC_START_DIALOG.get();
if (showStartDialog) {
showInstance(fragmentManager);
} else {
startRecording(app);
}
}
}
use of net.osmand.plus.settings.backend.OsmandSettings in project Osmand by osmandapp.
the class MapillaryPlugin method updateMapLayers.
private void updateMapLayers(@NonNull Context context, @Nullable MapActivity mapActivity, boolean force) {
if (vectorLayer == null) {
createLayers(context);
}
OsmandApplication app = (OsmandApplication) context.getApplicationContext();
OsmandSettings settings = app.getSettings();
OsmandMapTileView mapView = app.getOsmandMap().getMapView();
if (isActive()) {
ITileSource vectorSource = null;
if (SHOW_MAPILLARY.get() || force) {
vectorSource = settings.getTileSourceByName(TileSourceManager.getMapillaryVectorSource().getName(), false);
}
updateLayer(mapView, vectorSource, vectorLayer, 0.62f);
if (mapillaryControl == null && mapActivity != null) {
registerWidget(mapActivity);
}
} else {
mapView.removeLayer(vectorLayer);
vectorLayer.setMap(null);
if (mapActivity != null) {
MapInfoLayer mapInfoLayer = mapActivity.getMapLayers().getMapInfoLayer();
if (mapillaryControl != null && mapInfoLayer != null) {
mapInfoLayer.removeSideWidget(mapillaryControl);
mapillaryControl = null;
mapInfoLayer.recreateControls();
}
}
mapillaryControl = null;
}
app.getOsmandMap().getMapLayers().updateMapSource(mapView, null);
}
use of net.osmand.plus.settings.backend.OsmandSettings in project Osmand by osmandapp.
the class UpdateVectorRendererAsyncTask method doInBackground.
@Override
protected Boolean doInBackground(Void... params) {
OsmandSettings settings = app.getSettings();
RendererRegistry registry = app.getRendererRegistry();
OsmandMapTileView mapView = app.getOsmandMap().getMapView();
RenderingRulesStorage newRenderer = registry.getRenderer(settings.RENDERER.get());
if (newRenderer == null) {
newRenderer = registry.defaultRender();
}
if (mapView.getMapRenderer() != null) {
NativeCoreContext.getMapRendererContext().updateMapSettings();
}
boolean changed = registry.getCurrentSelectedRenderer() != newRenderer;
if (changed) {
registry.setCurrentSelectedRender(newRenderer);
app.getResourceManager().getRenderer().clearCache();
mapView.resetDefaultColor();
mapView.refreshMap(true);
} else {
mapView.resetDefaultColor();
}
return changed;
}
use of net.osmand.plus.settings.backend.OsmandSettings in project Osmand by osmandapp.
the class SettingsItemsFactory method createItem.
@Nullable
private SettingsItem createItem(@NonNull JSONObject json) throws IllegalArgumentException, JSONException {
SettingsItem item = null;
SettingsItemType type = SettingsItem.parseItemType(json);
if (type == null) {
return null;
}
OsmandSettings settings = app.getSettings();
switch(type) {
case GLOBAL:
item = new GlobalSettingsItem(settings, json);
break;
case PROFILE:
item = new ProfileSettingsItem(app, json);
break;
case PLUGIN:
item = new PluginSettingsItem(app, json);
break;
case DATA:
item = new DataSettingsItem(app, json);
break;
case FILE:
item = new FileSettingsItem(app, json);
break;
case RESOURCES:
item = new ResourcesSettingsItem(app, json);
break;
case QUICK_ACTIONS:
item = new QuickActionsSettingsItem(app, json);
break;
case POI_UI_FILTERS:
item = new PoiUiFiltersSettingsItem(app, json);
break;
case MAP_SOURCES:
item = new MapSourcesSettingsItem(app, json);
break;
case AVOID_ROADS:
item = new AvoidRoadsSettingsItem(app, json);
break;
case SUGGESTED_DOWNLOADS:
item = new SuggestedDownloadsItem(app, json);
break;
case DOWNLOADS:
item = new DownloadsItem(app, json);
break;
case OSM_NOTES:
item = new OsmNotesSettingsItem(app, json);
break;
case OSM_EDITS:
item = new OsmEditsSettingsItem(app, json);
break;
case FAVOURITES:
item = new FavoritesSettingsItem(app, json);
break;
case ACTIVE_MARKERS:
item = new MarkersSettingsItem(app, json);
break;
case HISTORY_MARKERS:
item = new HistoryMarkersSettingsItem(app, json);
break;
case SEARCH_HISTORY:
item = new SearchHistorySettingsItem(app, json);
break;
case GPX:
item = new GpxSettingsItem(app, json);
break;
case ONLINE_ROUTING_ENGINES:
item = new OnlineRoutingSettingsItem(app, json);
break;
case ITINERARY_GROUPS:
item = new ItinerarySettingsItem(app, json);
break;
}
return item;
}
use of net.osmand.plus.settings.backend.OsmandSettings in project Osmand by osmandapp.
the class WikivoyageArticleDialogFragment method onResume.
@Override
public void onResume() {
super.onResume();
OsmandSettings settings = getMyApplication().getSettings();
if (!settings.WIKI_ARTICLE_SHOW_IMAGES_ASKED.get()) {
FragmentActivity activity = getActivity();
FragmentManager fm = getFragmentManager();
if (activity != null && fm != null) {
WikivoyageShowPicturesDialogFragment fragment = new WikivoyageShowPicturesDialogFragment();
fragment.setTargetFragment(this, WikivoyageShowPicturesDialogFragment.SHOW_PICTURES_CHANGED_REQUEST_CODE);
fragment.show(fm, WikivoyageShowPicturesDialogFragment.TAG);
settings.WIKI_ARTICLE_SHOW_IMAGES_ASKED.set(true);
}
}
}
Aggregations