diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 9ed92541b2..19a5b259e4 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -44,9 +44,10 @@
Tracking
This plugin provides advanced map configuration and some device-specific settings.
Advanced Settings
- This plugin facilitates a location of a parked car/bycicle.
+ The position of your parked car.
Parking point
- "The position of your parked car."
+ This plugin allows to store the location of your parked car.
+ Parking Position Plugin
This plugin enables development and debugging features like animated navigation or rendering performance display.
Osmand Development
Plugin Manager
@@ -938,7 +939,8 @@
Set as destination
Add to favorites
-Add parking place
+Add location of a parked car
+Delete location of a parked car
Update map
Open OSM bug
Create POI
diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java
index 591c07f582..975ab50fcc 100644
--- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java
+++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java
@@ -1,5 +1,6 @@
package net.osmand.plus.parkingpoint;
+import java.util.ArrayList;
import java.util.List;
import net.osmand.OsmAndFormatter;
@@ -33,28 +34,35 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
-public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider{
+/**
+ * Class represents a layer which depicts the position of the parked car
+ * @author Alena Fedasenka
+ * @see ParkingPositionPlugin
+ *
+ */
+public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
+ /**
+ * magic number so far
+ */
private static final int radius = 16;
-
- private Paint bitmapPaint;
private LatLon parkingPoint = null;
private DisplayMetrics dm;
- private Bitmap parkingPosition;
-
private final MapActivity map;
private OsmandMapTileView view;
+ private OsmandSettings settings;
+ private Paint bitmapPaint;
private Paint paintText;
private Paint paintSubText;
- private OsmandSettings settings;
-
+ private Bitmap parkingPosition;
+
private TextInfoControl parkingPlaceControl;
- public ParkingPositionLayer(MapActivity map){
+ public ParkingPositionLayer(MapActivity map) {
this.map = map;
}
@@ -107,18 +115,6 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
canvas.drawBitmap(parkingPosition, locationX - marginX, locationY - marginY, bitmapPaint);
}
}
-
- public boolean isLocationVisible(double latitude, double longitude){
- if(parkingPoint == null || view == null){
- return false;
- }
- return view.isPointOnTheRotatedMap(latitude, longitude);
- }
-
- public void setParkingPoint(LatLon point) {
- this.parkingPoint = point;
- refreshMap();
- }
@Override
public void destroyLayer() {
@@ -131,9 +127,11 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
@Override
public boolean onSingleTap(PointF point) {
- if(isParkingPointPressed(point)){
+ List parkPos = new ArrayList();
+ getParkingFromPoint(point, parkPos);
+ if(!parkPos.isEmpty()){
StringBuilder res = new StringBuilder();
- res.append(view.getContext().getString(R.string.osmand_parking_position_toast));
+ res.append(view.getContext().getString(R.string.osmand_parking_position_description));
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
return true;
}
@@ -142,57 +140,71 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
@Override
public boolean onLongPressEvent(PointF point) {
- if (isParkingPointPressed(point)) {
- Builder confirm = new AlertDialog.Builder(map);
- confirm.setPositiveButton(R.string.default_buttons_yes,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- settings.clearParkingPosition();
- refreshMap();
- }
- });
- confirm.setCancelable(true);
- confirm.setNegativeButton(R.string.default_buttons_cancel, null);
- confirm.setMessage("Do you want to remove the parking position?");
- confirm.show();
- return true;
- }
- return false;
- }
-
- private boolean isParkingPointPressed(PointF point) {
- if (parkingPoint != null) {
- int ex = (int) point.x;
- int ey = (int) point.y;
- int x = view.getRotatedMapXForPoint(settings.getParkingPosition().getLatitude(), settings.getParkingPosition().getLongitude());
- int y = view.getRotatedMapYForPoint(settings.getParkingPosition().getLatitude(), settings.getParkingPosition().getLongitude());
- if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
- return true;
- }
- }
return false;
}
@Override
public void collectObjectsFromPoint(PointF point, List