Upgrade to 1.6 and show poi information on long press
This commit is contained in:
parent
428ff147d6
commit
ea50c82122
3 changed files with 21 additions and 14 deletions
|
@ -7,7 +7,7 @@
|
|||
<!-- comment change build properties for release & set targetSdkVersion="7", build and reverse changes-->
|
||||
<!-- <uses-sdk android:minSdkVersion="3"/> -->
|
||||
<!-- uncomment it to allow different screen supports (large/small)-->
|
||||
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4"/>
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:debuggable="true" android:name="net.osmand.plus.activities.OsmandApplication" android:description="@string/app_description"
|
||||
|
|
|
@ -921,7 +921,8 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
|
|||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
//some application/hardware needs that back button reacts on key up, so
|
||||
//that they could do some key combinations with it...
|
||||
onBackPressed();
|
||||
// Android 1.6 doesn't have onBack method!
|
||||
finish();
|
||||
return true;
|
||||
} else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
|
||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
|
|
|
@ -102,6 +102,16 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
if (i > 0) {
|
||||
res.append("\n\n");
|
||||
}
|
||||
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) {
|
||||
|
@ -113,11 +123,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
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$
|
||||
}
|
||||
}
|
||||
Toast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue