cleaned some code

This commit is contained in:
Chumva 2018-03-23 14:43:54 +02:00
parent fd59313887
commit 9c09cb9c8b

View file

@ -98,7 +98,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
showResult(sr); showResult(sr);
} else { } else {
if ((sr.objectType == ObjectType.CITY || sr.objectType == ObjectType.VILLAGE) && sr.file != null) { if ((sr.objectType == ObjectType.CITY || sr.objectType == ObjectType.VILLAGE)
&& sr.file != null && sr.object instanceof City) {
City c = (City) sr.object; City c = (City) sr.object;
if (c.getStreets().isEmpty()) { if (c.getStreets().isEmpty()) {
try { try {
@ -108,7 +109,6 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
return; return;
} }
} catch (IOException e) { } catch (IOException e) {
dialogFragment.completeQueryWithObject(sr);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -214,18 +214,13 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
FavouritePoint fav = (FavouritePoint) object; FavouritePoint fav = (FavouritePoint) object;
pointDescription = fav.getPointDescription(); pointDescription = fav.getPointDescription();
break; break;
case VILLAGE:
case CITY: case CITY:
String cityName = searchResult.localeName; String cityName = searchResult.localeName;
String typeNameCity = QuickSearchListItem.getTypeName(app, searchResult); String typeNameCity = QuickSearchListItem.getTypeName(app, searchResult);
pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, typeNameCity, cityName); pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, typeNameCity, cityName);
pointDescription.setIconName("ic_action_building_number"); pointDescription.setIconName("ic_action_building_number");
break; break;
case VILLAGE:
String villageName = searchResult.localeName;
String typeNameVillage = QuickSearchListItem.getTypeName(app, searchResult);
pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, typeNameVillage, villageName);
pointDescription.setIconName("ic_action_building_number");
break;
case STREET: case STREET:
String streetName = searchResult.localeName; String streetName = searchResult.localeName;
String typeNameStreet = QuickSearchListItem.getTypeName(app, searchResult); String typeNameStreet = QuickSearchListItem.getTypeName(app, searchResult);