Search in sources :

Example 1 with Flickr

use of com.googlecode.flickrjandroid.Flickr in project glimmr by brk3.

the class LoadContactsPhotosTask method doInBackground.

@Override
protected List<Photo> doInBackground(OAuth... params) {
    OAuth oauth = params[0];
    if (oauth != null) {
        OAuthToken token = oauth.getToken();
        Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
        try {
            return f.getPhotosInterface().getContactsPhotos(Constants.FETCH_PER_PAGE, Constants.EXTRAS, false, false, false, mPage, Constants.FETCH_PER_PAGE);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    } else {
        Log.e(TAG, "LoadContactsPhotosTask requires authentication");
    }
    return null;
}
Also used : OAuthToken(com.googlecode.flickrjandroid.oauth.OAuthToken) Flickr(com.googlecode.flickrjandroid.Flickr) OAuth(com.googlecode.flickrjandroid.oauth.OAuth)

Example 2 with Flickr

use of com.googlecode.flickrjandroid.Flickr in project glimmr by brk3.

the class LoadFavoritesTask method doInBackground.

@Override
protected List<Photo> doInBackground(OAuth... params) {
    OAuth oauth = params[0];
    if (oauth != null) {
        OAuthToken token = oauth.getToken();
        Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Fetching page " + mPage);
        try {
            return f.getFavoritesInterface().getList(mUser.getId(), null, null, Constants.FETCH_PER_PAGE, mPage, Constants.EXTRAS);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    } else {
        try {
            return FlickrHelper.getInstance().getFavoritesInterface().getPublicList(mUser.getId(), null, null, Constants.FETCH_PER_PAGE, mPage, Constants.EXTRAS);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    }
    return null;
}
Also used : OAuthToken(com.googlecode.flickrjandroid.oauth.OAuthToken) Flickr(com.googlecode.flickrjandroid.Flickr) OAuth(com.googlecode.flickrjandroid.oauth.OAuth)

Example 3 with Flickr

use of com.googlecode.flickrjandroid.Flickr in project glimmr by brk3.

the class LoadFlickrActivityTask method doInBackground.

@Override
protected List<Item> doInBackground(OAuth... params) {
    OAuth oauth = params[0];
    if (oauth != null) {
        OAuthToken token = oauth.getToken();
        try {
            Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
            String timeFrame = "100d";
            int page = 1;
            return f.getActivityInterface().userPhotos(Constants.FETCH_PER_PAGE, page, timeFrame);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    } else {
        Log.e(TAG, "LoadFlickrActivityTask requires authentication");
    }
    return null;
}
Also used : OAuthToken(com.googlecode.flickrjandroid.oauth.OAuthToken) Flickr(com.googlecode.flickrjandroid.Flickr) OAuth(com.googlecode.flickrjandroid.oauth.OAuth)

Example 4 with Flickr

use of com.googlecode.flickrjandroid.Flickr in project glimmr by brk3.

the class LoadGroupPoolTask method doInBackground.

@Override
protected List<Photo> doInBackground(OAuth... params) {
    OAuth oauth = params[0];
    if (oauth != null) {
        OAuthToken token = oauth.getToken();
        Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Fetching page " + mPage);
        try {
            return f.getPoolsInterface().getPhotos(mGroup.getId(), null, Constants.EXTRAS, Constants.FETCH_PER_PAGE, mPage);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    } else {
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Making unauthenticated call");
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Fetching page " + mPage);
        try {
            return FlickrHelper.getInstance().getPoolsInterface().getPhotos(mGroup.getId(), null, Constants.EXTRAS, Constants.FETCH_PER_PAGE, mPage);
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    }
    return null;
}
Also used : OAuthToken(com.googlecode.flickrjandroid.oauth.OAuthToken) Flickr(com.googlecode.flickrjandroid.Flickr) OAuth(com.googlecode.flickrjandroid.oauth.OAuth)

Example 5 with Flickr

use of com.googlecode.flickrjandroid.Flickr in project glimmr by brk3.

the class LoadPhotosetPhotosTask method doInBackground.

@Override
protected List<Photo> doInBackground(OAuth... params) {
    OAuth oauth = params[0];
    if (oauth != null) {
        OAuthToken token = oauth.getToken();
        Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Fetching page " + mPage);
        try {
            return f.getPhotosetsInterface().getPhotos("" + mPhotoset.getId(), Constants.EXTRAS, Flickr.PRIVACY_LEVEL_NO_FILTER, Constants.FETCH_PER_PAGE, mPage).getPhotoList();
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    } else {
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Making unauthenticated call");
        if (BuildConfig.DEBUG)
            Log.d(TAG, "Fetching page " + mPage);
        try {
            return FlickrHelper.getInstance().getPhotosetsInterface().getPhotos("" + mPhotoset.getId(), Constants.EXTRAS, Flickr.PRIVACY_LEVEL_NO_FILTER, Constants.FETCH_PER_PAGE, mPage).getPhotoList();
        } catch (Exception e) {
            e.printStackTrace();
            mException = e;
        }
    }
    return null;
}
Also used : OAuthToken(com.googlecode.flickrjandroid.oauth.OAuthToken) Flickr(com.googlecode.flickrjandroid.Flickr) OAuth(com.googlecode.flickrjandroid.oauth.OAuth)

Aggregations

Flickr (com.googlecode.flickrjandroid.Flickr)21 OAuthToken (com.googlecode.flickrjandroid.oauth.OAuthToken)19 OAuth (com.googlecode.flickrjandroid.oauth.OAuth)12 FlickrException (com.googlecode.flickrjandroid.FlickrException)3 IOException (java.io.IOException)3 SearchParameters (com.googlecode.flickrjandroid.photos.SearchParameters)2 JSONException (org.json.JSONException)2 Background (com.alexvasilkov.events.Events.Background)1 Subscribe (com.alexvasilkov.events.Events.Subscribe)1 RequestContext (com.googlecode.flickrjandroid.RequestContext)1 OAuthInterface (com.googlecode.flickrjandroid.oauth.OAuthInterface)1 Photo (com.googlecode.flickrjandroid.photos.Photo)1 PhotoList (com.googlecode.flickrjandroid.photos.PhotoList)1 FileInputStream (java.io.FileInputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1