use of com.googlecode.flickrjandroid.oauth.OAuthToken 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;
}
use of com.googlecode.flickrjandroid.oauth.OAuthToken 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;
}
use of com.googlecode.flickrjandroid.oauth.OAuthToken in project glimmr by brk3.
the class LoadPhotosetsTask method doInBackground.
@Override
protected Photosets doInBackground(OAuth... params) {
OAuth oauth = params[0];
if (oauth != null) {
OAuthToken token = oauth.getToken();
Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
/* "Currently all sets are returned, but this behaviour may change
* in future."
* (http://flickr.com/services/api/flickr.photosets.getList.html)
*/
try {
return f.getPhotosetsInterface().getList(mUser.getId());
} catch (Exception e) {
e.printStackTrace();
mException = e;
}
} else {
if (BuildConfig.DEBUG)
Log.d(TAG, "Making unauthenticated call");
try {
return FlickrHelper.getInstance().getPhotosetsInterface().getList(mUser.getId());
} catch (Exception e) {
e.printStackTrace();
mException = e;
}
}
return null;
}
use of com.googlecode.flickrjandroid.oauth.OAuthToken in project glimmr by brk3.
the class SetFavoriteTask method doInBackground.
@Override
protected Exception doInBackground(OAuth... params) {
OAuth oauth = params[0];
if (oauth != null) {
OAuthToken token = oauth.getToken();
Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
try {
if (mPhoto.isFavorite()) {
f.getFavoritesInterface().remove(mPhoto.getId());
} else {
f.getFavoritesInterface().add(mPhoto.getId());
}
} catch (Exception e) {
e.printStackTrace();
return e;
}
} else {
Log.e(TAG, "SetFavoriteTask requires authentication");
}
return null;
}
use of com.googlecode.flickrjandroid.oauth.OAuthToken in project glimmr by brk3.
the class SearchPhotosTask method doInBackground.
@Override
protected List<Photo> doInBackground(OAuth... params) {
OAuth oauth = params[0];
SearchParameters sp = new SearchParameters();
sp.setExtras(Constants.EXTRAS);
sp.setText(mSearchTerm);
if (mUserId != null) {
sp.setUserId(mUserId);
}
switch(mSortType) {
case AbstractPhotoSearchGridFragment.SORT_TYPE_RECENT:
if (BuildConfig.DEBUG)
Log.d(TAG, "Search type:RECENT");
sp.setSort(SearchParameters.DATE_POSTED_DESC);
break;
case AbstractPhotoSearchGridFragment.SORT_TYPE_INTERESTING:
if (BuildConfig.DEBUG)
Log.d(TAG, "Search type:INTERESTINGNESS");
sp.setSort(SearchParameters.INTERESTINGNESS_DESC);
break;
case AbstractPhotoSearchGridFragment.SORT_TYPE_RELAVANCE:
if (BuildConfig.DEBUG)
Log.d(TAG, "Search type:RELAVANCE");
sp.setSort(SearchParameters.RELEVANCE);
break;
default:
Log.e(TAG, "Unknown sort type, defaulting to RELAVANCE");
sp.setSort(SearchParameters.RELEVANCE);
}
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.getPhotosInterface().search(sp, 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().getPhotosInterface().search(sp, Constants.FETCH_PER_PAGE, mPage);
} catch (Exception e) {
e.printStackTrace();
mException = e;
}
}
return null;
}
Aggregations