diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java index 88daa4f9aa..5d9c8e82d2 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java @@ -29,7 +29,6 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.OsmAndListFragment; import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; -import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType; import net.osmand.plus.search.listitems.QuickSearchBottomShadowListItem; import net.osmand.plus.search.listitems.QuickSearchButtonListItem; import net.osmand.plus.search.listitems.QuickSearchListItem; @@ -236,8 +235,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { pointDescription.setIconName("ic_action_building"); break; case LOCATION: - LatLon latLon = (LatLon) object; - pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); + pointDescription = new PointDescription( + searchResult.location.getLatitude(), searchResult.location.getLongitude()); pointDescription.setIconName("ic_action_world_globe"); break; case STREET_INTERSECTION: diff --git a/OsmAnd/src/net/osmand/plus/search/listitems/QuickSearchListItem.java b/OsmAnd/src/net/osmand/plus/search/listitems/QuickSearchListItem.java index 2bc3c587cb..e4520360a9 100644 --- a/OsmAnd/src/net/osmand/plus/search/listitems/QuickSearchListItem.java +++ b/OsmAnd/src/net/osmand/plus/search/listitems/QuickSearchListItem.java @@ -30,7 +30,6 @@ import net.osmand.plus.render.RenderingIcons; import net.osmand.search.core.CustomSearchPoiFilter; import net.osmand.search.core.SearchResult; import net.osmand.util.Algorithms; -import net.osmand.util.GeoPointParserUtil.GeoParsedPoint; import java.io.File; @@ -206,13 +205,7 @@ public class QuickSearchListItem { } return typeStr; case LOCATION: - LatLon latLon = null; - if (searchResult.object instanceof LatLon) { - latLon = (LatLon) searchResult.object; - } else if (searchResult.object instanceof GeoParsedPoint) { - GeoParsedPoint geoParsedPoint = (GeoParsedPoint) searchResult.object; - latLon = new LatLon(geoParsedPoint.getLatitude(), geoParsedPoint.getLongitude()); - } + LatLon latLon = searchResult.location; if (latLon != null && searchResult.localeRelatedObjectName == null) { String locationCountry = app.getRegions().getCountryName(latLon); searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry; diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListFragment.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListFragment.java index 9587c293be..f53dd4b068 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListFragment.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListFragment.java @@ -179,8 +179,8 @@ public abstract class QuickSearchListFragment extends ListFragment { pointDescription.setIconName("ic_action_building"); break; case LOCATION: - LatLon latLon = (LatLon) object; - pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); + pointDescription = new PointDescription( + searchResult.location.getLatitude(), searchResult.location.getLongitude()); pointDescription.setIconName("ic_action_world_globe"); break; case STREET_INTERSECTION: diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListItem.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListItem.java index f0658d0afd..5de85a803d 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListItem.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/search/QuickSearchListItem.java @@ -76,8 +76,8 @@ public class QuickSearchListItem { } break; case LOCATION: - LatLon latLon = (LatLon) searchResult.object; - return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); + return PointDescription.getLocationNamePlain( + app, searchResult.location.getLatitude(), searchResult.location.getLongitude()); } return searchResult.localeName; } @@ -180,7 +180,7 @@ public class QuickSearchListItem { } return typeStr; case LOCATION: - LatLon latLon = (LatLon) searchResult.object; + LatLon latLon = searchResult.location; if (searchResult.localeRelatedObjectName == null) { String locationCountry = app.getRegions().getCountryName(latLon); searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry;