Add address for all favorites

This commit is contained in:
Dima-1 2020-01-08 19:01:02 +02:00
parent e5822cdf8e
commit 0963cd00f7

View file

@ -274,9 +274,6 @@ public class FavouritesDbHelper {
point.setAddress(address);
addFavourite(point);
}
if (address == null) {
lookupAddress(point);
}
}
public boolean addFavourite(FavouritePoint p) {
@ -287,6 +284,9 @@ public class FavouritesDbHelper {
if (p.getName().equals("") && flatGroups.containsKey(p.getCategory())) {
return true;
}
if (!p.isAddressSpecified()) {
lookupAddress(p);
}
context.getSettings().SHOW_FAVORITES.set(true);
FavoriteGroup group = getOrCreateGroup(p, 0);
@ -305,16 +305,6 @@ public class FavouritesDbHelper {
return true;
}
public void lookupAddressAllSpecialPoints() {
if (!context.isApplicationInitializing()) {
for (FavouritePoint p : getFavouritePoints()) {
if (p.getSpecialPointType() != null) {
lookupAddress(p);
}
}
}
}
public void lookupAddress(@NonNull final FavouritePoint p) {
AddressLookupRequest request = addressRequestMap.get(p);
double latitude = p.getLatitude();
@ -446,34 +436,23 @@ public class FavouritesDbHelper {
}
public boolean editAddressDescription(FavouritePoint p, String address) {
private void editAddressDescription(@NonNull FavouritePoint p, @Nullable String address) {
p.setAddress(address);
saveCurrentPointsIntoFile();
runSyncWithMarkers(getOrCreateGroup(p, 0));
return true;
}
public boolean editFavouriteDescription(FavouritePoint p, String description) {
p.setDescription(description);
saveCurrentPointsIntoFile();
runSyncWithMarkers(getOrCreateGroup(p, 0));
return true;
public boolean editFavourite(@NonNull FavouritePoint p, double lat, double lon) {
return editFavourite(p, lat, lon, null);
}
public boolean editFavourite(FavouritePoint p, double lat, double lon) {
private boolean editFavourite(@NonNull FavouritePoint p, double lat, double lon, @Nullable String description) {
cancelAddressRequest(p);
p.setLatitude(lat);
p.setLongitude(lon);
saveCurrentPointsIntoFile();
runSyncWithMarkers(getOrCreateGroup(p, 0));
return true;
}
public boolean editFavourite(FavouritePoint p, double lat, double lon, String description) {
cancelAddressRequest(p);
p.setLatitude(lat);
p.setLongitude(lon);
p.setDescription(description);
if (description != null) {
p.setDescription(description);
}
saveCurrentPointsIntoFile();
runSyncWithMarkers(getOrCreateGroup(p, 0));
return true;