From e11e87384c72836d9b17d07405de42b1ce3e3cdb Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 24 Mar 2017 23:01:46 +0300 Subject: [PATCH] Fixed search keyboard and sort cities --- OsmAnd-java/src/net/osmand/search/SearchUICore.java | 2 +- .../osmand/plus/search/QuickSearchDialogFragment.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/net/osmand/search/SearchUICore.java index f449931012..12b41294ad 100644 --- a/OsmAnd-java/src/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/net/osmand/search/SearchUICore.java @@ -536,7 +536,7 @@ public class SearchUICore { if (o1.getFoundWordCount() != o2.getFoundWordCount()) { return -Algorithms.compare(o1.getFoundWordCount(), o2.getFoundWordCount()); } - if (!sortByName || sp.isEmpty()) { + if (!sortByName) { double s1 = o1.getSearchDistance(loc); double s2 = o2.getSearchDistance(loc); int cmp = Double.compare(s1, s2); diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index f1cfcf94d9..de6d951003 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -1313,6 +1313,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC searchUICore.updateSettings(settings.setRadiusLevel(1)); } runCoreSearch(txt, false, false); + if (sr.objectType == ObjectType.CITY) { + searchEditText.requestFocus(); + AndroidUtils.softKeyboardDelayed(searchEditText); + } } public void replaceQueryWithUiFilter(PoiUIFilter filter, String nameFilter) { @@ -1484,6 +1488,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC historySearchFragment.updateLocation(latLon, heading); } else if (categoriesSearchFragment != null && viewPager.getCurrentItem() == 1) { categoriesSearchFragment.updateLocation(latLon, heading); + } else if (addrSearchFragment != null && viewPager.getCurrentItem() == 2) { + addrSearchFragment.updateLocation(latLon, heading); } } } @@ -1499,6 +1505,9 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC if (categoriesSearchFragment != null) { categoriesSearchFragment.getListAdapter().setUseMapCenter(useMapCenter); } + if (addrSearchFragment != null) { + addrSearchFragment.getListAdapter().setUseMapCenter(useMapCenter); + } } }