/**
  * Create a Facebook Response object that matches the one for the Javascript SDK
  *
  * @return JSONObject - the response object
  */
 public JSONObject getResponse() {
   String response;
   final AccessToken accessToken = AccessToken.getCurrentAccessToken();
   if (hasAccessToken()) {
     Date today = new Date();
     long expiresTimeInterval = (accessToken.getExpires().getTime() - today.getTime()) / 1000L;
     response =
         "{"
             + "\"status\": \"connected\","
             + "\"authResponse\": {"
             + "\"accessToken\": \""
             + accessToken.getToken()
             + "\","
             + "\"expiresIn\": \""
             + Math.max(expiresTimeInterval, 0)
             + "\","
             + "\"session_key\": true,"
             + "\"sig\": \"...\","
             + "\"userID\": \""
             + accessToken.getUserId()
             + "\""
             + "}"
             + "}";
   } else {
     response = "{" + "\"status\": \"unknown\"" + "}";
   }
   try {
     return new JSONObject(response);
   } catch (JSONException e) {
     e.printStackTrace();
   }
   return new JSONObject();
 }
 /** {@inheritDoc} */
 @Override
 public String getToken() {
   AccessToken accessToken = getSignedInToken();
   if (accessToken != null) {
     return accessToken.getToken();
   }
   return null;
 }
  void onWebDialogComplete(LoginClient.Request request, Bundle values, FacebookException error) {
    LoginClient.Result outcome;
    if (values != null) {
      // Actual e2e we got from the dialog should be used for logging.
      if (values.containsKey(ServerProtocol.DIALOG_PARAM_E2E)) {
        e2e = values.getString(ServerProtocol.DIALOG_PARAM_E2E);
      }

      try {
        AccessToken token =
            createAccessTokenFromWebBundle(
                request.getPermissions(),
                values,
                AccessTokenSource.WEB_VIEW,
                request.getApplicationId());
        outcome = LoginClient.Result.createTokenResult(loginClient.getPendingRequest(), token);

        // Ensure any cookies set by the dialog are saved
        // This is to work around a bug where CookieManager may fail to instantiate if
        // CookieSyncManager has never been created.
        CookieSyncManager syncManager = CookieSyncManager.createInstance(loginClient.getActivity());
        syncManager.sync();
        saveCookieToken(token.getToken());
      } catch (FacebookException ex) {
        outcome =
            LoginClient.Result.createErrorResult(
                loginClient.getPendingRequest(), null, ex.getMessage());
      }
    } else {
      if (error instanceof FacebookOperationCanceledException) {
        outcome =
            LoginClient.Result.createCancelResult(
                loginClient.getPendingRequest(), "User canceled log in.");
      } else {
        // Something went wrong, don't log a completion event since it will skew timing
        // results.
        e2e = null;

        String errorCode = null;
        String errorMessage = error.getMessage();
        if (error instanceof FacebookServiceException) {
          FacebookRequestError requestError = ((FacebookServiceException) error).getRequestError();
          errorCode = String.format(Locale.ROOT, "%d", requestError.getErrorCode());
          errorMessage = requestError.toString();
        }
        outcome =
            LoginClient.Result.createErrorResult(
                loginClient.getPendingRequest(), null, errorMessage, errorCode);
      }
    }

    if (!Utility.isNullOrEmpty(e2e)) {
      logWebLoginCompleted(e2e);
    }

    loginClient.completeAndValidate(outcome);
  }
  @Override
  boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
      String scope = TextUtils.join(",", request.getPermissions());
      parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
      addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
        ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null && (previousTokenString.equals(loadCookieToken()))) {
      parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousTokenString);
      // Don't log the actual access token, just its presence or absence.
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
      // The call to clear cookies will create the first instance of CookieSyncManager if
      // necessary
      Utility.clearFacebookCookies(loginClient.getActivity());
      addLoggingExtra(
          ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener =
        new WebDialog.OnCompleteListener() {
          @Override
          public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
          }
        };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder =
        new AuthDialogBuilder(fragmentActivity, request.getApplicationId(), parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setReauthenticate(request.isReauthenticate())
            .setOnCompleteListener(listener)
            .setTheme(FacebookSdk.getWebDialogTheme());
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(), FacebookDialogFragment.TAG);

    return true;
  }
  /** @return the Facebook AccessToken when signed-in with a non-expired token. */
  private AccessToken getSignedInToken() {
    final AccessToken accessToken = AccessToken.getCurrentAccessToken();
    if (accessToken != null && !accessToken.isExpired()) {
      Log.d(LOG_TAG, "Facebook Access Token is OK");
      return accessToken;
    }

    Log.d(LOG_TAG, "Facebook Access Token is null or expired.");
    return null;
  }
 void forceExtendAccessToken(boolean forceExtendAccessToken) {
   AccessToken currentToken = getTokenInfo();
   setTokenInfo(
       new AccessToken(
           currentToken.getToken(),
           new Date(),
           currentToken.getPermissions(),
           AccessTokenSource.TEST_USER,
           new Date(0)));
   setLastAttemptedTokenExtendDate(new Date(0));
 }
 static AccessToken createFromRefresh(AccessToken accesstoken, Bundle bundle)
 {
     if (accesstoken.source != AccessTokenSource.FACEBOOK_APPLICATION_WEB && accesstoken.source != AccessTokenSource.FACEBOOK_APPLICATION_NATIVE && accesstoken.source != AccessTokenSource.FACEBOOK_APPLICATION_SERVICE)
     {
         throw new FacebookException((new StringBuilder()).append("Invalid token source: ").append(accesstoken.source).toString());
     } else
     {
         Date date = getBundleLongAsDate(bundle, "expires_in", new Date(0L));
         bundle = bundle.getString("access_token");
         return createNew(accesstoken.getPermissions(), accesstoken.getDeclinedPermissions(), bundle, date, accesstoken.source);
     }
 }
Beispiel #8
0
  private String getAccessToken() {

    FacebookSdk.sdkInitialize(StudentAssistApplication.getAppContext());

    if (AccessToken.getCurrentAccessToken() != null
        && !AccessToken.getCurrentAccessToken().isExpired()) {
      String fbToken = AccessToken.getCurrentAccessToken().getToken();
      return fbToken;
    }

    return "";
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_make_post);

    LoginManager.getInstance().registerCallback(mCallbackManager, this);
    if (!AccessToken.getCurrentAccessToken()
        .getPermissions()
        .contains(FacebookConstant.PERMISSION_PUBLISH_ACTIONS)) {
      LoginManager.getInstance()
          .logInWithPublishPermissions(
              CreatePostActivity.this,
              new ArrayList<String>() {
                {
                  add(FacebookConstant.PERMISSION_PUBLISH_ACTIONS);
                }
              });
    } else {
      mPostButton.setEnabled(true);
    }

    mPostText = (EditText) findViewById(R.id.post_text);
    mPostButton = (Button) findViewById(R.id.post_button);
    mPostButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            FacebookUtil.postToWall(mPostText.getText().toString(), CreatePostActivity.this);
          }
        });
  }
  public void requestFacebookUserDetails() {
    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {
              @Override
              public void onCompleted(JSONObject profile, GraphResponse response) {
                // JSONObject userProfile = new JSONObject();
                if (profile == null) {
                  Log.wtf("FIRST", "PROFILE VAZIO");
                } else {
                  ParseUser currentUser = ParseUser.getCurrentUser();
                  try {
                    currentUser.put("name", profile.get("name"));
                    currentUser.saveInBackground();
                    goToHomePage();
                  } catch (JSONException e) {
                    Log.wtf("ERROR DETAIL", "Erro ao pegar detalhes");
                  }
                }
              }
            });

    Bundle parameters = new Bundle();
    parameters.putString("fields", "id,picture,name,link");
    request.setParameters(parameters);
    request.executeAsync();
  }
Beispiel #11
0
  public boolean getBeepleImages() {
    currentToken = AccessToken.getCurrentAccessToken();
    if (currentToken != null) {
      GraphRequest request =
          GraphRequest.newGraphPathRequest(
              currentToken,
              "/10150428845566781/photos",
              new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                  JSONObject data = response.getJSONObject();
                  try {
                    String newestImage = data.getJSONArray("data").getJSONObject(0).getString("id");
                    getImage(newestImage);
                    Log.d(TAG, newestImage);
                  } catch (org.json.JSONException e) {
                    Log.e(TAG, e.toString());
                  }
                }
              });

      request.executeAsync();
      return true;
    } else {
      Log.d(TAG, "Current access token does not exist");
      return false;
    }
  }
  private void readPost() {
    AccessToken token = AccessToken.getCurrentAccessToken();
    String path = "/me/feed";
    GraphRequest request =
        new GraphRequest(
            token,
            path,
            null,
            HttpMethod.GET,
            new Callback() {

              @Override
              public void onCompleted(GraphResponse response) {
                JSONObject obj = response.getJSONObject();
                if (obj != null) {
                  Toast.makeText(
                          MainActivity.this, "result : " + obj.toString(), Toast.LENGTH_SHORT)
                      .show();
                } else {
                  Toast.makeText(
                          MainActivity.this,
                          "errof : " + response.getError().getErrorMessage(),
                          Toast.LENGTH_SHORT)
                      .show();
                }
              }
            });
    request.executeAsync();
  }
Beispiel #13
0
  /**
   * Sends a fb message to the backend using the RetroFit library.
   *
   * @param token access token generated on login by FB
   * @param post message to be posted on FB
   */
  private void retroFit(AccessToken token, String post) {
    FBPost fBPost = new FBPost();
    fBPost.setToken(token.getToken());
    fBPost.setMessage(post);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(TEST_URL).build();
    System.out.println("Broken: 1");
    ServerEndPointInterface apiService = restAdapter.create(ServerEndPointInterface.class);
    System.out.println("Broken: 2");
    apiService.postMessage(
        fBPost,
        new retrofit.Callback<FBReturn>() {
          @Override
          public void success(FBReturn result, Response response) {
            makeToast(result.getMessage() + " " + result.getStatus());
          }

          @Override
          public void failure(RetrofitError error) {
            String url = error.getUrl();
            System.out.println(url);
            System.out.println(error.getMessage());
            makeToast("Failed: " + url);
          }
        });
  }
Beispiel #14
0
  private void getUserDetailsFromFB() {

    new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me",
            null,
            HttpMethod.GET,
            new GraphRequest.Callback() {
              public void onCompleted(GraphResponse response) {
                /* handle the result */
                try {
                  email = response.getJSONObject().getString("email");
                  mEmailID.setText(email);
                  name = response.getJSONObject().getString("name");
                  mUsername.setText(name);

                  saveNewUser();
                } catch (JSONException e) {
                  e.printStackTrace();
                }
              }
            })
        .executeAsync();

    ProfilePhotoAsync profilePhotoAsync = new ProfilePhotoAsync(mFbProfile);
    profilePhotoAsync.execute();
  }
  private void parseFBData(JSONObject jsonObject, AccessToken token) {
    try {
      String id = jsonObject.getString("id");
      String email = jsonObject.getString("email");
      //                            String name = jsonObject.getString("name");
      String gender = jsonObject.getString("gender");
      String first_name = jsonObject.getString("first_name");
      String last_name = jsonObject.getString("last_name");

      Intent mIntent = new Intent(getActivity(), LoginUserDetails.class);
      mIntent.putExtra("login_method", "facebook");
      mIntent.putExtra("email", email);
      mIntent.putExtra("first_name", first_name);
      mIntent.putExtra("last_name", last_name);
      //            mIntent.putExtra("id", id);
      mIntent.putExtra("id", token.getUserId());
      //                            mIntent.putExtra("name",name);
      if (jsonObject.has("birthday")) {
        String birthday = jsonObject.getString("birthday");
        mIntent.putExtra("birthday", birthday);
      }

      mixpanel.track("Login - Facebook");
      mIntent.putExtra("gender", gender);
      startActivity(mIntent);
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
Beispiel #16
0
  private void getUserDetailsFromFB() {
    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {
              @Override
              public void onCompleted(JSONObject jsonObject, GraphResponse graphResponse) {
                try {
                  userNameText = jsonObject.getString("name");
                } catch (JSONException e) {
                  e.printStackTrace();
                }
                try {
                  emailId = jsonObject.getString("email");
                } catch (JSONException e) {
                  e.printStackTrace();
                }

                saveNewUser();
              }
            });
    Bundle parameters = new Bundle();
    parameters.putString("fields", "name,email");
    request.setParameters(parameters);
    request.executeAsync();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getApplicationContext());

    setContentView(R.layout.activity_main);
    nameText = (TextView) findViewById(R.id.text_name);
    dataList = (ListView) findViewById(R.id.list_data);
    contentButton = (Button) findViewById(R.id.content_button);
    fbbutton = (LoginButton) findViewById(R.id.login_button);

    fbbutton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onFblogin();
          }
        });
    if (AccessToken.getCurrentAccessToken() != null) {
      contentButton.setVisibility(View.VISIBLE);
      contentButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              access_token = AccessToken.getCurrentAccessToken();
              getFacebookData();
            }
          });
    }
  }
  /** {@inheritDoc} */
  public void reloadUserInfo() {
    clearUserInfo();
    if (!isUserSignedIn()) {
      return;
    }

    final Bundle parameters = new Bundle();
    parameters.putString("fields", "name,picture.type(large)");
    final GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(), "me");
    graphRequest.setParameters(parameters);
    GraphResponse response = graphRequest.executeAndWait();

    JSONObject json = response.getJSONObject();
    try {
      userName = json.getString("name");
      userImageUrl = json.getJSONObject("picture").getJSONObject("data").getString("url");

    } catch (final JSONException jsonException) {
      Log.e(
          LOG_TAG,
          "Unable to get Facebook user info. " + jsonException.getMessage() + "\n" + response,
          jsonException);
      // Nothing much we can do here.
    }
  }
Beispiel #19
0
 private void setButtonText() {
   final Resources resources = getResources();
   if (!isInEditMode() && AccessToken.getCurrentAccessToken() != null) {
     setText(
         (logoutText != null)
             ? logoutText
             : resources.getString(R.string.com_facebook_loginview_log_out_button));
   } else {
     if (loginText != null) {
       setText(loginText);
     } else {
       String text = resources.getString(R.string.com_facebook_loginview_log_in_button_long);
       int width = getWidth();
       // if the width is 0, we are going to measure size, so use the long text
       if (width != 0) {
         // we have a specific width, check if the long text fits
         int measuredWidth = measureButtonWidth(text);
         if (measuredWidth > width) {
           // it doesn't fit, use the shorter text
           text = resources.getString(R.string.com_facebook_loginview_log_in_button);
         }
       }
       setText(text);
     }
   }
 }
Beispiel #20
0
  @UnityCallable
  public static void RefreshCurrentAccessToken(String paramsStr) {
    FB.LogMethodCall("RefreshCurrentAccessToken", paramsStr);

    UnityParams unityParams = UnityParams.parse(paramsStr);
    final UnityMessage unityMessage = new UnityMessage("OnRefreshCurrentAccessTokenComplete");
    if (unityParams.hasString("callback_id")) {
      unityMessage.put("callback_id", unityParams.getString("callback_id"));
    }

    AccessToken.refreshCurrentAccessTokenAsync(
        new AccessToken.AccessTokenRefreshCallback() {
          @Override
          public void OnTokenRefreshed(AccessToken accessToken) {
            FBLogin.addLoginParametersToMessage(unityMessage, accessToken, null);
            unityMessage.send();
          }

          @Override
          public void OnTokenRefreshFailed(FacebookException e) {
            unityMessage.sendError(e.getMessage());
          }
        });

    AppLinkData.fetchDeferredAppLinkData(
        getUnityActivity(),
        new AppLinkData.CompletionHandler() {
          @Override
          public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
            FB.addAppLinkToMessage(unityMessage, appLinkData);
            unityMessage.send();
          }
        });
  }
 /**
  * Returns a request to delete a like on an object.
  *
  * @param objectId The id of the object.
  * @param listener The callback events listener.
  */
 public FBDeleteLikeRequest generateDeleteLikeRequest(
     String objectId, OnLikeRequestListener listener) {
   FBDeleteLikeRequest request = new FBDeleteLikeRequest(AccessToken.getCurrentAccessToken());
   request.setTarget(objectId);
   request.setGraphRequestListener(listener);
   return request;
 }
  public void RequestData() {
    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {
              @Override
              public void onCompleted(JSONObject object, GraphResponse response) {

                JSONObject json = response.getJSONObject();
                try {
                  if (json != null) {
                    String text =
                        "<b>Name :</b> "
                            + json.getString("name")
                            + "<br><br><b>Email :</b> "
                            + json.getString("email")
                            + "<br><br><b>Profile link :</b> "
                            + json.getString("link");
                    details_txt.setText(Html.fromHtml(text));
                    profile.setProfileId(json.getString("id"));
                  }

                } catch (JSONException e) {
                  e.printStackTrace();
                }
              }
            });
    Bundle parameters = new Bundle();
    parameters.putString("fields", "id,name,link,email,picture");
    request.setParameters(parameters);
    request.executeAsync();
  }
Beispiel #23
0
 private void getFacebookId() {
   AccessToken accessToken = AccessToken.getCurrentAccessToken();
   GraphRequest request =
       GraphRequest.newMeRequest(
           accessToken,
           new GraphRequest.GraphJSONObjectCallback() {
             @Override
             public void onCompleted(JSONObject object, GraphResponse response) {
               JSONObject result = response.getJSONObject();
               try {
                 String id = result.getString("id");
                 ParseUser user = ParseUser.getCurrentUser();
                 user.put("facebookId", id);
                 try {
                   user.save();
                 } catch (ParseException e) {
                   e.printStackTrace();
                 }
               } catch (JSONException e) {
                 e.printStackTrace();
               }
             }
           });
   Bundle parameters = new Bundle();
   parameters.putString("fields", "id");
   request.setParameters(parameters);
   request.executeAsync();
 }
 private void performPublish(PendingAction action, boolean allowNoToken) {
   AccessToken accessToken = AccessToken.getCurrentAccessToken();
   if (accessToken != null || allowNoToken) {
     mPendingAcction = action;
     handlePedingAcction();
   }
 }
  /**
   * Using the specifiedSession member variable (which may be nil), find the real session to log to
   * (with an access token). Precedence: 1) specified session, 2) activeSession, 3) app
   * authenticated session via Client Token.
   */
  private Session sessionToLogTo() {

    synchronized (this) {
      Session session = specifiedSession;

      // Require an open session.

      if (session == null || !session.isOpened()) {
        session = Session.getActiveSession();
      }

      if (session == null || !session.isOpened() || session.getAccessToken() == null) {

        if (appAuthSession == null) {

          // Build and stash a client-token based session.

          // Form the clientToken based access token from appID and client token.
          String tokenString = String.format("%s|%s", applicationId, clientToken);
          AccessToken token =
              AccessToken.createFromString(tokenString, null, AccessTokenSource.CLIENT_TOKEN);

          appAuthSession =
              new Session(null, applicationId, new NonCachingTokenCachingStrategy(), false);
          appAuthSession.open(token, null);
        }

        session = appAuthSession;
      }

      return session;
    }
  }
Beispiel #26
0
 private void getUserDetailsFromFB() {
   Bundle parameters = new Bundle();
   // add "birthday" if app has been reviewed for user_birthday permission by Facebook
   parameters.putString("fields", "email,name,picture");
   new GraphRequest(
           AccessToken.getCurrentAccessToken(),
           "/me",
           parameters,
           HttpMethod.GET,
           new GraphRequest.Callback() {
             public void onCompleted(GraphResponse response) {
               /* handle the result */
               try {
                 email = response.getJSONObject().getString("email");
               } catch (JSONException e) {
                 // The user has refused to give the app their email through Fb
                 email = "";
               }
               try {
                 name = response.getJSONObject().getString("name");
                 Log.e(LOG_TAG, "name is " + name + " and email is " + email);
                 JSONObject picture = response.getJSONObject().getJSONObject("picture");
                 JSONObject data = picture.getJSONObject("data");
                 //  Returns a 50x50 profile picture
                 String pictureUrl = data.getString("url");
                 new ProfilePhotoAsync(pictureUrl).execute();
               } catch (JSONException e) {
                 e.printStackTrace();
               }
             }
           })
       .executeAsync();
 }
  private void setupViewObjects(User user) {
    ivCoverPic = (ImageView) mFragmentView.findViewById(R.id.ivCoverPic);
    ivProfilePic = (ImageView) mFragmentView.findViewById(R.id.ivProfilePic);
    TextView tvProfileName = (TextView) mFragmentView.findViewById(R.id.tvProfileName);
    TextView tvProfileLocation = (TextView) mFragmentView.findViewById(R.id.tvProfileLocation);

    Picasso.with(getContext())
        .load(
            "https://graph.facebook.com/"
                + user.getAuthId()
                + "/picture?width="
                + String.valueOf(getContext().getResources().getDisplayMetrics().widthPixels))
        .into(ivProfilePic /*new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        src = bitmap;
                        Resources res = getResources();
                        RoundedBitmapDrawable dr =
                                RoundedBitmapDrawableFactory.create(res, src);
                        dr.setCornerRadius(500f);
                        ivProfilePic.setImageDrawable(dr);
                    }

                    @Override
                    public void onBitmapFailed(Drawable errorDrawable) {

                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {

                    }
                }*/);

    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {

              @Override
              public void onCompleted(JSONObject ret, GraphResponse graphResponse) {
                JSONObject cover = null;
                String url = null;
                try {
                  cover = ret.getJSONObject("cover");
                  url = cover.getString("source");
                } catch (JSONException e) {
                  e.printStackTrace();
                }
                Picasso.with(getContext()).load(url).into(ivCoverPic);
              }
            });

    Bundle parameters = new Bundle();
    parameters.putString("fields", "cover");
    request.setParameters(parameters);
    request.executeAsync();

    tvProfileName.setText(user.getName());
  }
 {
     this$0 = LikeActionController.this;
     super(LikeActionController.this, s, r);
     likeactioncontroller = new Bundle();
     putString("object", s);
     setRequest(new GraphRequest(AccessToken.getCurrentAccessToken(), "me/og.likes", LikeActionController.this, HttpMethod.POST));
 }
 /**
  * Returns a request to fetch a single comment details.
  *
  * @param commentId
  * @param listener The callback events listener.
  */
 public FBGetCommentRequest generateGetCommentRequest(
     String commentId, OnGetCommentListener listener) {
   FBGetCommentRequest request = new FBGetCommentRequest(AccessToken.getCurrentAccessToken());
   request.setTarget(commentId);
   request.setProperties(FBGraphUtils.COMMENT_FIELDS);
   request.setGraphRequestListener(listener);
   return request;
 }
 /**
  * Returns a request to publish a comment.
  *
  * @param objectId The id of the post or comment.
  * @param comment The comment's message.
  * @param listener The callback events listener.
  */
 public FBPostCommentRequest generatePostCommentRequest(
     String objectId, String comment, OnPostCommentListener listener) {
   FBPostCommentRequest request = new FBPostCommentRequest(AccessToken.getCurrentAccessToken());
   request.setTarget(objectId);
   request.setProperties(comment);
   request.setGraphRequestListener(listener);
   return request;
 }