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() {
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) {

View file

@ -405,6 +405,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
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<QuickSearchListItem> {
loc = ol;
}
}
DashLocationFragment.updateLocationView(useMapCenter, loc,
*/
DashLocationFragment.updateLocationView(useMapCenter, location,
heading, direction, distanceText,
listItem.getSearchResult().location.getLatitude(),
listItem.getSearchResult().location.getLongitude(),