public void init(@Observes @EventType(Events.EVENT_DISPLAYED_EVENT) SimpleEvent se) {
images = new ArrayList<ImageHandler>();
setFacebookNeedsUpdate(false);
setGoogleNeedsUpdate(false);
Event event = model.getSelectedEvent();
// add local images into the list
for (Image i : event.getShelf().getImages()) {
images.add(new ImageHandler(i));
}
/*
* Facebook
*/
List<String> facebookIds = event.getFacebookAlbumIds();
if (facebookIds.size() != 0) {
// check if albums are loaded
emptyFacebookIds = new ArrayList<String>(Collections2.filter(facebookIds, new Predicate<String>() {
@Override
public boolean apply(String id) {
return !fac.isAlbumLoaded(id);
}
}));
facebookAlbumIds = new ArrayList<String>(Collections2.filter(facebookIds, new Predicate<String>() {
@Override
public boolean apply(String id) {
return fac.isAlbumLoaded(id);
}
}));
// set up the id
setFbAlbumIds(ListConverter.sListToString(emptyFacebookIds));
// load the loaded images
for (String lId : facebookAlbumIds) {
for (JSONObject fImage : fac.getImagesFromAlbum(lId)) {
images.add(new ImageHandler(fImage));
}
}
setFacebookNeedsUpdate(emptyFacebookIds.size() > 0);
}
/*
* Google+
*/
emptyGoogleIds = new LinkedList<String>();
googleAlbumIds = new ArrayList<String>();
googleAlbumIds = event.getGooglePlusAlbumIds();
if (googleAlbumIds.size() != 0) {
for (String fullId : googleAlbumIds) {
if (!gpac.isAlbumLoaded(fullId)) {