Hide parking point when ParkingPositionPlugin disabled
This commit is contained in:
parent
c3637d72ca
commit
ad748343d8
3 changed files with 34 additions and 8 deletions
|
@ -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<FavoriteGroup> 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)) {
|
||||
if (key.personal) {
|
||||
ArrayList<FavouritePoint> 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<FavouritePoint> list = new ArrayList<>();
|
||||
for (FavouritePoint p : key.points) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue