use of net.osmand.plus.GeocodingLookupService.OnAddressLookupResult in project Osmand by osmandapp.
the class FavoriteAction method execute.
@Override
public void execute(final MapActivity activity) {
final LatLon latLon = activity.getMapView().getCurrentRotatedTileBox().getCenterLatLon();
final String title = getParams().get(KEY_NAME);
if (title == null || title.isEmpty()) {
progressDialog = createProgressDialog(activity, new DialogOnClickListener() {
@Override
public void skipOnClick() {
onClick(activity.getString(R.string.favorite), !Boolean.valueOf(getParams().get(KEY_DIALOG)));
}
@Override
public void enterNameOnClick() {
onClick("", false);
}
private void onClick(String title, boolean autoFill) {
activity.getMyApplication().getGeocodingLookupService().cancel(lookupRequest);
dismissProgressDialog();
addFavorite(activity, latLon, title, autoFill);
}
});
progressDialog.show();
lookupRequest = new AddressLookupRequest(latLon, new OnAddressLookupResult() {
@Override
public void geocodingDone(String address) {
dismissProgressDialog();
addFavorite(activity, latLon, address, !Boolean.valueOf(getParams().get(KEY_DIALOG)));
}
}, null);
activity.getMyApplication().getGeocodingLookupService().lookupAddress(lookupRequest);
} else {
addFavorite(activity, latLon, title, !Boolean.valueOf(getParams().get(KEY_DIALOG)));
}
}
use of net.osmand.plus.GeocodingLookupService.OnAddressLookupResult in project Osmand by osmandapp.
the class MapMarkersListAdapter method lookupLocationAddress.
private void lookupLocationAddress(OsmandApplication app) {
LatLon loc = new LatLon(myLoc.getLatitude(), myLoc.getLongitude());
if (locRequest == null || !locRequest.getLatLon().equals(loc)) {
if (locRequest != null) {
app.getGeocodingLookupService().cancel(locRequest);
}
locRequest = new AddressLookupRequest(loc, new OnAddressLookupResult() {
@Override
public void geocodingDone(String address) {
locRequest = null;
locDescription.setName(address);
if (showLocationItem) {
notifyItemChanged(0);
}
}
}, null);
app.getGeocodingLookupService().lookupAddress(locRequest);
}
}
Aggregations