use of io.jawg.osmcontributor.utils.edition.PoiChanges in project osm-contributor by jawg.
the class PhotoActivity method defineImageOnPoi.
/**
* Associate the newly uploaded flickr picture to the current Poi
*
* @param imageUrl The complete URL to access this picture
*/
private void defineImageOnPoi(String imageUrl) {
if (imageUrl.length() > 0) {
Poi currentPoi = application.getOsmTemplateComponent().getPoiManager().queryForId(poiId);
Map<String, String> currentPoiTagsMap = new HashMap<String, String>(currentPoi.getTagsMap());
if (currentPoiTagsMap.containsKey(OSM_FLICKR_TAG)) {
StringBuilder newFlickrTag = new StringBuilder(currentPoiTagsMap.get(OSM_FLICKR_TAG).trim()).append(";").append(imageUrl);
currentPoiTagsMap.put(OSM_FLICKR_TAG, newFlickrTag.toString());
} else {
currentPoiTagsMap.put(OSM_FLICKR_TAG, imageUrl);
}
PoiChanges currentPoiChanges = new PoiChanges(poiId);
currentPoiChanges.setTagsMap(currentPoiTagsMap);
eventBus.post(new PleaseApplyPoiChanges(currentPoiChanges));
} else {
Log.e(TAG, "Invalid Flickr URL: " + imageUrl);
}
}
Aggregations