diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index d8f64379ef..4bdebfce49 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -2468,6 +2468,7 @@ If you need help with OsmAnd application, please contact our support team: suppo
Action %d
Screen %d
Add marker
+ Add GPX waypoint
Add action
Edit action
Add favorite
@@ -2482,6 +2483,7 @@ If you need help with OsmAnd application, please contact our support team: suppo
Action name
Name
Tap on action will add marker to the specified location.
+ Tap on action will add GPX waypiont to the specified location.
Show favorite dialog
" is saved to "
Place
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
index 755c6631df..4aaf0a76dd 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java
@@ -54,6 +54,7 @@ public class QuickActionFactory {
quickActions.add(new FavoriteAction());
quickActions.add(new ShowHideFavoritesAction());
quickActions.add(new ShowHidePoiAction());
+ quickActions.add(new GPXAction());
return quickActions;
}
@@ -77,6 +78,9 @@ public class QuickActionFactory {
case ShowHidePoiAction.TYPE:
return new ShowHidePoiAction();
+ case GPXAction.TYPE:
+ return new GPXAction();
+
default:
return new QuickAction();
}
@@ -101,6 +105,9 @@ public class QuickActionFactory {
case ShowHidePoiAction.TYPE:
return new ShowHidePoiAction(quickAction);
+ case GPXAction.TYPE:
+ return new GPXAction(quickAction);
+
default:
return quickAction;
}
@@ -390,6 +397,8 @@ public class QuickActionFactory {
activity.getMyApplication().getSettings().SHOW_FAVORITES.set(
!activity.getMyApplication().getSettings().SHOW_FAVORITES.get());
+
+ activity.getMapLayers().updateLayers(activity.getMapView());
}
@Override
@@ -430,6 +439,8 @@ public class QuickActionFactory {
pf.loadSelectedPoiFilters();
} else pf.hidePoiFilters();
+
+ activity.getMapLayers().updateLayers(activity.getMapView());
}
@Override
@@ -444,4 +455,47 @@ public class QuickActionFactory {
parent.addView(view);
}
}
+
+ public static class GPXAction extends QuickAction {
+
+ public static final int TYPE = 6;
+
+ private GPXAction() {
+ id = System.currentTimeMillis();
+ type = TYPE;
+ nameRes = R.string.quick_action_add_gpx;
+ iconRes = R.drawable.ic_action_flag_dark;
+ }
+
+ public GPXAction(QuickAction quickAction) {
+ super(quickAction);
+ }
+
+ @Override
+ public void execute(MapActivity activity) {
+
+ LatLon latLon = activity.getMapView()
+ .getCurrentRotatedTileBox()
+ .getCenterLatLon();
+
+ PointDescription pointDescription = new PointDescription(
+ latLon.getLatitude(),
+ latLon.getLongitude());
+
+ activity.getContextMenu().init(latLon, pointDescription, null);
+ activity.getContextMenu().addWptPt();
+ }
+
+ @Override
+ public void drawUI(ViewGroup parent, MapActivity activity) {
+
+ View view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.quick_action_with_text, parent, false);
+
+ ((TextView) view.findViewById(R.id.text)).setText(
+ R.string.quick_action_add_gpx_discr);
+
+ parent.addView(view);
+ }
+ }
}