use of com.bourke.glimmr.event.Events.IPhotoInfoReadyListener in project glimmr by brk3.
the class MainActivity method startViewerForActivityItem.
private void startViewerForActivityItem(int itemPos) {
setProgressBarIndeterminateVisibility(Boolean.TRUE);
List<Item> items = ActivityNotificationHandler.loadItemList(MainActivity.this);
Item item = items.get(itemPos);
new LoadPhotoInfoTask(new IPhotoInfoReadyListener() {
@Override
public void onPhotoInfoReady(final Photo photo, Exception e) {
setProgressBarIndeterminateVisibility(Boolean.FALSE);
if (FlickrHelper.getInstance().handleFlickrUnavailable(MainActivity.this, e)) {
return;
}
if (photo == null) {
Log.e(TAG, "onPhotoInfoReady: photo is null, " + "can't start viewer");
return;
}
List<Photo> photos = new ArrayList<Photo>();
photos.add(photo);
setProgressBarIndeterminateVisibility(Boolean.FALSE);
PhotoViewerActivity.startPhotoViewer(MainActivity.this, photos, 0);
}
}, item.getId(), item.getSecret()).execute(mOAuth);
}
use of com.bourke.glimmr.event.Events.IPhotoInfoReadyListener in project glimmr by brk3.
the class ActivityNotificationHandler method showNotification.
private void showNotification(final Item item, final int eventOffset) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "showNotification for " + item.getTitle() + ", starting ajax task to fetch the item image");
}
/* fetch the photo the item refers to */
new LoadPhotoInfoTask(new IPhotoInfoReadyListener() {
@Override
public void onPhotoInfoReady(final Photo photo, Exception e) {
/* fetch the photo bitmap to be shown in the notification */
String url = photo.getMediumUrl();
new DownloadPhotoTask(mContext, new Events.IPhotoDownloadedListener() {
@Override
public void onPhotoDownloaded(Bitmap bitmap, Exception e) {
onItemPhotoReady(item, photo, bitmap, eventOffset);
}
}, url).execute();
}
}, item.getId(), item.getSecret()).execute(mOAuth);
}
Aggregations