Search in sources :

Example 11 with OsmandSettings

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);
        }
    }
}
Also used : OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Example 12 with OsmandSettings

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);
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) MapInfoLayer(net.osmand.plus.views.layers.MapInfoLayer) ITileSource(net.osmand.map.ITileSource) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Example 13 with OsmandSettings

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;
}
Also used : OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) RenderingRulesStorage(net.osmand.render.RenderingRulesStorage)

Example 14 with OsmandSettings

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;
}
Also used : SearchHistorySettingsItem(net.osmand.plus.settings.backend.backup.items.SearchHistorySettingsItem) ProfileSettingsItem(net.osmand.plus.settings.backend.backup.items.ProfileSettingsItem) OsmEditsSettingsItem(net.osmand.plus.settings.backend.backup.items.OsmEditsSettingsItem) DataSettingsItem(net.osmand.plus.settings.backend.backup.items.DataSettingsItem) GpxSettingsItem(net.osmand.plus.settings.backend.backup.items.GpxSettingsItem) ResourcesSettingsItem(net.osmand.plus.settings.backend.backup.items.ResourcesSettingsItem) OsmNotesSettingsItem(net.osmand.plus.settings.backend.backup.items.OsmNotesSettingsItem) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) QuickActionsSettingsItem(net.osmand.plus.settings.backend.backup.items.QuickActionsSettingsItem) PoiUiFiltersSettingsItem(net.osmand.plus.settings.backend.backup.items.PoiUiFiltersSettingsItem) ItinerarySettingsItem(net.osmand.plus.settings.backend.backup.items.ItinerarySettingsItem) GlobalSettingsItem(net.osmand.plus.settings.backend.backup.items.GlobalSettingsItem) DownloadsItem(net.osmand.plus.settings.backend.backup.items.DownloadsItem) SuggestedDownloadsItem(net.osmand.plus.settings.backend.backup.items.SuggestedDownloadsItem) PoiUiFiltersSettingsItem(net.osmand.plus.settings.backend.backup.items.PoiUiFiltersSettingsItem) FavoritesSettingsItem(net.osmand.plus.settings.backend.backup.items.FavoritesSettingsItem) SettingsItem(net.osmand.plus.settings.backend.backup.items.SettingsItem) OsmEditsSettingsItem(net.osmand.plus.settings.backend.backup.items.OsmEditsSettingsItem) AvoidRoadsSettingsItem(net.osmand.plus.settings.backend.backup.items.AvoidRoadsSettingsItem) SearchHistorySettingsItem(net.osmand.plus.settings.backend.backup.items.SearchHistorySettingsItem) GpxSettingsItem(net.osmand.plus.settings.backend.backup.items.GpxSettingsItem) PluginSettingsItem(net.osmand.plus.settings.backend.backup.items.PluginSettingsItem) ProfileSettingsItem(net.osmand.plus.settings.backend.backup.items.ProfileSettingsItem) OsmNotesSettingsItem(net.osmand.plus.settings.backend.backup.items.OsmNotesSettingsItem) MarkersSettingsItem(net.osmand.plus.settings.backend.backup.items.MarkersSettingsItem) GlobalSettingsItem(net.osmand.plus.settings.backend.backup.items.GlobalSettingsItem) FileSettingsItem(net.osmand.plus.settings.backend.backup.items.FileSettingsItem) HistoryMarkersSettingsItem(net.osmand.plus.settings.backend.backup.items.HistoryMarkersSettingsItem) MapSourcesSettingsItem(net.osmand.plus.settings.backend.backup.items.MapSourcesSettingsItem) DataSettingsItem(net.osmand.plus.settings.backend.backup.items.DataSettingsItem) OnlineRoutingSettingsItem(net.osmand.plus.settings.backend.backup.items.OnlineRoutingSettingsItem) ItinerarySettingsItem(net.osmand.plus.settings.backend.backup.items.ItinerarySettingsItem) ResourcesSettingsItem(net.osmand.plus.settings.backend.backup.items.ResourcesSettingsItem) QuickActionsSettingsItem(net.osmand.plus.settings.backend.backup.items.QuickActionsSettingsItem) FileSettingsItem(net.osmand.plus.settings.backend.backup.items.FileSettingsItem) OnlineRoutingSettingsItem(net.osmand.plus.settings.backend.backup.items.OnlineRoutingSettingsItem) SuggestedDownloadsItem(net.osmand.plus.settings.backend.backup.items.SuggestedDownloadsItem) MapSourcesSettingsItem(net.osmand.plus.settings.backend.backup.items.MapSourcesSettingsItem) FavoritesSettingsItem(net.osmand.plus.settings.backend.backup.items.FavoritesSettingsItem) MarkersSettingsItem(net.osmand.plus.settings.backend.backup.items.MarkersSettingsItem) HistoryMarkersSettingsItem(net.osmand.plus.settings.backend.backup.items.HistoryMarkersSettingsItem) HistoryMarkersSettingsItem(net.osmand.plus.settings.backend.backup.items.HistoryMarkersSettingsItem) PluginSettingsItem(net.osmand.plus.settings.backend.backup.items.PluginSettingsItem) AvoidRoadsSettingsItem(net.osmand.plus.settings.backend.backup.items.AvoidRoadsSettingsItem) Nullable(androidx.annotation.Nullable)

Example 15 with OsmandSettings

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);
        }
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentActivity(androidx.fragment.app.FragmentActivity) WikivoyageShowPicturesDialogFragment(net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Aggregations

OsmandSettings (net.osmand.plus.settings.backend.OsmandSettings)154 OsmandApplication (net.osmand.plus.OsmandApplication)52 View (android.view.View)25 ArrayList (java.util.ArrayList)23 LatLon (net.osmand.data.LatLon)17 MapActivity (net.osmand.plus.activities.MapActivity)17 TextView (android.widget.TextView)16 NonNull (androidx.annotation.NonNull)16 AlertDialog (androidx.appcompat.app.AlertDialog)15 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)15 ArrayAdapter (android.widget.ArrayAdapter)13 ContextMenuItem (net.osmand.plus.ContextMenuItem)13 TargetPoint (net.osmand.plus.helpers.TargetPointsHelper.TargetPoint)12 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)12 Context (android.content.Context)11 ImageView (android.widget.ImageView)11 Intent (android.content.Intent)8 List (java.util.List)8 PointDescription (net.osmand.data.PointDescription)8 DialogInterface (android.content.DialogInterface)7