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);
|
point.setAddress(address);
|
||||||
addFavourite(point);
|
addFavourite(point);
|
||||||
}
|
}
|
||||||
if (address == null) {
|
|
||||||
lookupAddress(point);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addFavourite(FavouritePoint p) {
|
public boolean addFavourite(FavouritePoint p) {
|
||||||
|
@ -287,6 +284,9 @@ public class FavouritesDbHelper {
|
||||||
if (p.getName().equals("") && flatGroups.containsKey(p.getCategory())) {
|
if (p.getName().equals("") && flatGroups.containsKey(p.getCategory())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!p.isAddressSpecified()) {
|
||||||
|
lookupAddress(p);
|
||||||
|
}
|
||||||
context.getSettings().SHOW_FAVORITES.set(true);
|
context.getSettings().SHOW_FAVORITES.set(true);
|
||||||
FavoriteGroup group = getOrCreateGroup(p, 0);
|
FavoriteGroup group = getOrCreateGroup(p, 0);
|
||||||
|
|
||||||
|
@ -305,16 +305,6 @@ public class FavouritesDbHelper {
|
||||||
return true;
|
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) {
|
public void lookupAddress(@NonNull final FavouritePoint p) {
|
||||||
AddressLookupRequest request = addressRequestMap.get(p);
|
AddressLookupRequest request = addressRequestMap.get(p);
|
||||||
double latitude = p.getLatitude();
|
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);
|
p.setAddress(address);
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean editFavouriteDescription(FavouritePoint p, String description) {
|
public boolean editFavourite(@NonNull FavouritePoint p, double lat, double lon) {
|
||||||
p.setDescription(description);
|
return editFavourite(p, lat, lon, null);
|
||||||
saveCurrentPointsIntoFile();
|
|
||||||
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
cancelAddressRequest(p);
|
||||||
p.setLatitude(lat);
|
p.setLatitude(lat);
|
||||||
p.setLongitude(lon);
|
p.setLongitude(lon);
|
||||||
|
if (description != null) {
|
||||||
p.setDescription(description);
|
p.setDescription(description);
|
||||||
|
}
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue