Search in sources :

Example 1 with OAuth

use of com.googlecode.flickrjandroid.oauth.OAuth 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 OAuth

use of com.googlecode.flickrjandroid.oauth.OAuth 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 OAuth

use of com.googlecode.flickrjandroid.oauth.OAuth 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 OAuth

use of com.googlecode.flickrjandroid.oauth.OAuth 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 OAuth

use of com.googlecode.flickrjandroid.oauth.OAuth 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

OAuth (com.googlecode.flickrjandroid.oauth.OAuth)15 OAuthToken (com.googlecode.flickrjandroid.oauth.OAuthToken)13 Flickr (com.googlecode.flickrjandroid.Flickr)12 SharedPreferences (android.content.SharedPreferences)1 RequestContext (com.googlecode.flickrjandroid.RequestContext)1 User (com.googlecode.flickrjandroid.people.User)1 SearchParameters (com.googlecode.flickrjandroid.photos.SearchParameters)1 ArrayList (java.util.ArrayList)1