diff --git a/OsmAnd-java/src/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/net/osmand/search/SearchUICore.java index 62594e034e..dde255c7e9 100644 --- a/OsmAnd-java/src/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/net/osmand/search/SearchUICore.java @@ -269,6 +269,16 @@ public class SearchUICore { } } + public void apiSearchRegionFinished(SearchCoreAPI api, BinaryMapIndexReader region, SearchPhrase phrase) { + if(matcher != null) { + SearchResult sr = new SearchResult(phrase); + sr.objectType = ObjectType.SEARCH_API_REGION_FINISHED; + sr.object = api; + sr.file = region; + matcher.publish(sr); + } + } + @Override public boolean publish(SearchResult object) { if(matcher == null || matcher.publish(object)) { diff --git a/OsmAnd-java/src/net/osmand/search/core/ObjectType.java b/OsmAnd-java/src/net/osmand/search/core/ObjectType.java index 928573136b..2963e92126 100644 --- a/OsmAnd-java/src/net/osmand/search/core/ObjectType.java +++ b/OsmAnd-java/src/net/osmand/search/core/ObjectType.java @@ -9,8 +9,10 @@ public enum ObjectType { LOCATION(true), PARTIAL_LOCATION(false), // UI OBJECTS FAVORITE(true), WPT(true), RECENT_OBJ(true), + REGION(true), - SEARCH_API_FINISHED(false), UNKNOWN_NAME_FILTER(false); + SEARCH_API_FINISHED(false), SEARCH_API_REGION_FINISHED(false), + UNKNOWN_NAME_FILTER(false); private boolean hasLocation; private ObjectType(boolean location) { this.hasLocation = location; diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java index e989a70b5c..380656e28a 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java @@ -160,6 +160,7 @@ public class SearchCoreFactory { // phrase.isLastWord(ObjectType.CITY, ObjectType.VILLAGE, ObjectType.POSTCODE) || phrase.isLastWord(ObjectType.REGION) if (phrase.isNoSelectedType() || phrase.getRadiusLevel() >= 2) { initAndSearchCities(phrase, resultMatcher); + resultMatcher.apiSearchFinished(this, phrase); searchByName(phrase, resultMatcher); } return true; @@ -320,6 +321,7 @@ public class SearchCoreFactory { req.setBBoxRadius(loc.getLatitude(), loc.getLongitude(), phrase.getRadiusSearch(DEFAULT_ADDRESS_BBOX_RADIUS * 10)); } r.searchAddressDataByName(req); + resultMatcher.apiSearchRegionFinished(this, r, phrase); } } } @@ -376,6 +378,7 @@ public class SearchCoreFactory { BinaryMapIndexReader r = offlineIterator.next(); currentFile[0] = r; r.searchPoiByName(req); + resultMatcher.apiSearchRegionFinished(this, r, phrase); } return true; } @@ -572,6 +575,7 @@ public class SearchCoreFactory { for (BinaryMapIndexReader o : oo) { selected[0] = o; o.searchPoi(req); + resultMatcher.apiSearchRegionFinished(this, o, phrase); } } return true;