[Quick search] produce Favs from history, fix context menu of history locationobject

This commit is contained in:
Alexey Kulish 2016-07-29 10:59:05 +03:00
parent d1a8ad087b
commit bb6ddf6e13
2 changed files with 24 additions and 7 deletions

View file

@ -40,6 +40,11 @@ public class HistoryMenuController extends MenuController {
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN;
}
@Override
public boolean displayStreetNameInTitle() {
return entry.getName().isLocation();
}
@Override
public boolean displayDistanceDirection() {
return true;

View file

@ -160,13 +160,25 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
break;
case RECENT_OBJ:
HistoryEntry entry = (HistoryEntry) object;
pointDescription = entry.getName();
if (pointDescription.isPoi()) {
Amenity amenity = findAmenity(entry.getName().getName(), entry.getLat(), entry.getLon(), lang);
if (amenity != null) {
object = amenity;
pointDescription = new PointDescription(PointDescription.POINT_TYPE_POI,
OsmAndFormatter.getPoiStringWithoutType(amenity, lang));
} else {
pointDescription = entry.getName();
}
} else if (pointDescription.isFavorite()) {
LatLon entryLatLon = new LatLon(entry.getLat(), entry.getLon());
List<FavouritePoint> favs = app.getFavorites().getFavouritePoints();
for (FavouritePoint f : favs) {
if (entryLatLon.equals(new LatLon(f.getLatitude(), f.getLongitude()))
&& pointDescription.getName().equals(f.getName())) {
object = f;
pointDescription = f.getPointDescription();
break;
}
}
}
break;
case FAVORITE: