Updated search history for address search
This commit is contained in:
parent
bf73d4cc49
commit
15f061e697
3 changed files with 25 additions and 11 deletions
|
@ -53,6 +53,14 @@ public class PointDescription {
|
|||
}
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName){
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ public class SearchAddressFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
boolean light = getApplication().getSettings().isLightActionBar();
|
||||
Menu menu = onCreate;
|
||||
int orientation = ScreenOrientationHelper.getScreenOrientation(getActivity());
|
||||
boolean portrait = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
|
||||
|
@ -93,7 +92,6 @@ public class SearchAddressFragment extends Fragment {
|
|||
} else {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
light = false;
|
||||
}
|
||||
if(getActivity() instanceof SearchAddressActivity) {
|
||||
MenuItem menuItem = menu.add(0, SELECT_POINT, 0, "");
|
||||
|
@ -353,21 +351,31 @@ public class SearchAddressFragment extends Fragment {
|
|||
return;
|
||||
}
|
||||
AddressInformation ai = new AddressInformation();
|
||||
PointDescription pointDescription = ai.getHistoryName();
|
||||
if (!Algorithms.isEmpty(street2) && !Algorithms.isEmpty(street)) {
|
||||
ai = AddressInformation.build2StreetIntersection(getActivity(), osmandSettings);
|
||||
pointDescription.setName(street2);
|
||||
pointDescription.setTypeName(region + ", " + city);
|
||||
} else if (!Algorithms.isEmpty(building)) {
|
||||
ai = AddressInformation.buildBuilding(getActivity(), osmandSettings);
|
||||
pointDescription.setName(street + ", " + building);
|
||||
pointDescription.setTypeName(region + ", " + city);
|
||||
} else if (!Algorithms.isEmpty(street)) {
|
||||
ai = AddressInformation.buildStreet(getActivity(), osmandSettings);
|
||||
pointDescription.setName(street);
|
||||
pointDescription.setTypeName(region + ", " + city);
|
||||
} else if(!Algorithms.isEmpty(city)) {
|
||||
ai = AddressInformation.buildCity(getActivity(), osmandSettings);
|
||||
pointDescription.setName(city);
|
||||
pointDescription.setTypeName(region);
|
||||
}
|
||||
|
||||
if(mode == ADD_TO_FAVORITE) {
|
||||
Bundle b = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(),
|
||||
ai.getHistoryName());
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(),
|
||||
pointDescription);
|
||||
} else if(mode == SELECT_POINT ){
|
||||
Intent intent = getActivity().getIntent();
|
||||
intent.putExtra(SELECT_ADDRESS_POINT_INTENT_KEY, ai.objectName);
|
||||
|
@ -377,11 +385,11 @@ public class SearchAddressFragment extends Fragment {
|
|||
getActivity().finish();
|
||||
} else {
|
||||
if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
|
||||
} else if (mode == SHOW_ON_MAP) {
|
||||
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, ai.getHistoryName());
|
||||
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, pointDescription);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
|
@ -20,7 +19,6 @@ import net.osmand.util.Algorithms;
|
|||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -90,7 +88,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
} else {
|
||||
loc = new LatLon(0f, 0f);
|
||||
}
|
||||
setupFavorites();
|
||||
setupRecents();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +96,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
super.onPause();
|
||||
}
|
||||
|
||||
public void setupFavorites(){
|
||||
public void setupRecents(){
|
||||
View mainView = getView();
|
||||
SearchHistoryHelper helper = SearchHistoryHelper.getInstance((OsmandApplication) getActivity().getApplicationContext());
|
||||
points = helper.getHistoryEntries();
|
||||
|
|
Loading…
Reference in a new issue