Save transport settings Fix #2908

This commit is contained in:
Victor Shcherb 2016-08-17 13:22:13 +02:00
parent 6dcee1c58b
commit 3b41b6ce8b
5 changed files with 155 additions and 81 deletions

View file

@ -14,7 +14,6 @@ import android.os.Environment;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.StateChangedListener; import net.osmand.StateChangedListener;
import net.osmand.ValueHolder; import net.osmand.ValueHolder;
@ -516,6 +515,59 @@ public class OsmandSettings {
return settingsAPI.edit(prefs).putString(getId(), (val != null) ? val.trim() : val).commit(); return settingsAPI.edit(prefs).putString(getId(), (val != null) ? val.trim() : val).commit();
} }
}
public class ListStringPreference extends StringPreference {
private String delimiter;
private ListStringPreference(String id, String defaultValue, String delimiter) {
super(id, defaultValue);
this.delimiter = delimiter;
}
public boolean addValue(String res) {
String vl = get();
if (vl == null || vl.isEmpty()) {
vl = res + delimiter;
} else {
vl = vl + res + delimiter;
}
set(vl);
return true;
}
public void clearAll() {
set("");
}
public boolean containsValue(String res) {
String vl = get();
String r = res + delimiter;
return vl.startsWith(r) || vl.indexOf(delimiter + r) >= 0;
}
public boolean removeValue(String res) {
String vl = get();
String r = res + delimiter;
if(vl != null) {
if(vl.startsWith(r)) {
vl = vl.substring(r.length());
set(vl);
return true;
} else {
int it = vl.indexOf(delimiter + r);
if(it >= 0) {
vl = vl.substring(0, it + delimiter.length()) + vl.substring(it + delimiter.length() + r.length());
}
set(vl);
return true;
}
}
return false;
}
} }
private class EnumIntPreference<E extends Enum<E>> extends CommonPreference<E> { private class EnumIntPreference<E extends Enum<E>> extends CommonPreference<E> {
@ -2608,6 +2660,9 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> FOLLOW_THE_ROUTE = new BooleanPreference("follow_to_route", false).makeGlobal(); public final OsmandPreference<Boolean> FOLLOW_THE_ROUTE = new BooleanPreference("follow_to_route", false).makeGlobal();
public final OsmandPreference<String> FOLLOW_THE_GPX_ROUTE = new StringPreference("follow_gpx", null).makeGlobal(); public final OsmandPreference<String> FOLLOW_THE_GPX_ROUTE = new StringPreference("follow_gpx", null).makeGlobal();
public final ListStringPreference TRANSPORT_DEFAULT_SETTINGS =
(ListStringPreference) new ListStringPreference("transport_default_settings", "transportStops", ",").makeProfile();
public final OsmandPreference<Boolean> SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME = public final OsmandPreference<Boolean> SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME =
new BooleanPreference("show_arrival_time", true).makeGlobal(); new BooleanPreference("show_arrival_time", true).makeGlobal();

View file

@ -419,7 +419,7 @@ public class MapActivityLayers {
adapter.addItem(builder.createItem()); adapter.addItem(builder.createItem());
} }
public void selectMapLayer(final OsmandMapTileView mapView) { public void selectMapLayer(final OsmandMapTileView mapView, final ContextMenuItem it) {
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) { if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
Toast.makeText(activity, R.string.map_online_plugin_is_not_installed, Toast.LENGTH_LONG).show(); Toast.makeText(activity, R.string.map_online_plugin_is_not_installed, Toast.LENGTH_LONG).show();
return; return;
@ -477,6 +477,9 @@ public class MapActivityLayers {
case layerOsmVector: case layerOsmVector:
settings.MAP_ONLINE_DATA.set(false); settings.MAP_ONLINE_DATA.set(false);
updateMapSource(mapView, null); updateMapSource(mapView, null);
if(it != null) {
it.setDescription(null);
}
break; break;
case layerEditInstall: case layerEditInstall:
OsmandRasterMapsPlugin.defineNewEditLayer(activity, new ResultMatcher<TileSourceTemplate>() { OsmandRasterMapsPlugin.defineNewEditLayer(activity, new ResultMatcher<TileSourceTemplate>() {
@ -485,6 +488,9 @@ public class MapActivityLayers {
public boolean publish(TileSourceTemplate object) { public boolean publish(TileSourceTemplate object) {
settings.MAP_TILE_SOURCES.set(object.getName()); settings.MAP_TILE_SOURCES.set(object.getName());
settings.MAP_ONLINE_DATA.set(true); settings.MAP_ONLINE_DATA.set(true);
if(it != null) {
it.setDescription(object.getName());
}
updateMapSource(mapView, settings.MAP_TILE_SOURCES); updateMapSource(mapView, settings.MAP_TILE_SOURCES);
return true; return true;
} }
@ -507,9 +513,12 @@ public class MapActivityLayers {
if (count == 1) { if (count == 1) {
settings.MAP_TILE_SOURCES.set(template.getName()); settings.MAP_TILE_SOURCES.set(template.getName());
settings.MAP_ONLINE_DATA.set(true); settings.MAP_ONLINE_DATA.set(true);
if(it != null) {
it.setDescription(template.getName());
}
updateMapSource(mapView, settings.MAP_TILE_SOURCES); updateMapSource(mapView, settings.MAP_TILE_SOURCES);
} else { } else {
selectMapLayer(mapView); selectMapLayer(mapView, it);
} }
} else { } else {
count++; count++;
@ -527,6 +536,9 @@ public class MapActivityLayers {
default: default:
settings.MAP_TILE_SOURCES.set(layerKey); settings.MAP_TILE_SOURCES.set(layerKey);
settings.MAP_ONLINE_DATA.set(true); settings.MAP_ONLINE_DATA.set(true);
if(it != null) {
it.setDescription(layerKey);
}
updateMapSource(mapView, settings.MAP_TILE_SOURCES); updateMapSource(mapView, settings.MAP_TILE_SOURCES);
break; break;
} }

View file

@ -24,6 +24,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.ListStringPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers; import net.osmand.plus.activities.MapActivityLayers;
@ -136,7 +137,6 @@ public class ConfigureMapMenu {
final ContextMenuItem item = cm.getItem(pos); final ContextMenuItem item = cm.getItem(pos);
if (item.getSelected() != null) { if (item.getSelected() != null) {
item.setColorRes(isChecked ? R.color.osmand_orange : ContextMenuItem.INVALID_ID); item.setColorRes(isChecked ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
adapter.notifyDataSetChanged();
} }
if (itemId == R.string.layer_poi) { if (itemId == R.string.layer_poi) {
poiFiltersHelper.clearSelectedPoiFilters(); poiFiltersHelper.clearSelectedPoiFilters();
@ -163,9 +163,11 @@ public class ConfigureMapMenu {
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID); intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID);
ma.startActivity(intent); ma.startActivity(intent);
} else { } else {
ma.getMapLayers().selectMapLayer(ma.getMapView()); ContextMenuItem it = adapter.getItem(pos);
ma.getMapLayers().selectMapLayer(ma.getMapView(), it);
} }
} }
adapter.notifyDataSetChanged();
ma.getMapLayers().updateLayers(ma.getMapView()); ma.getMapLayers().updateLayers(ma.getMapView());
ma.getMapView().refreshMap(); ma.getMapView().refreshMap();
return false; return false;
@ -238,7 +240,7 @@ public class ConfigureMapMenu {
.setSecondaryIcon(R.drawable.ic_action_additional_option) .setSecondaryIcon(R.drawable.ic_action_additional_option)
.setListener(l).createItem()); .setListener(l).createItem());
ContextMenuItem item = createProperties(customRules, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark, ContextMenuItem item = createProperties(customRules, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark,
"transport", adapter, activity, false); "transport", settings.TRANSPORT_DEFAULT_SETTINGS, adapter, activity, false);
if(item != null) { if(item != null) {
adapter.addItem(item); adapter.addItem(item);
} }
@ -261,6 +263,7 @@ public class ConfigureMapMenu {
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.layer_map, activity) .setTitleId(R.string.layer_map, activity)
.setIcon(R.drawable.ic_world_globe_dark) .setIcon(R.drawable.ic_world_globe_dark)
.setDescription(settings.MAP_ONLINE_DATA.get() ? settings.MAP_TILE_SOURCES.get() : null)
.setListener(l).createItem()); .setListener(l).createItem());
OsmandPlugin.registerLayerContextMenu(activity.getMapView(), adapter, activity); OsmandPlugin.registerLayerContextMenu(activity.getMapView(), adapter, activity);
@ -498,22 +501,22 @@ public class ConfigureMapMenu {
ContextMenuItem props; ContextMenuItem props;
props = createProperties(customRules, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark, props = createProperties(customRules, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark,
"transport", adapter, activity, true); "transport", null, adapter, activity, true);
if(props != null) { if(props != null) {
adapter.addItem(props); adapter.addItem(props);
} }
props = createProperties(customRules, R.string.rendering_category_details, R.drawable.ic_action_layers_dark, props = createProperties(customRules, R.string.rendering_category_details, R.drawable.ic_action_layers_dark,
"details", adapter, activity, true); "details", null, adapter, activity, true);
if(props != null) { if(props != null) {
adapter.addItem(props); adapter.addItem(props);
} }
props = createProperties(customRules, R.string.rendering_category_hide, R.drawable.ic_action_hide, "hide", props = createProperties(customRules, R.string.rendering_category_hide, R.drawable.ic_action_hide,
adapter, activity, true); "hide", null, adapter, activity, true);
if(props != null) { if(props != null) {
adapter.addItem(props); adapter.addItem(props);
} }
props = createProperties(customRules, R.string.rendering_category_routes, R.drawable.ic_action_map_routes, props = createProperties(customRules, R.string.rendering_category_routes, R.drawable.ic_action_map_routes,
"routes", adapter, activity, true); "routes", null, adapter, activity, true);
if(props != null) { if(props != null) {
adapter.addItem(props); adapter.addItem(props);
} }
@ -570,7 +573,7 @@ public class ConfigureMapMenu {
private ContextMenuItem createProperties(List<RenderingRuleProperty> customRules, private ContextMenuItem createProperties(List<RenderingRuleProperty> customRules,
@StringRes final int strId, @StringRes final int strId,
@DrawableRes final int icon, @DrawableRes final int icon,
String category, String category, final ListStringPreference defaultSettings,
final ContextMenuAdapter adapter, final MapActivity activity, final boolean useDescription) { final ContextMenuAdapter adapter, final MapActivity activity, final boolean useDescription) {
final List<RenderingRuleProperty> ps = new ArrayList<>(); final List<RenderingRuleProperty> ps = new ArrayList<>();
final List<OsmandSettings.CommonPreference<Boolean>> prefs = new ArrayList<>(); final List<OsmandSettings.CommonPreference<Boolean>> prefs = new ArrayList<>();
@ -592,6 +595,14 @@ public class ConfigureMapMenu {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a, int itemId, int pos, public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a, int itemId, int pos,
boolean isChecked) { boolean isChecked) {
if (!isChecked && !useDescription) { if (!isChecked && !useDescription) {
if (defaultSettings != null) {
defaultSettings.set("");
for (int i = 0; i < prefs.size(); i++) {
if (prefs.get(i).get()) {
defaultSettings.addValue(prefs.get(i).getId());
}
}
}
for (int i = 0; i < prefs.size(); i++) { for (int i = 0; i < prefs.size(); i++) {
prefs.get(i).set(false); prefs.get(i).set(false);
} }
@ -601,7 +612,7 @@ public class ConfigureMapMenu {
activity.getMapLayers().updateLayers(activity.getMapView()); activity.getMapLayers().updateLayers(activity.getMapView());
} else { } else {
showPreferencesDialog(adapter, a, pos, activity, activity.getString(strId), ps, prefs, showPreferencesDialog(adapter, a, pos, activity, activity.getString(strId), ps, prefs,
useDescription); useDescription, defaultSettings, true);
} }
return false; return false;
} }
@ -626,7 +637,7 @@ public class ConfigureMapMenu {
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> a, View view, int itemId, public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> a, View view, int itemId,
int pos) { int pos) {
showPreferencesDialog(adapter, a, pos, activity, activity.getString(strId), ps, prefs, showPreferencesDialog(adapter, a, pos, activity, activity.getString(strId), ps, prefs,
useDescription); useDescription, defaultSettings, false);
return false; return false;
} }
}); });
@ -659,16 +670,14 @@ public class ConfigureMapMenu {
} }
protected void showPreferencesDialog(final ContextMenuAdapter adapter, final ArrayAdapter<?> a, final int pos, final MapActivity activity, protected void showPreferencesDialog(final ContextMenuAdapter adapter, final ArrayAdapter<?> a, final int pos, final MapActivity activity,
String category, List<RenderingRuleProperty> ps, final List<CommonPreference<Boolean>> prefs, final boolean useDescription) { String category, List<RenderingRuleProperty> ps, final List<CommonPreference<Boolean>> prefs,
final boolean useDescription, ListStringPreference defaultSettings, boolean useDefault) {
AlertDialog.Builder bld = new AlertDialog.Builder(activity); AlertDialog.Builder bld = new AlertDialog.Builder(activity);
boolean[] checkedItems = new boolean[prefs.size()]; boolean[] checkedItems = new boolean[prefs.size()];
for (int i = 0; i < prefs.size(); i++) {
checkedItems[i] = prefs.get(i).get();
}
final boolean[] tempPrefs = new boolean[prefs.size()]; final boolean[] tempPrefs = new boolean[prefs.size()];
for (int i = 0; i < prefs.size(); i++) { for (int i = 0; i < prefs.size(); i++) {
tempPrefs[i] = prefs.get(i).get(); tempPrefs[i] = checkedItems[i] = defaultSettings != null && useDefault ?
defaultSettings.containsValue(prefs.get(i).getId()) : prefs.get(i).get();
} }
final String[] vals = new String[ps.size()]; final String[] vals = new String[ps.size()];
for (int i = 0; i < ps.size(); i++) { for (int i = 0; i < ps.size(); i++) {
@ -692,8 +701,7 @@ public class ConfigureMapMenu {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
boolean selected = false; boolean selected = false;
for (int i = 0; i < prefs.size(); i++) { for (int i = 0; i < prefs.size(); i++) {
prefs.get(i).set(tempPrefs[i]); selected |= prefs.get(i).get();
selected |= tempPrefs[i];
} }
adapter.getItem(pos).setSelected(selected); adapter.getItem(pos).setSelected(selected);
adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID); adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
@ -713,8 +721,8 @@ public class ConfigureMapMenu {
adapter.getItem(pos).setDescription(getDescription(prefs)); adapter.getItem(pos).setDescription(getDescription(prefs));
} else{ } else{
adapter.getItem(pos).setSelected(selected); adapter.getItem(pos).setSelected(selected);
adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
} }
adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
} }
a.notifyDataSetInvalidated(); a.notifyDataSetInvalidated();
refreshMapComplete(activity); refreshMapComplete(activity);

View file

@ -122,9 +122,9 @@ public class DiscountHelper {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((message == null) ? 0 : message.hashCode()); result = prime * result + ((message == null) ? 0 : message.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((start == null) ? 0 : start.hashCode()); result = prime * result + ((start == null) ? 0 : start.hashCode());
result = prime * result + ((end == null) ? 0 : end.hashCode()); // result = prime * result + ((description == null) ? 0 : description.hashCode());
// result = prime * result + ((end == null) ? 0 : end.hashCode());
return result; return result;
} }

View file

@ -31,6 +31,7 @@ import android.view.WindowManager;
public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider { public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
private static final int startZoom = 12; private static final int startZoom = 12;
private static final int startZoomRoute = 10;
private OsmandMapTileView view; private OsmandMapTileView view;
@ -105,34 +106,32 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
}; };
} }
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) { public void getFromPoint(RotatedTileBox tb, PointF point, List<? super TransportStop> res,
if (data.getResults() != null) { List<TransportStop> objects) {
List<TransportStop> objects = route != null ? route.getForwardStops() : data.getResults(); int ex = (int) point.x;
int ex = (int) point.x; int ey = (int) point.y;
int ey = (int) point.y; final int rp = getRadiusPoi(tb);
final int rp = getRadiusPoi(tb); int radius = rp * 3 / 2;
int radius = rp * 3 / 2; try {
try { TreeSet<String> ms = new TreeSet<>();
TreeSet<String> ms = new TreeSet<>(); for (int i = 0; i < objects.size(); i++) {
for (int i = 0; i < objects.size(); i++) { TransportStop n = objects.get(i);
TransportStop n = objects.get(i); if (n.getLocation() == null) {
if (n.getLocation() == null){ continue;
}
int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
if (!ms.add(n.getName())) {
// only unique names
continue; continue;
} }
int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); radius = rp;
int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); res.add(n);
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
if(!ms.add(n.getName())) {
// only unique names
continue;
}
radius = rp;
res.add(n);
}
} }
} catch (IndexOutOfBoundsException e) {
// that's really rare case, but is much efficient than introduce synchronized block
} }
} catch (IndexOutOfBoundsException e) {
// that's really rare case, but is much efficient than introduce synchronized block
} }
} }
@ -149,7 +148,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
public int getRadiusPoi(RotatedTileBox tb){ public int getRadiusPoi(RotatedTileBox tb){
final double zoom = tb.getZoom(); final double zoom = tb.getZoom();
int r; int r;
if(zoom < startZoom){ if(zoom < startZoomRoute){
r = 0; r = 0;
} else if(zoom <= 15){ } else if(zoom <= 15){
r = 8; r = 8;
@ -162,14 +161,14 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
} }
return (int) (r * tb.getDensity()); return (int) (r * tb.getDensity());
} }
@Override @Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb,DrawSettings settings) {
DrawSettings settings) { List<TransportStop> objects = null;
if (tb.getZoom() >= startZoom) { if (tb.getZoom() >= startZoomRoute) {
data.queryNewData(tb); if (route != null) {
if(route != null) { objects = route.getForwardStops();
attrs.updatePaints(view, settings, tb); attrs.updatePaints(view, settings, tb);
try { try {
path.reset(); path.reset();
@ -193,35 +192,33 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
// ignore // ignore
} }
} }
}
if (tb.getZoom() >= startZoom && objects == null) {
data.queryNewData(tb);
objects = data.getResults();
}
if (objects != null) {
float iconSize = stopBus.getWidth() * 3 / 2.5f; float iconSize = stopBus.getWidth() * 3 / 2.5f;
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tb); QuadTree<QuadRect> boundIntersections = initBoundIntersections(tb);
List<TransportStop> fullObjects = new ArrayList<>(); List<TransportStop> fullObjects = new ArrayList<>();
List<TransportStop> objects = data.getResults() ; for (TransportStop o : objects) {
if(route != null) { float x = tb.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
objects = route.getForwardStops(); float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
}
if (objects != null) {
for (TransportStop o : objects) {
float x = tb.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
if (intersects(boundIntersections, x, y, iconSize, iconSize)) { if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
canvas.drawBitmap(stopSmall, x - stopSmall.getWidth() / 2, y - stopSmall.getHeight() / 2, canvas.drawBitmap(stopSmall, x - stopSmall.getWidth() / 2, y - stopSmall.getHeight() / 2, paintIcon);
paintIcon); } else {
} else { fullObjects.add(o);
fullObjects.add(o);
}
}
for (TransportStop o : fullObjects) {
float x = tb.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
Bitmap b = stopBus;
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon);
} }
} }
for (TransportStop o : fullObjects) {
float x = tb.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
Bitmap b = stopBus;
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon);
}
} }
} }
@Override @Override
@ -268,9 +265,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
@Override @Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) { public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
if (tileBox.getZoom() >= startZoom) { if(tileBox.getZoom() >= startZoomRoute && route != null) {
getFromPoint(tileBox, point, res); getFromPoint(tileBox, point, res, route.getForwardStops());
} } else if (tileBox.getZoom() >= startZoom && data.getResults() != null) {
getFromPoint(tileBox, point, res, data.getResults());
}
} }
@Override @Override