Android Open Source - hacktoolkit-android_lib Facebook Helper






From Project

Back to project page hacktoolkit-android_lib.

License

The source code is released under:

MIT License

If you think the Android project hacktoolkit-android_lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hacktoolkit.android.api_helpers;
//from w  w w .j av  a2 s . co m
import java.util.ArrayList;
import java.util.List;

import com.facebook.Request;
import com.facebook.Response;
import com.facebook.model.GraphUser;
import com.parse.ParseException;
import com.parse.ParseFacebookUtils;
import com.parse.ParseQuery;
import com.parse.ParseUser;

public class FacebookHelper {

  public static void getFriends(final HTKCallback callback) {
    Request.newMyFriendsRequest(ParseFacebookUtils.getSession(), new Request.GraphUserListCallback() {

      @Override
      public void onCompleted(List<GraphUser> users, Response response) {
        if (users != null) {
          List<String> friendsList = new ArrayList<String>();
          for (GraphUser user : users) {
            friendsList.add(user.getId());
          }

          // Construct a ParseUser query that will find friends whose
          // Facebook IDs are contained in the current user's friend list.
          ParseQuery<ParseUser> friendQuery = ParseQuery.getQuery("ParseUser");
          friendQuery.whereContainedIn("fbId", friendsList);

          // findObjects will return a list of ParseUsers that are friends with
          // the current user
          try {
            List<ParseUser> friendUsers = friendQuery.find();
            callback.execute(friendUsers);
          } catch (ParseException e) {
            // poop!
          }
        }
      }
    }).executeAsync();
  }
}




Java Source Code List

com.hacktoolkit.android.activities.HTKSplashScreenActivity.java
com.hacktoolkit.android.adapters.HTKContactsAdapter.java
com.hacktoolkit.android.api_helpers.FacebookHelper.java
com.hacktoolkit.android.api_helpers.HTKCallback.java
com.hacktoolkit.android.api_helpers.ParseHelper.java
com.hacktoolkit.android.constants.GeoConstants.java
com.hacktoolkit.android.constants.StringConstants.java
com.hacktoolkit.android.constants.TimeConstants.java
com.hacktoolkit.android.constants.UnitConstants.java
com.hacktoolkit.android.fragments.ContactsFragment.java
com.hacktoolkit.android.maps.MapUtils.java
com.hacktoolkit.android.maps.Mapper.java
com.hacktoolkit.android.models.HTKContact.java
com.hacktoolkit.android.user.HTKUser.java
com.hacktoolkit.android.utils.BitmapUtils.java
com.hacktoolkit.android.utils.ContactsUtils.java
com.hacktoolkit.android.utils.FileUtils.java
com.hacktoolkit.android.utils.HTKUtils.java
com.hacktoolkit.android.utils.SystemUiHiderBase.java
com.hacktoolkit.android.utils.SystemUiHiderHoneycomb.java
com.hacktoolkit.android.utils.SystemUiHider.java