Search in sources :

Example 1 with PoiChanges

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);
    }
}
Also used : HashMap(java.util.HashMap) PoiChanges(io.jawg.osmcontributor.utils.edition.PoiChanges) PleaseApplyPoiChanges(io.jawg.osmcontributor.ui.events.edition.PleaseApplyPoiChanges) PleaseApplyPoiChanges(io.jawg.osmcontributor.ui.events.edition.PleaseApplyPoiChanges) Poi(io.jawg.osmcontributor.model.entities.Poi)

Aggregations

Poi (io.jawg.osmcontributor.model.entities.Poi)1 PleaseApplyPoiChanges (io.jawg.osmcontributor.ui.events.edition.PleaseApplyPoiChanges)1 PoiChanges (io.jawg.osmcontributor.utils.edition.PoiChanges)1 HashMap (java.util.HashMap)1