renamed executeWithParams params

This commit is contained in:
Chumva 2018-06-06 15:53:20 +03:00 committed by Alex Sytnyk
parent 3cf5e24693
commit 172b0db0ef
5 changed files with 21 additions and 21 deletions

View file

@ -105,7 +105,7 @@ public abstract class SwitchableAction<T> extends QuickAction {
public abstract List<T> loadListFromParams(); public abstract List<T> loadListFromParams();
public abstract void executeWithParams(MapActivity mapActivity, String params); public abstract void executeWithParams(MapActivity activity, String params);
protected void showChooseDialog(FragmentManager fm) { protected void showChooseDialog(FragmentManager fm) {
SelectMapViewQuickActionsBottomSheet fragment = new SelectMapViewQuickActionsBottomSheet(); SelectMapViewQuickActionsBottomSheet fragment = new SelectMapViewQuickActionsBottomSheet();

View file

@ -104,10 +104,10 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
} }
@Override @Override
public void executeWithParams(MapActivity mapActivity, String params) { public void executeWithParams(MapActivity activity, String params) {
OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class); OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class);
if (plugin != null) { if (plugin != null) {
OsmandSettings settings = mapActivity.getMyApplication().getSettings(); OsmandSettings settings = activity.getMyApplication().getSettings();
boolean hasOverlay = !params.equals(KEY_NO_OVERLAY); boolean hasOverlay = !params.equals(KEY_NO_OVERLAY);
if (hasOverlay) { if (hasOverlay) {
settings.MAP_OVERLAY.set(params); settings.MAP_OVERLAY.set(params);
@ -116,8 +116,8 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
settings.MAP_OVERLAY.set(null); settings.MAP_OVERLAY.set(null);
settings.MAP_OVERLAY_PREVIOUS.set(null); settings.MAP_OVERLAY_PREVIOUS.set(null);
} }
plugin.updateMapLayers(mapActivity.getMapView(), settings.MAP_OVERLAY, mapActivity.getMapLayers()); plugin.updateMapLayers(activity.getMapView(), settings.MAP_OVERLAY, activity.getMapLayers());
Toast.makeText(mapActivity, mapActivity.getString(R.string.quick_action_map_overlay_switch, params), Toast.LENGTH_SHORT).show(); Toast.makeText(activity, activity.getString(R.string.quick_action_map_overlay_switch, params), Toast.LENGTH_SHORT).show();
} }
} }

View file

@ -98,17 +98,17 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
} }
@Override @Override
public void executeWithParams(MapActivity mapActivity, String params) { public void executeWithParams(MapActivity activity, String params) {
OsmandSettings settings = mapActivity.getMyApplication().getSettings(); OsmandSettings settings = activity.getMyApplication().getSettings();
if (params.equals(LAYER_OSM_VECTOR)) { if (params.equals(LAYER_OSM_VECTOR)) {
settings.MAP_ONLINE_DATA.set(false); settings.MAP_ONLINE_DATA.set(false);
mapActivity.getMapLayers().updateMapSource(mapActivity.getMapView(), null); activity.getMapLayers().updateMapSource(activity.getMapView(), null);
} else { } else {
settings.MAP_TILE_SOURCES.set(params); settings.MAP_TILE_SOURCES.set(params);
settings.MAP_ONLINE_DATA.set(true); settings.MAP_ONLINE_DATA.set(true);
mapActivity.getMapLayers().updateMapSource(mapActivity.getMapView(), settings.MAP_TILE_SOURCES); activity.getMapLayers().updateMapSource(activity.getMapView(), settings.MAP_TILE_SOURCES);
} }
Toast.makeText(mapActivity, mapActivity.getString(R.string.quick_action_map_source_switch, params), Toast.LENGTH_SHORT).show(); Toast.makeText(activity, activity.getString(R.string.quick_action_map_source_switch, params), Toast.LENGTH_SHORT).show();
} }
@Override @Override

View file

@ -59,19 +59,19 @@ public class MapStyleAction extends SwitchableAction<String> {
} }
@Override @Override
public void executeWithParams(MapActivity mapActivity, String params) { public void executeWithParams(MapActivity activity, String params) {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = activity.getMyApplication();
RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(params); RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(params);
if (loaded != null) { if (loaded != null) {
OsmandMapTileView view = mapActivity.getMapView(); OsmandMapTileView view = activity.getMapView();
view.getSettings().RENDERER.set(params); view.getSettings().RENDERER.set(params);
app.getRendererRegistry().setCurrentSelectedRender(loaded); app.getRendererRegistry().setCurrentSelectedRender(loaded);
ConfigureMapMenu.refreshMapComplete(mapActivity); ConfigureMapMenu.refreshMapComplete(activity);
Toast.makeText(mapActivity, mapActivity.getString(R.string.quick_action_map_style_switch, params), Toast.LENGTH_SHORT).show(); Toast.makeText(activity, activity.getString(R.string.quick_action_map_style_switch, params), Toast.LENGTH_SHORT).show();
} else { } else {
Toast.makeText(mapActivity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); Toast.makeText(activity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
} }
} }

View file

@ -103,10 +103,10 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
} }
@Override @Override
public void executeWithParams(MapActivity mapActivity, String params) { public void executeWithParams(MapActivity activity, String params) {
OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class); OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class);
if (plugin != null) { if (plugin != null) {
OsmandSettings settings = mapActivity.getMyApplication().getSettings(); OsmandSettings settings = activity.getMyApplication().getSettings();
boolean hasUnderlay = !params.equals(KEY_NO_UNDERLAY); boolean hasUnderlay = !params.equals(KEY_NO_UNDERLAY);
if (hasUnderlay) { if (hasUnderlay) {
settings.MAP_UNDERLAY.set(params); settings.MAP_UNDERLAY.set(params);
@ -116,11 +116,11 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
settings.MAP_UNDERLAY_PREVIOUS.set(null); settings.MAP_UNDERLAY_PREVIOUS.set(null);
} }
final OsmandSettings.CommonPreference<Boolean> hidePolygonsPref = final OsmandSettings.CommonPreference<Boolean> hidePolygonsPref =
mapActivity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons"); activity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
hidePolygonsPref.set(hasUnderlay); hidePolygonsPref.set(hasUnderlay);
plugin.updateMapLayers(mapActivity.getMapView(), settings.MAP_UNDERLAY, mapActivity.getMapLayers()); plugin.updateMapLayers(activity.getMapView(), settings.MAP_UNDERLAY, activity.getMapLayers());
Toast.makeText(mapActivity, mapActivity.getString(R.string.quick_action_map_underlay_switch, params), Toast.LENGTH_SHORT).show(); Toast.makeText(activity, activity.getString(R.string.quick_action_map_underlay_switch, params), Toast.LENGTH_SHORT).show();
} }
} }