This commit is contained in:
Alexey Kulish 2017-04-26 12:57:19 +03:00
parent 5b26bdb27e
commit df1ad2c636
4 changed files with 8 additions and 16 deletions

View file

@ -29,7 +29,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.OsmAndListFragment; import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; 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.QuickSearchBottomShadowListItem;
import net.osmand.plus.search.listitems.QuickSearchButtonListItem; import net.osmand.plus.search.listitems.QuickSearchButtonListItem;
import net.osmand.plus.search.listitems.QuickSearchListItem; import net.osmand.plus.search.listitems.QuickSearchListItem;
@ -236,8 +235,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
pointDescription.setIconName("ic_action_building"); pointDescription.setIconName("ic_action_building");
break; break;
case LOCATION: case LOCATION:
LatLon latLon = (LatLon) object; pointDescription = new PointDescription(
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); searchResult.location.getLatitude(), searchResult.location.getLongitude());
pointDescription.setIconName("ic_action_world_globe"); pointDescription.setIconName("ic_action_world_globe");
break; break;
case STREET_INTERSECTION: case STREET_INTERSECTION:

View file

@ -30,7 +30,6 @@ import net.osmand.plus.render.RenderingIcons;
import net.osmand.search.core.CustomSearchPoiFilter; import net.osmand.search.core.CustomSearchPoiFilter;
import net.osmand.search.core.SearchResult; import net.osmand.search.core.SearchResult;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
import java.io.File; import java.io.File;
@ -206,13 +205,7 @@ public class QuickSearchListItem {
} }
return typeStr; return typeStr;
case LOCATION: case LOCATION:
LatLon latLon = null; LatLon latLon = searchResult.location;
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());
}
if (latLon != null && searchResult.localeRelatedObjectName == null) { if (latLon != null && searchResult.localeRelatedObjectName == null) {
String locationCountry = app.getRegions().getCountryName(latLon); String locationCountry = app.getRegions().getCountryName(latLon);
searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry; searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry;

View file

@ -179,8 +179,8 @@ public abstract class QuickSearchListFragment extends ListFragment {
pointDescription.setIconName("ic_action_building"); pointDescription.setIconName("ic_action_building");
break; break;
case LOCATION: case LOCATION:
LatLon latLon = (LatLon) object; pointDescription = new PointDescription(
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); searchResult.location.getLatitude(), searchResult.location.getLongitude());
pointDescription.setIconName("ic_action_world_globe"); pointDescription.setIconName("ic_action_world_globe");
break; break;
case STREET_INTERSECTION: case STREET_INTERSECTION:

View file

@ -76,8 +76,8 @@ public class QuickSearchListItem {
} }
break; break;
case LOCATION: case LOCATION:
LatLon latLon = (LatLon) searchResult.object; return PointDescription.getLocationNamePlain(
return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); app, searchResult.location.getLatitude(), searchResult.location.getLongitude());
} }
return searchResult.localeName; return searchResult.localeName;
} }
@ -180,7 +180,7 @@ public class QuickSearchListItem {
} }
return typeStr; return typeStr;
case LOCATION: case LOCATION:
LatLon latLon = (LatLon) searchResult.object; LatLon latLon = searchResult.location;
if (searchResult.localeRelatedObjectName == null) { if (searchResult.localeRelatedObjectName == null) {
String locationCountry = app.getRegions().getCountryName(latLon); String locationCountry = app.getRegions().getCountryName(latLon);
searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry; searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry;