コード例 #1
0
 boolean sharePhoto(Photo photo) {
   try {
     sharePhoto(messageEt.getText().toString(), photo, thumbSize, true);
     return true;
   } catch (Exception ex) {
     GuiUtils.error(TAG, R.string.errorCouldNotSendFacebookPhoto, ex, getActivity());
   }
   return false;
 }
コード例 #2
0
 @Override
 protected void onPostExecute(Boolean result) {
   super.onPostExecute(result);
   loadingControl.stopLoading();
   if (result.booleanValue()) {
     GuiUtils.info(R.string.share_facebook_success_message);
   }
   Dialog dialog = FacebookFragment.this.getDialog();
   if (dialog != null && dialog.isShowing()) {
     FacebookFragment.this.dismissAllowingStateLoss();
   }
 }
コード例 #3
0
  void init(View view) {
    try {
      new ShowCurrentlyLoggedInUserTask(view).execute();
      messageEt = (EditText) view.findViewById(R.id.message);
      messageEt.setText(null);
      Button logOutButton = (Button) view.findViewById(R.id.logoutBtn);
      logOutButton.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              TrackerUtils.trackButtonClickEvent("logoutBtn", FacebookFragment.this);
              performFacebookLogout();
            }
          });
      sendButton = (Button) view.findViewById(R.id.sendBtn);
      sendButton.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              TrackerUtils.trackButtonClickEvent("sendBtn", FacebookFragment.this);
              if (GuiUtils.checkLoggedInAndOnline()) {
                postPhoto();
              }
            }
          });
      {
        sendButton.setEnabled(false);
        PhotoUtils.validateShareTokenExistsAsyncAndRunAsync(
            photo,
            new RunnableWithParameter<Photo>() {

              @Override
              public void run(Photo parameter) {
                sendButton.setEnabled(true);
              }
            },
            new Runnable() {

              @Override
              public void run() {
                sendButton.setEnabled(false);
              }
            },
            new FBLoadingControl(view));
      }
    } catch (Exception ex) {
      GuiUtils.error(TAG, R.string.errorCouldNotInitFacebookFragment, ex, getActivity());
      dismissAllowingStateLoss();
    }
  }
コード例 #4
0
    @Override
    protected Boolean doInBackground(Void... params) {
      try {
        Facebook facebook = FacebookProvider.getFacebook();
        Bundle bparams = new Bundle();
        bparams.putString("fields", "name");
        String response = facebook.request("me", bparams);
        JSONObject jsonObject = new JSONObject(response);

        name = jsonObject.getString("name");
        return true;
      } catch (Exception ex) {
        GuiUtils.error(TAG, R.string.errorCouldNotRetrieveFacebookScreenName, ex, activity);
      }
      return false;
    }