From 0ce73fac0780bb46dd58c0673a2d9f83f5e14c83 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 9 Nov 2016 17:14:05 +0300 Subject: [PATCH] Fix search position --- .../search/QuickSearchDialogFragment.java | 20 ++++++++++++++++--- .../plus/search/QuickSearchListAdapter.java | 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 7666639d61..38cdae5d12 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -611,16 +611,16 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC } public void show() { + paused = false; if (useMapCenter) { LatLon mapCenter = getMapActivity().getMapView().getCurrentRotatedTileBox().getCenterLatLon(); SearchSettings ss = searchUICore.getSearchSettings().setOriginalLocation( new LatLon(mapCenter.getLatitude(), mapCenter.getLongitude())); searchUICore.updateSettings(ss); updateUseMapCenterUI(); - updateLocationUI(mapCenter, null); + forceUpdateLocationUI(mapCenter, null); } getDialog().show(); - paused = false; hidden = false; if (interruptedSearch) { interruptedSearch = false; @@ -992,7 +992,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC private void runSearch(String text) { showProgressBar(); - SearchSettings settings = searchUICore.getSearchSettings(); + SearchSettings settings = searchUICore.getPhrase().getSettings(); if (settings.getRadiusLevel() != 1) { searchUICore.updateSettings(settings.setRadiusLevel(1)); } @@ -1326,6 +1326,20 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC } } + private void forceUpdateLocationUI(LatLon latLon, Float heading) { + if (latLon != null) { + if (mainSearchFragment != null) { + mainSearchFragment.updateLocation(latLon, heading); + } + if (historySearchFragment != null) { + historySearchFragment.updateLocation(latLon, heading); + } + if (categoriesSearchFragment != null) { + categoriesSearchFragment.updateLocation(latLon, heading); + } + } + } + private void updateUseMapCenterUI() { if (!paused && !cancelPrev) { if (mainSearchFragment != null) { diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java index a389292136..1480ce9c6c 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java @@ -405,6 +405,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { private void updateDistanceDirection(View view, QuickSearchListItem listItem) { TextView distanceText = (TextView) view.findViewById(R.id.distance); ImageView direction = (ImageView) view.findViewById(R.id.direction); + /* SearchPhrase phrase = listItem.getSearchResult().requiredSearchPhrase; LatLon loc = location; if(phrase != null && useMapCenter) { @@ -413,7 +414,8 @@ public class QuickSearchListAdapter extends ArrayAdapter { loc = ol; } } - DashLocationFragment.updateLocationView(useMapCenter, loc, + */ + DashLocationFragment.updateLocationView(useMapCenter, location, heading, direction, distanceText, listItem.getSearchResult().location.getLatitude(), listItem.getSearchResult().location.getLongitude(),