use of net.osmand.plus.plugins.parking.ParkingPositionPlugin in project Osmand by osmandapp.
the class FavoritesSettingsItem method apply.
@Override
public void apply() {
List<FavoriteGroup> newItems = getNewItems();
if (personalGroup != null) {
duplicateItems.add(personalGroup);
}
if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
appliedItems = new ArrayList<>(newItems);
for (FavoriteGroup duplicate : duplicateItems) {
boolean isPersonal = duplicate.isPersonal();
boolean replace = shouldReplace || isPersonal;
if (replace) {
FavoriteGroup existingGroup = favoritesHelper.getGroup(duplicate.getName());
if (existingGroup != null) {
List<FavouritePoint> favouritePoints = new ArrayList<>(existingGroup.getPoints());
for (FavouritePoint favouritePoint : favouritePoints) {
favoritesHelper.deleteFavourite(favouritePoint, false);
}
}
}
if (!isPersonal) {
appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
} else {
for (FavouritePoint item : duplicate.getPoints()) {
if (item.getSpecialPointType() == FavouritePoint.SpecialPointType.PARKING) {
ParkingPositionPlugin plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class);
if (plugin != null) {
plugin.clearParkingPosition();
boolean isTimeRestricted = item.getTimestamp() > 0;
plugin.setParkingType(isTimeRestricted);
plugin.setParkingTime(isTimeRestricted ? item.getTimestamp() : 0);
plugin.setParkingStartTime(item.getCreationDate());
plugin.setParkingPosition(item.getLatitude(), item.getLongitude());
plugin.addOrRemoveParkingEvent(item.getCalendarEvent());
if (item.getCalendarEvent()) {
plugin.addCalendarEvent(app);
}
}
}
}
}
}
List<FavouritePoint> favourites = getPointsFromGroups(appliedItems);
for (FavouritePoint favourite : favourites) {
favoritesHelper.addFavourite(favourite, false, false);
}
favoritesHelper.sortAll();
favoritesHelper.saveCurrentPointsIntoFile();
favoritesHelper.loadFavorites();
}
}
use of net.osmand.plus.plugins.parking.ParkingPositionPlugin in project Osmand by osmandapp.
the class OsmandPlugin method initPlugins.
public static void initPlugins(@NonNull OsmandApplication app) {
Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
allPlugins.clear();
allPlugins.add(new WikipediaPlugin(app));
allPlugins.add(new OsmandRasterMapsPlugin(app));
allPlugins.add(new OsmandMonitoringPlugin(app));
checkMarketPlugin(app, new SRTMPlugin(app));
checkMarketPlugin(app, new NauticalMapsPlugin(app));
checkMarketPlugin(app, new SkiMapsPlugin(app));
allPlugins.add(new AudioVideoNotesPlugin(app));
checkMarketPlugin(app, new ParkingPositionPlugin(app));
allPlugins.add(new OsmEditingPlugin(app));
allPlugins.add(new OpenPlaceReviewsPlugin(app));
allPlugins.add(new MapillaryPlugin(app));
allPlugins.add(new AccessibilityPlugin(app));
allPlugins.add(new OsmandDevelopmentPlugin(app));
loadCustomPlugins(app);
registerAppInitializingDependedProperties(app);
enablePluginsByDefault(app, enabledPlugins);
activatePlugins(app, enabledPlugins);
}
Aggregations