Ejemplo n.º 1
0
 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);
 }
 public void onOAuthDone(OAuth result) {
   if (result == null) {
     Toast.makeText(
             this,
             "Authorization failed", //$NON-NLS-1$
             Toast.LENGTH_LONG)
         .show();
   } else {
     User user = result.getUser();
     OAuthToken token = result.getToken();
     if (user == null
         || user.getId() == null
         || token == null
         || token.getOauthToken() == null
         || token.getOauthTokenSecret() == null) {
       Toast.makeText(
               this,
               "Authorization failed", //$NON-NLS-1$
               Toast.LENGTH_LONG)
           .show();
       return;
     }
     String message =
         String.format(
             Locale.US,
             "Authorization Succeed: user=%s, userId=%s, oauthToken=%s, tokenSecret=%s", //$NON-NLS-1$
             user.getUsername(),
             user.getId(),
             token.getOauthToken(),
             token.getOauthTokenSecret());
     Toast.makeText(this, message, Toast.LENGTH_LONG).show();
     saveOAuthToken(
         user.getUsername(), user.getId(), token.getOauthToken(), token.getOauthTokenSecret());
     load(result);
   }
 }
Ejemplo n.º 3
0
 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);
 }
 public void setUser(User user) {
   textUserTitle.setText(user.getUsername());
   textUserName.setText(user.getRealName());
   textUserId.setText(user.getId());
 }