当前位置: 首页>>代码示例>>Java>>正文


Java FacebookDialog.canPresentShareDialog方法代码示例

本文整理汇总了Java中com.facebook.widget.FacebookDialog.canPresentShareDialog方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookDialog.canPresentShareDialog方法的具体用法?Java FacebookDialog.canPresentShareDialog怎么用?Java FacebookDialog.canPresentShareDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.widget.FacebookDialog的用法示例。


在下文中一共展示了FacebookDialog.canPresentShareDialog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: share

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
    public void share(String tag)
    {
        switch(tag) {
            case "facebook":
                ArrayList<Bitmap> pic = new ArrayList<>();
                pic.add(screenShot());
                if (FacebookDialog.canPresentShareDialog (getApplicationContext(),
                        FacebookDialog.ShareDialogFeature.PHOTOS)) {
                    // Publish the post using the Photo Share Dialog
                    FacebookDialog shareDialog = new FacebookDialog.PhotoShareDialogBuilder(this)
                            .addPhotos(pic)
                            .setApplicationName("Chatois")
                            .build();
                    uiHelper.trackPendingDialogCall(shareDialog.present());
                } else {
                    // The user doesn't have the Facebook for Android app installed.
                    // You may be able to use a fallback.
                }

//                FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
//                        .setLink("https://play.google.com/store/apps/details?id=com.chatois.app")
//                        .setDescription("Description")
//                        .setName("name")
//                        .setApplicationName("Chatois!")
//                        .setCaption("Caption")
//                        .build();
//                uiHelper.trackPendingDialogCall(shareDialog.present());
                break;
            case "whatsapp":
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TEXT, "Can you help me guess this word?");
                sendIntent.putExtra(Intent.EXTRA_STREAM, getImageUri(screenShot()));
                sendIntent.setType("image/*");
                sendIntent.setPackage("com.whatsapp");
                startActivity(sendIntent);
                break;
        }
    }
 
开发者ID:JavonDavis,项目名称:Chatois,代码行数:41,代码来源:MainActivity.java

示例2: shareOnFacebook

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
protected void shareOnFacebook(Marker marker){
    Log.d("App name: ",getString(R.string.app_name));
    if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
            FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
        // Publish the post using the Share Dialog
        FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(MainMapActivity.this)
                .setLink("http://maps.google.com/maps?z=15&t=m&q=loc:" + marker.getPosition().latitude + "+" + marker.getPosition().longitude)
                .setName(marker.getTitle())
                .setCaption("via Geopin App")
                .setDescription(marker.getSnippet())
                .setApplicationName(getString(R.string.app_name))
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    }
}
 
开发者ID:dklisiaris,项目名称:geopin,代码行数:16,代码来源:MainMapActivity.java

示例3: facebook

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public void facebook(String name, String message, String link) {
	if (!FunctionUtils.checkNetwork(act)) {
		UIFunctionUtils.showMessage(mContext, true, getString(R.string.no_internet));
		return;
	}

	if (!FunctionUtils.checkFbInstalled(act)) {
		UIFunctionUtils.showMessage(mContext, true, getString(R.string.fb_not_installed));
		return;
	}

	UIFunctionUtils.showMessage(
			mContext,
			true,
			FunctionUtils.capitalizeFirtsLetter(getString(R.string.loading).toLowerCase(
					Locale.getDefault())));

	if (FacebookDialog.canPresentShareDialog(mContext, FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
		FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(act)
				.setName(name)
				.setLink(link)
				.setDescription(message)
				.setPicture(
						"http://wiki.openstreetmap.org/w/images/thumb/b/b0/Openstreetmap_logo.svg/80px-Openstreetmap_logo.svg.png")
				.build();

		uiHelper.trackPendingDialogCall(shareDialog.present());
	}
}
 
开发者ID:scintero,项目名称:moveon,代码行数:30,代码来源:History.java

示例4: post

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
public void post(String description, String link, String urlImage) {
	
	if (FacebookDialog.canPresentShareDialog(activity.getApplicationContext(), 
               FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
		
		FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(activity)
		.setLink(link == "" ? "http://www.facebook.com/craboxgame" : link)
		.setDescription(description)
		.setPicture(urlImage)
		.build();
	
		uiHelper.trackPendingDialogCall(shareDialog.present());
	} else {
		
		Bundle params = new Bundle();
	    params.putString("name", "Crabox");
	    params.putString("caption", "pene");
	    params.putString("description", description);
	    params.putString("link", link == "" ? "http://www.facebook.com/craboxgame" : link);
	    params.putString("picture", urlImage);

	    WebDialog feedDialog = (
	        new WebDialog.FeedDialogBuilder(activity,
	            Session.getActiveSession(),
	            params))
	        .build();
	    feedDialog.show();
	}

}
 
开发者ID:costular,项目名称:crabox,代码行数:32,代码来源:Facebook.java

示例5: onCompleted

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
public final void onCompleted(Response paramResponse)
{
  FacebookRequestError localFacebookRequestError = paramResponse.getError();
  if (localFacebookRequestError != null)
  {
    Toast.makeText(this.ˊ, localFacebookRequestError.getErrorMessage(), 0).show();
  }
  else if ((paramResponse.getGraphObject() != null) && (paramResponse.getGraphObject().getInnerJSONObject() != null))
  {
    ArrayList localArrayList = new ArrayList();
    try
    {
      JSONArray localJSONArray = paramResponse.getGraphObject().getInnerJSONObject().getJSONObject(this.ˋ.ʼ).getJSONArray("image");
      for (int i = 0; i < localJSONArray.length(); i++)
        localArrayList.add(localJSONArray.getJSONObject(i).getString("url"));
      OpenGraphAction localOpenGraphAction = ϳ.ˊ(this.ˋ, localArrayList);
      if (this.ˎ.equals("facebook"))
      {
        this.ˋ.ͺ.put("Destination", "facebook");
        Context localContext = this.ˊ.getApplicationContext();
        FacebookDialog.ShareDialogFeature[] arrayOfShareDialogFeature = new FacebookDialog.ShareDialogFeature[1];
        arrayOfShareDialogFeature[0] = FacebookDialog.ShareDialogFeature.SHARE_DIALOG;
        if (FacebookDialog.canPresentShareDialog(localContext, arrayOfShareDialogFeature))
        {
          this.ˊ.setPropertiesForFacebookSharing(this.ˋ.ͺ);
          FacebookDialog localFacebookDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this.ˊ, localOpenGraphAction, this.ˋ.ʽ.ʼ).build();
          this.ˊ.getUiHelper().trackPendingDialogCall(localFacebookDialog.present());
        }
        else
        {
          ϳ.ˎ(this.ˊ, this.ˋ, (String)localArrayList.get(0));
        }
      }
      else if (this.ˎ.equals("facebook-messenger"))
      {
        ϳ.ˊ(this.ˊ, this.ˋ, localOpenGraphAction);
      }
    }
    catch (JSONException localJSONException)
    {
      localJSONException.printStackTrace();
    }
  }
  this.ˏ.dismiss();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:46,代码来源:œ≥$2.java

示例6: FeedRequest

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@UnityCallable
public static void FeedRequest(String params_str) {
    Log.v(TAG, "FeedRequest(" + params_str + ")");
    final UnityMessage response = new UnityMessage("OnFeedRequestComplete");

    UnityParams unity_params = UnityParams.parse(params_str);
    if (unity_params.hasString("callback_id")){
        response.put("callback_id", unity_params.getString("callback_id"));
    }

    if (!isLoggedIn()) {
        response.sendNotLoggedInError();
        return;
    }

    final Bundle params = unity_params.getStringParams();
            
    if (!FacebookDialog.canPresentShareDialog(getUnityActivity()) || 
        FBDialogUtils.hasUnsupportedParams(FBDialogUtils.DialogType.SHARE_DIALOG, params)) {
        if (params.containsKey("callback_id")) {
            params.remove("callback_id");
        }
            
        getUnityActivity().runOnUiThread(new Runnable() {

            @Override
            public void run() {
                WebDialog feedDialog = (
                        new WebDialog.FeedDialogBuilder(getUnityActivity(),
                                Session.getActiveSession(),
                                params))
                        .setOnCompleteListener(new OnCompleteListener() {
    
                            @Override
                            public void onComplete(Bundle values,
                                                   FacebookException error) {

                                // response
                                if (error == null) {
                                    final String postID = values.getString("post_id");
                                        if (postID != null) {
                                            response.putID(postID);
                                        } else {
                                            response.putCancelled();
                                        }
                                        response.send();
                                    } else if (error instanceof FacebookOperationCanceledException) {
                                        // User clicked the "x" button
                                        response.putCancelled();
                                        response.send();
                                    } else {
                                        // Generic, ex: network error
                                        response.sendError(error.toString());
                                    }
                                }
    
                            })
                            .build();
                    feedDialog.show();
            }
        });
    } else {
     Intent intent = new Intent(getUnityActivity(), FBUnityDialogsActivity.class);
     intent.putExtra(FBUnityDialogsActivity.DIALOG_TYPE, FBDialogUtils.DialogType.SHARE_DIALOG);
     intent.putExtra(FBUnityDialogsActivity.DIALOG_PARAMS, params);
     getUnityActivity().startActivity(intent);
    }
}
 
开发者ID:stevesolomon,项目名称:DualRunner,代码行数:69,代码来源:FB.java

示例7: onOptionsItemSelected

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_call:
            if (eventAuthor != null && eventAuthor.getPhone() != null) {
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + eventAuthor.getPhone()));
                startActivity(intent);
            } else {
                Toast.makeText(this, getResources().getString(R.string.tel_not_avalible), Toast.LENGTH_LONG).show();
            }

            return true;

        case R.id.action_share:
            if (currentEvent != null) {
                if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
                        FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
                    FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
                            .setLink("https://developers.facebook.com/android")
                            .setName(getString(R.string.app_name))
                            .setCaption(getString(R.string.fb_share_caption_as_respondent))
                            .setPicture("http://files.parsetfss.com/ba2c63d0-4860-42a0-9547-7d01e94d4446/tfss-371c4d8e-35e1-4257-a8f5-0fbb6a0670f9-Card-Games.png")
                            .build();
                    uiHelper.trackPendingDialogCall(shareDialog.present());

                } else {
                    Toast.makeText(getApplicationContext(), "It will work as soon as you install facebook app. I swear.", Toast.LENGTH_LONG).show();
                }
            }

            return true;

        case R.id.add_to_cal:
            if (currentEvent != null) {
                Util.addEventToCal(this, currentEvent);
            }
            return true;

        case R.id.action_unresponse:
            if (currentEvent != null) {
                Util.showLoadingDialog(this);
                DataExchange.unresponseFromEvent(currentEvent.getHash(), currentUser.getHash());
            }
            return true;

        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:chechulinYuri,项目名称:stepout,代码行数:50,代码来源:ViewEventAsRespondentActivity.java

示例8: onOptionsItemSelected

import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (!isRemovingProcess) {
        switch (item.getItemId()) {
            case R.id.action_edit:
                if (currentEvent != null) {
                    Intent intent = new Intent(this, EditEventActivity.class);
                    intent.putExtra(DataExchange.EVENT_HASH_FOR_VIEW_EVENT_ACTIVITY_KEY, currentEvent.getHash());
                    startActivity(intent);
                }
                return true;

            case R.id.action_share:
                if (currentEvent != null) {
                    if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
                            FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
                        FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
                                .setLink("https://developers.facebook.com/android")
                                .setName(getString(R.string.app_name))
                                .setCaption(getString(R.string.fb_share_caption))
                                .setPicture("http://files.parsetfss.com/ba2c63d0-4860-42a0-9547-7d01e94d4446/tfss-371c4d8e-35e1-4257-a8f5-0fbb6a0670f9-Card-Games.png")
                                .build();
                        uiHelper.trackPendingDialogCall(shareDialog.present());

                    } else {
                        Toast.makeText(getApplicationContext(), "It will work as soon as you install facebook app. I swear.", Toast.LENGTH_LONG).show();
                    }
                }
                return true;

            case R.id.add_to_cal:
                if (currentEvent != null) {
                    Util.addEventToCal(this, currentEvent);
                }
                return true;

            case R.id.action_delete:
                if (currentEvent != null) {
                    Util.showLoadingDialog(this);
                    isRemovingProcess = true;
                    DataExchange.removeEvent(currentEvent.getHash(), currentUser.getHash());
                }
                return true;
        }
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:chechulinYuri,项目名称:stepout,代码行数:48,代码来源:ViewEventAsAuthorActivity.java


注:本文中的com.facebook.widget.FacebookDialog.canPresentShareDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。