Add address for all favorites
This commit is contained in:
parent
e5822cdf8e
commit
0963cd00f7
1 changed files with 10 additions and 31 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue