From d02a770785b7828ef34d1dcea51a978f9fb49a3a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 5 Aug 2016 15:29:40 +0300 Subject: [PATCH] Small refactoring --- .../plus/search/QuickSearchDialogFragment.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 7306fb4e7a..4c3ba6b4f2 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -764,8 +764,13 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC @Override public boolean publish(SearchResult object) { if (paused) { + if(regionResultCollection != null && regionResultCollection.getCurrentSearchResults().size() > 0) { + getResultCollection().addSearchResults(regionResultCollection.getCurrentSearchResults(), true, true); + regionResultCollection = null; + } if (results.size() > 0) { getResultCollection().addSearchResults(results, true, true); + results.clear(); } return false; } @@ -784,14 +789,17 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC } regionResultApi = null; regionResultCollection = null; - results = new ArrayList<>(); + results.clear(); showApiResults(apiResults, phrase, hasRegionCollection); break; case SEARCH_API_REGION_FINISHED: regionResultApi = (SearchCoreAPI) object.object; final SearchPhrase regionPhrase = object.requiredSearchPhrase; - regionResultCollection = new SearchResultCollection(regionPhrase); + if(regionResultCollection == null) { + regionResultCollection = new SearchResultCollection(regionPhrase); + } regionResultCollection.addSearchResults(results, true, true); + results.clear(); showRegionResults(regionPhrase, regionResultCollection); break; case PARTIAL_LOCATION: