Search in sources :

Example 1 with ImageAdapter

use of io.jawg.osmcontributor.ui.adapters.ImageAdapter in project osm-contributor by jawg.

the class PhotoActivity method onPhotosFoundEvent.

/*=========================================*/
/*---------------EVENTS--------------------*/
/*=========================================*/
/**
 * Event called when GetFlickrPhotos AsyncTask is done.
 *
 * @param photosFoundEvent event with photos found
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPhotosFoundEvent(PhotosFoundEvent photosFoundEvent) {
    List<List<Size>> photos = photosFoundEvent.getPhotos();
    if (photos != null && !photos.isEmpty() && photosFoundEvent.getPoiId().equals(poiId)) {
        noPhotos.setVisibility(View.INVISIBLE);
        gridPhotos.setVisibility(View.VISIBLE);
        imageAdapter = new ImageAdapter(this, poiId);
        gridPhotos.setAdapter(imageAdapter);
        for (List<Size> size : photos) {
            imageAdapter.addPhoto(size.get(Size.SQUARE).getSource(), poiId, Size.SQUARE);
            imageAdapter.addPhoto(size.get(Size.ORIGINAL).getSource(), poiId, Size.ORIGINAL);
        }
    } else {
        noPhotos.setVisibility(View.VISIBLE);
        gridPhotos.setVisibility(View.INVISIBLE);
    }
    loadingImage.setVisibility(View.INVISIBLE);
}
Also used : ImageAdapter(io.jawg.osmcontributor.ui.adapters.ImageAdapter) Size(com.flickr4java.flickr.photos.Size) List(java.util.List) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Size (com.flickr4java.flickr.photos.Size)1 ImageAdapter (io.jawg.osmcontributor.ui.adapters.ImageAdapter)1 List (java.util.List)1 Subscribe (org.greenrobot.eventbus.Subscribe)1