diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 35004c58eb..21f3c36359 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -44,6 +44,7 @@ import net.osmand.plus.FavouritesDbHelper.FavoritesListener; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.FavoriteImageDrawable; @@ -52,6 +53,7 @@ import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.myplaces.FavoritesFragmentStateHolder; +import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -749,6 +751,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen private Set filter; void synchronizeGroups() { + boolean isParkingPluginEnable = OsmandPlugin.getEnabledPlugin(ParkingPositionPlugin.class) != null; favoriteGroups.clear(); groups.clear(); List disablesGroups = new ArrayList<>(); @@ -757,8 +760,31 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen for (FavoriteGroup key : gs) { boolean empty = true; if (flt == null || flt.contains(key)) { - empty = false; - favoriteGroups.put(key, new ArrayList<>(key.points)); + if (key.personal) { + ArrayList list = new ArrayList<>(); + for (FavouritePoint p : key.points) { + if (p.getName().equals(FavouritePoint.PointType.PARKING.getName())) { + if (isParkingPluginEnable) { + list.add(p); + empty = false; + } + } else { + if (p.getName().equals(FavouritePoint.PointType.PARKING.getName())) { + if (isParkingPluginEnable) { + list.add(p); + empty = false; + } + } else { + list.add(p); + empty = false; + } + } + } + favoriteGroups.put(key, list); + } else { + empty = false; + favoriteGroups.put(key, new ArrayList<>(key.points)); + } } else { ArrayList list = new ArrayList<>(); for (FavouritePoint p : key.points) { diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 33c4272071..35a2264c4b 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -119,12 +119,6 @@ public class ParkingPositionPlugin extends OsmandPlugin { return parkingStartTime.get(); } - @Override - public void disable(OsmandApplication app) { - super.disable(app); - app.getFavorites().deleteParkingPoint(); - } - public boolean clearParkingPosition() { parkingLat.resetToDefault(); parkingLon.resetToDefault(); diff --git a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java index 3d9244d148..ba507eae7a 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java @@ -24,9 +24,11 @@ import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.FavoriteImageDrawable; +import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback; import net.osmand.plus.views.MapTextLayer.MapTextProvider; @@ -133,6 +135,10 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer. continue; } } + if (group.personal && o.getName().equals(FavouritePoint.PointType.PARKING.getName()) + && OsmandPlugin.getEnabledPlugin(ParkingPositionPlugin.class) == null) { + continue; + } cache.add(o); float x = tileBox.getPixXFromLatLon(lat, lon); float y = tileBox.getPixYFromLatLon(lat, lon);