Fix search position

This commit is contained in:
Alexey Kulish 2016-11-09 17:14:05 +03:00
parent 71055fe315
commit a7311bee9e
2 changed files with 20 additions and 4 deletions

View file

@ -611,16 +611,16 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
} }
public void show() { public void show() {
paused = false;
if (useMapCenter) { if (useMapCenter) {
LatLon mapCenter = getMapActivity().getMapView().getCurrentRotatedTileBox().getCenterLatLon(); LatLon mapCenter = getMapActivity().getMapView().getCurrentRotatedTileBox().getCenterLatLon();
SearchSettings ss = searchUICore.getSearchSettings().setOriginalLocation( SearchSettings ss = searchUICore.getSearchSettings().setOriginalLocation(
new LatLon(mapCenter.getLatitude(), mapCenter.getLongitude())); new LatLon(mapCenter.getLatitude(), mapCenter.getLongitude()));
searchUICore.updateSettings(ss); searchUICore.updateSettings(ss);
updateUseMapCenterUI(); updateUseMapCenterUI();
updateLocationUI(mapCenter, null); forceUpdateLocationUI(mapCenter, null);
} }
getDialog().show(); getDialog().show();
paused = false;
hidden = false; hidden = false;
if (interruptedSearch) { if (interruptedSearch) {
interruptedSearch = false; interruptedSearch = false;
@ -992,7 +992,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
private void runSearch(String text) { private void runSearch(String text) {
showProgressBar(); showProgressBar();
SearchSettings settings = searchUICore.getSearchSettings(); SearchSettings settings = searchUICore.getPhrase().getSettings();
if (settings.getRadiusLevel() != 1) { if (settings.getRadiusLevel() != 1) {
searchUICore.updateSettings(settings.setRadiusLevel(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() { private void updateUseMapCenterUI() {
if (!paused && !cancelPrev) { if (!paused && !cancelPrev) {
if (mainSearchFragment != null) { if (mainSearchFragment != null) {

View file

@ -405,6 +405,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
private void updateDistanceDirection(View view, QuickSearchListItem listItem) { private void updateDistanceDirection(View view, QuickSearchListItem listItem) {
TextView distanceText = (TextView) view.findViewById(R.id.distance); TextView distanceText = (TextView) view.findViewById(R.id.distance);
ImageView direction = (ImageView) view.findViewById(R.id.direction); ImageView direction = (ImageView) view.findViewById(R.id.direction);
/*
SearchPhrase phrase = listItem.getSearchResult().requiredSearchPhrase; SearchPhrase phrase = listItem.getSearchResult().requiredSearchPhrase;
LatLon loc = location; LatLon loc = location;
if(phrase != null && useMapCenter) { if(phrase != null && useMapCenter) {
@ -413,7 +414,8 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
loc = ol; loc = ol;
} }
} }
DashLocationFragment.updateLocationView(useMapCenter, loc, */
DashLocationFragment.updateLocationView(useMapCenter, location,
heading, direction, distanceText, heading, direction, distanceText,
listItem.getSearchResult().location.getLatitude(), listItem.getSearchResult().location.getLatitude(),
listItem.getSearchResult().location.getLongitude(), listItem.getSearchResult().location.getLongitude(),