diff --git a/OsmAnd/src/net/osmand/data/PointDescription.java b/OsmAnd/src/net/osmand/data/PointDescription.java index bf01a5e2fa..4b8e2ddd0a 100644 --- a/OsmAnd/src/net/osmand/data/PointDescription.java +++ b/OsmAnd/src/net/osmand/data/PointDescription.java @@ -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; } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java index 3c66d2540d..62067ded20 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java @@ -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()); } } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashRecentsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashRecentsFragment.java index 7effa1fce7..016fdff414 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashRecentsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashRecentsFragment.java @@ -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();