Search in sources :

Example 1 with IPhotoInfoReadyListener

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);
}
Also used : MenuItem(android.view.MenuItem) Item(com.googlecode.flickrjandroid.activity.Item) ArrayList(java.util.ArrayList) Photo(com.googlecode.flickrjandroid.photos.Photo) LoadPhotoInfoTask(com.bourke.glimmr.tasks.LoadPhotoInfoTask) IPhotoInfoReadyListener(com.bourke.glimmr.event.Events.IPhotoInfoReadyListener)

Example 2 with IPhotoInfoReadyListener

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);
}
Also used : Bitmap(android.graphics.Bitmap) Photo(com.googlecode.flickrjandroid.photos.Photo) DownloadPhotoTask(com.bourke.glimmr.tasks.DownloadPhotoTask) LoadPhotoInfoTask(com.bourke.glimmr.tasks.LoadPhotoInfoTask) IPhotoInfoReadyListener(com.bourke.glimmr.event.Events.IPhotoInfoReadyListener)

Aggregations

IPhotoInfoReadyListener (com.bourke.glimmr.event.Events.IPhotoInfoReadyListener)2 LoadPhotoInfoTask (com.bourke.glimmr.tasks.LoadPhotoInfoTask)2 Photo (com.googlecode.flickrjandroid.photos.Photo)2 Bitmap (android.graphics.Bitmap)1 MenuItem (android.view.MenuItem)1 DownloadPhotoTask (com.bourke.glimmr.tasks.DownloadPhotoTask)1 Item (com.googlecode.flickrjandroid.activity.Item)1 ArrayList (java.util.ArrayList)1