@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; }
private List<Photo> getUserPhotos() throws Exception { OAuthToken token = mOAuth.getToken(); Flickr f = FlickrHelper.getInstance() .getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret()); return f.getPeopleInterface() .getPhotos(mUser.getId(), Constants.EXTRAS, Constants.FETCH_PER_PAGE, PAGE); }
@Override protected Collection<Tag> doInBackground(Void... params) { Flickr f = FlickrHelper.getInstance().getFlickrAuthed(mContext); try { return f.getTagsInterface().getMostFrequentlyUsed(); } catch (Exception e) { if (BuildConfig.DEBUG) Log.w(TAG, "unable to get my tags: " + e.getMessage()); // $NON-NLS-1$ return null; } }
@Override public MediaObjectCollection getPhotos(int pageSize, int pageNo) throws Exception { Log.d(TAG, String.format("page size %s and page# %s", pageSize, pageNo)); // $NON-NLS-1$ Flickr f = FlickrHelper.getInstance().getFlickrAuthed(mAuthToken, mTokenSecret); PhotosetsInterface psi = f.getPhotosetsInterface(); Photoset photoset = psi.getPhotos( mPhotoset.getId(), mExtras, Flickr.PRIVACY_LEVEL_NO_FILTER, pageSize, pageNo + 1); User user = photoset.getOwner(); MediaObjectCollection col = ModelUtils.convertFlickrPhotoList(photoset.getPhotoList(), user); return col; }
/* * (non-Javadoc) * * @see android.os.AsyncTask#doInBackground(Params[]) */ @Override protected String doInBackground(Void... params) { try { Flickr f = FlickrHelper.getInstance().getFlickr(); OAuthToken oauthToken = f.getOAuthInterface().getRequestToken(OAUTH_CALLBACK_URI.toString()); saveTokenSecrent(oauthToken.getOauthTokenSecret()); URL oauthUrl = f.getOAuthInterface().buildAuthenticationUrl(Permission.WRITE, oauthToken); return oauthUrl.toString(); } catch (Exception e) { logger.error("Error to oauth", e); // $NON-NLS-1$ return "error:" + e.getMessage(); // $NON-NLS-1$ } }
private List<Photo> getFavoritePhotos() throws Exception { OAuthToken token = mOAuth.getToken(); Flickr f = FlickrHelper.getInstance() .getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret()); Date minFavDate = null; Date maxFavDate = null; return f.getFavoritesInterface() .getList( mUser.getId(), minFavDate, maxFavDate, Constants.FETCH_PER_PAGE, PAGE, Constants.EXTRAS); }
private List<Photo> getContactsPhotos() throws Exception { OAuthToken token = mOAuth.getToken(); Flickr f = FlickrHelper.getInstance() .getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret()); boolean justFriends = false; boolean singlePhoto = false; boolean includeSelf = false; return f.getPhotosInterface() .getContactsPhotos( Constants.FETCH_PER_PAGE, Constants.EXTRAS, justFriends, singlePhoto, includeSelf, PAGE, Constants.FETCH_PER_PAGE); }