From ea50c82122bebecfc3401fb4f1cd8f4dd75ea995 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 25 Jan 2012 00:57:49 +0100 Subject: [PATCH] Upgrade to 1.6 and show poi information on long press --- OsmAnd/AndroidManifest.xml | 2 +- .../osmand/plus/activities/MapActivity.java | 3 +- .../net/osmand/plus/views/POIMapLayer.java | 30 +++++++++++-------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index ec6e634976..6bccf10994 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -7,7 +7,7 @@ - + 0) { res.append("\n\n"); } - String format = OsmAndFormatter.getPoiSimpleFormat(n, view.getContext(), view.getSettings().USE_ENGLISH_NAMES.get()); - res.append(" " + format); - if (n.getOpeningHours() != null) { - res.append("\n").append(view.getContext().getString(R.string.opening_hours)).append(" : ").append(n.getOpeningHours()); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (n.getPhone() != null) { - res.append("\n").append(view.getContext().getString(R.string.phone)).append(" : ").append(n.getPhone()); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (n.getSite() != null && n.getType() != AmenityType.OSMWIKI) { - res.append("\n").append(view.getContext().getString(R.string.website)).append(" : ").append(n.getSite()); //$NON-NLS-1$ //$NON-NLS-2$ - } + buildPoiInformation(res, n); } Toast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show(); return true; } return false; } + + + private StringBuilder buildPoiInformation(StringBuilder res, Amenity n) { + String format = OsmAndFormatter.getPoiSimpleFormat(n, view.getContext(), view.getSettings().USE_ENGLISH_NAMES.get()); + res.append(" " + format); + if (n.getOpeningHours() != null) { + res.append("\n").append(view.getContext().getString(R.string.opening_hours)).append(" : ").append(n.getOpeningHours()); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (n.getPhone() != null) { + res.append("\n").append(view.getContext().getString(R.string.phone)).append(" : ").append(n.getPhone()); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (n.getSite() != null && n.getType() != AmenityType.OSMWIKI) { + res.append("\n").append(view.getContext().getString(R.string.website)).append(" : ").append(n.getSite()); //$NON-NLS-1$ //$NON-NLS-2$ + } + return res; + } @Override @@ -359,7 +365,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon @Override public String getObjectDescription(Object o) { if(o instanceof Amenity){ - return OsmAndFormatter.getPoiSimpleFormat((Amenity) o, view.getContext(), view.getSettings().USE_ENGLISH_NAMES.get()); + return buildPoiInformation(new StringBuilder(), (Amenity) o).toString(); } return null; }