/*
  * (non-Javadoc)
  *
  * @see
  * com.gmail.charleszq.dataprovider.IPhotoListDataProvider#getPhotoList()
  */
 @Override
 public PhotoList getPhotoList() throws Exception {
   if (mPhotoList != null) {
     return mPhotoList;
   }
   Flickr f = FlickrHelper.getInstance().getFlickrAuthed(mToken, mSecret);
   FavoritesInterface fi = f.getFavoritesInterface();
   Set<String> extras = new HashSet<String>();
   extras.add(Extras.TAGS);
   extras.add(Extras.GEO);
   extras.add(Extras.OWNER_NAME);
   extras.add(Extras.VIEWS);
   mPhotoList = fi.getList(mUserId, null, null, this.mPageSize, this.mPageNumber, extras);
   return mPhotoList;
 }
コード例 #2
0
  @Override
  protected void onHandleIntent(Intent intent) {
    PhotoList list = null;
    OAuth oAuth = null;
    try {
      oAuth = new Gson().fromJson(intent.getStringExtra(IntentKeys.OAUTH), OAuth.class);
    } catch (Exception e) {

    }
    if (oAuth != null) {
      OAuthToken token = oAuth.getToken();
      Flickr f =
          FlickrHelper.getInstance()
              .getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
      Set<String> extras = new HashSet<String>();
      extras.add("url_sq");
      extras.add("url_l");
      extras.add("views");
      extras.add("geo");
      User user = oAuth.getUser();
      try {
        list = f.getPeopleInterface().getPhotos(user.getId(), extras, 40, 1);
        result = Activity.RESULT_OK;
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    Bundle extras = intent.getExtras();
    if (extras != null) {
      Messenger messenger = (Messenger) extras.get(IntentKeys.MESSENGER);
      Message msg = Message.obtain();
      msg.arg1 = result;
      msg.obj = list;

      try {
        messenger.send(msg);
      } catch (android.os.RemoteException e1) {
        Logger.e(TAG, "Exception sending message", e1);
      }
    }
  }