Java 类com.facebook.share.model.SharePhoto 实例源码

项目:kognitivo    文件:ShareContentValidation.java   
private static void validatePhotoContent(
        SharePhotoContent photoContent, Validator validator) {
    List<SharePhoto> photos = photoContent.getPhotos();
    if (photos == null || photos.isEmpty()) {
        throw new FacebookException("Must specify at least one Photo in SharePhotoContent.");
    }
    if (photos.size() > ShareConstants.MAXIMUM_PHOTO_COUNT) {
        throw new FacebookException(
                String.format(
                        Locale.ROOT,
                        "Cannot add more than %d photos.",
                        ShareConstants.MAXIMUM_PHOTO_COUNT));
    }

    for (SharePhoto photo : photos) {
        validator.validate(photo);
    }
}
项目:kognitivo    文件:ShareContentValidation.java   
private static void validatePhotoForApi(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Bitmap photoBitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();

    if (photoBitmap == null) {
        if (photoUri == null) {
            throw new FacebookException(
                    "SharePhoto does not have a Bitmap or ImageUrl specified");
        }

        if (Utility.isWebUri(photoUri) && !validator.isOpenGraphContent()) {
            throw new FacebookException(
                    "Cannot set the ImageUrl of a SharePhoto to the Uri of an image on the " +
                            "web when sharing SharePhotoContent");
        }
    }
}
项目:kognitivo    文件:ShareInternalUtility.java   
public static JSONObject toJSONObjectForWeb(
        final ShareOpenGraphContent shareOpenGraphContent)
        throws JSONException {
    ShareOpenGraphAction action = shareOpenGraphContent.getAction();

    return OpenGraphJSONUtility.toJSONObject(
            action,
            new OpenGraphJSONUtility.PhotoJSONProcessor() {
                @Override
                public JSONObject toJSONObject(SharePhoto photo) {
                    Uri photoUri = photo.getImageUrl();
                    JSONObject photoJSONObject = new JSONObject();
                    try {
                        photoJSONObject.put(
                                NativeProtocol.IMAGE_URL_KEY, photoUri.toString());
                    } catch (JSONException e) {
                        throw new FacebookException("Unable to attach images", e);
                    }
                    return photoJSONObject;
                }
            });
}
项目:kognitivo    文件:ShareInternalUtility.java   
private static NativeAppCallAttachmentStore.Attachment getAttachment(
        UUID callId,
        SharePhoto photo) {
    Bitmap bitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();
    NativeAppCallAttachmentStore.Attachment attachment = null;
    if (bitmap != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                bitmap);
    } else if (photoUri != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                photoUri);
    }

    return attachment;
}
项目:bachamada    文件:FacebookShare.java   
public void openFbDialog(int v) {
    boolean installed = appInstalledOrNot("com.facebook.katana");
    if (installed) {
        Bitmap image = getPersonalHeartRateBitmap(v);
        SharePhoto photo = new SharePhoto.Builder()
                .setBitmap(image)
                .build();
        SharePhotoContent photoContent = new SharePhotoContent.Builder()
                .addPhoto(photo)
                .build();
        mShareDialog.show(photoContent);

    } else {
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setContentTitle(String.format(mContext.getString(R.string.share_message_format), v))
                .setContentDescription(
                        String.format(mContext.getString(R.string.share_message_format), v))
                .setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=fr.machada.bpm"))
                .build();
        mShareDialog.show(linkContent);
    }
}
项目:Move-Alarm_ORCA    文件:ShareContentValidation.java   
private static void validatePhotoContent(
        SharePhotoContent photoContent, Validator validator) {
    List<SharePhoto> photos = photoContent.getPhotos();
    if (photos == null || photos.isEmpty()) {
        throw new FacebookException("Must specify at least one Photo in SharePhotoContent.");
    }
    if (photos.size() > ShareConstants.MAXIMUM_PHOTO_COUNT) {
        throw new FacebookException(
                String.format(
                        Locale.ROOT,
                        "Cannot add more than %d photos.",
                        ShareConstants.MAXIMUM_PHOTO_COUNT));
    }

    for (SharePhoto photo : photos) {
        validator.validate(photo);
    }
}
项目:Move-Alarm_ORCA    文件:ShareContentValidation.java   
private static void validatePhotoForNativeDialog(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Bitmap photoBitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();

    if (photoBitmap == null) {
        if (photoUri == null) {
            throw new FacebookException(
                    "SharePhoto does not have a Bitmap or ImageUrl specified");
        }

        if (Utility.isWebUri(photoUri) && !validator.isOpenGraphContent()) {
            throw new FacebookException(
                    "Cannot set the ImageUrl of a SharePhoto to the Uri of an image on the " +
                            "web when sharing SharePhotoContent");
        }
    }
}
项目:Move-Alarm_ORCA    文件:ShareInternalUtility.java   
public static JSONObject toJSONObjectForWeb(
        final ShareOpenGraphContent shareOpenGraphContent)
        throws JSONException {
    ShareOpenGraphAction action = shareOpenGraphContent.getAction();

    return OpenGraphJSONUtility.toJSONObject(
            action,
            new OpenGraphJSONUtility.PhotoJSONProcessor() {
                @Override
                public JSONObject toJSONObject(SharePhoto photo) {
                    Uri photoUri = photo.getImageUrl();
                    JSONObject photoJSONObject = new JSONObject();
                    try {
                        photoJSONObject.put(
                                NativeProtocol.IMAGE_URL_KEY, photoUri.toString());
                    } catch (JSONException e) {
                        throw new FacebookException("Unable to attach images", e);
                    }
                    return photoJSONObject;
                }
            });
}
项目:Move-Alarm_ORCA    文件:ShareInternalUtility.java   
private static NativeAppCallAttachmentStore.Attachment getAttachment(
        UUID callId,
        SharePhoto photo) {
    Bitmap bitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();
    NativeAppCallAttachmentStore.Attachment attachment = null;
    if (bitmap != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                bitmap);
    } else if (photoUri != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                photoUri);
    }

    return attachment;
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validatePhotoContent(
        SharePhotoContent photoContent, Validator validator) {
    List<SharePhoto> photos = photoContent.getPhotos();
    if (photos == null || photos.isEmpty()) {
        throw new FacebookException("Must specify at least one Photo in SharePhotoContent.");
    }
    if (photos.size() > ShareConstants.MAXIMUM_PHOTO_COUNT) {
        throw new FacebookException(
                String.format(
                        Locale.ROOT,
                        "Cannot add more than %d photos.",
                        ShareConstants.MAXIMUM_PHOTO_COUNT));
    }

    for (SharePhoto photo : photos) {
        validator.validate(photo);
    }
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validatePhotoForApi(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Bitmap photoBitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();

    if (photoBitmap == null) {
        if (photoUri == null) {
            throw new FacebookException(
                    "SharePhoto does not have a Bitmap or ImageUrl specified");
        }

        if (Utility.isWebUri(photoUri) && !validator.isOpenGraphContent()) {
            throw new FacebookException(
                    "Cannot set the ImageUrl of a SharePhoto to the Uri of an image on the " +
                            "web when sharing SharePhotoContent");
        }
    }
}
项目:SocioBlood    文件:ShareInternalUtility.java   
public static JSONObject toJSONObjectForWeb(
        final ShareOpenGraphContent shareOpenGraphContent)
        throws JSONException {
    ShareOpenGraphAction action = shareOpenGraphContent.getAction();

    return OpenGraphJSONUtility.toJSONObject(
            action,
            new OpenGraphJSONUtility.PhotoJSONProcessor() {
                @Override
                public JSONObject toJSONObject(SharePhoto photo) {
                    Uri photoUri = photo.getImageUrl();
                    JSONObject photoJSONObject = new JSONObject();
                    try {
                        photoJSONObject.put(
                                NativeProtocol.IMAGE_URL_KEY, photoUri.toString());
                    } catch (JSONException e) {
                        throw new FacebookException("Unable to attach images", e);
                    }
                    return photoJSONObject;
                }
            });
}
项目:SocioBlood    文件:ShareInternalUtility.java   
private static NativeAppCallAttachmentStore.Attachment getAttachment(
        UUID callId,
        SharePhoto photo) {
    Bitmap bitmap = photo.getBitmap();
    Uri photoUri = photo.getImageUrl();
    NativeAppCallAttachmentStore.Attachment attachment = null;
    if (bitmap != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                bitmap);
    } else if (photoUri != null) {
        attachment = NativeAppCallAttachmentStore.createAttachment(
                callId,
                photoUri);
    }

    return attachment;
}
项目:kognitivo    文件:OpenGraphJSONUtility.java   
public static Object toJSONValue(
        @Nullable final Object object,
        final PhotoJSONProcessor photoJSONProcessor) throws JSONException {
    if (object == null) {
        return JSONObject.NULL;
    }
    if ((object instanceof String) ||
            (object instanceof Boolean) ||
            (object instanceof Double) ||
            (object instanceof Float) ||
            (object instanceof Integer) ||
            (object instanceof Long)) {
        return object;
    }
    if (object instanceof SharePhoto) {
        if (photoJSONProcessor != null) {
            return photoJSONProcessor.toJSONObject((SharePhoto) object);
        }
        return null;
    }
    if (object instanceof ShareOpenGraphObject) {
        return toJSONObject((ShareOpenGraphObject) object, photoJSONProcessor);
    }
    if (object instanceof List) {
        return toJSONArray((List) object, photoJSONProcessor);
    }
    throw new IllegalArgumentException(
            "Invalid object found for JSON serialization: " +object.toString());
}
项目:kognitivo    文件:ShareContentValidation.java   
private static void validatePhotoForNativeDialog(SharePhoto photo, Validator validator) {
    validatePhotoForApi(photo, validator);

    if (photo.getBitmap() != null || !Utility.isWebUri(photo.getImageUrl())) {
        Validate.hasContentProvider(FacebookSdk.getApplicationContext());
    }
}
项目:kognitivo    文件:ShareContentValidation.java   
private static void validatePhotoForWebDialog(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Uri imageUri = photo.getImageUrl();
    if (imageUri == null || !Utility.isWebUri(imageUri)) {
        throw new FacebookException(
                "SharePhoto must have a non-null imageUrl set to the Uri of an image " +
                        "on the web");
    }
}
项目:kognitivo    文件:ShareContentValidation.java   
private static void validateVideoContent(
        ShareVideoContent videoContent, Validator validator) {
    validator.validate(videoContent.getVideo());

    SharePhoto previewPhoto = videoContent.getPreviewPhoto();
    if (previewPhoto != null) {
        validator.validate(previewPhoto);
    }
}
项目:kognitivo    文件:ShareContentValidation.java   
private static void validateOpenGraphValueContainerObject(
        Object o, Validator validator) {
    if (o instanceof ShareOpenGraphObject) {
        validator.validate((ShareOpenGraphObject) o);
    } else if (o instanceof SharePhoto) {
        validator.validate((SharePhoto) o);
    }
}
项目:OSS-green-07    文件:HomeActivity.java   
public void shareImage(ArrayList<String> cards){
    try {
        List<SharePhoto> convertCards = new ArrayList<SharePhoto>();
        SharePhoto photo;

        for (int i = 0; i < cards.size(); i++) {
            Uri uri = Uri.fromFile(new File(cards.get(i)));
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
            int nh = (int) (bitmap.getHeight() * (1024.0 / bitmap.getWidth()));
            Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 1024, nh, true);

            photo = new SharePhoto.Builder()
                    .setBitmap(scaled)
                    .build();
            convertCards.add(photo);
        }

        ShareContent content  = new SharePhotoContent.Builder().addPhotos(convertCards).build();

        if(ShareDialog.canShow(SharePhotoContent.class)){
            shareDialog.show(content);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:OSS-purple-06    文件:HomeActivity.java   
public void shareImage(ArrayList<String> cards){
    try {
        List<SharePhoto> convertCards = new ArrayList<SharePhoto>();
        SharePhoto photo;

        for (int i = 0; i < cards.size(); i++) {
            Uri uri = Uri.fromFile(new File(cards.get(i)));
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
            int nh = (int) (bitmap.getHeight() * (1024.0 / bitmap.getWidth()));
            Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 1024, nh, true);

            photo = new SharePhoto.Builder()
                    .setBitmap(scaled)
                    .build();
            convertCards.add(photo);
        }

        ShareContent content  = new SharePhotoContent.Builder().addPhotos(convertCards).build();

        if(ShareDialog.canShow(SharePhotoContent.class)){
            shareDialog.show(content);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:PhotoApp    文件:SocialUtil.java   
/**
 * Handle Facebook
 */
public static void shareImageOnFace(Activity activity, RelativeLayout photoContent, View v) {
    // Cria conteudo para ser publicado no face
    SharePhoto photo = new SharePhoto.Builder().setBitmap(ImageUtil.drawBitmap(photoContent)).build();
    SharePhotoContent content = new SharePhotoContent.Builder()
            .addPhoto(photo)
            .setShareHashtag(new ShareHashtag.Builder().setHashtag(HASHTAG).build())
            .build();
    new ShareDialog(activity).show(content);
}
项目:SjekkUT    文件:CheckinAndSocialView.java   
private ShareContent getFacebookShareContent(@NonNull PlaceCheckin theCheckin, @NonNull Place place, String applink) {
    ShareOpenGraphObject.Builder objectBuilder = new ShareOpenGraphObject.Builder()
            .putString("og:type", "fitness.course")
            .putString("og:url", applink)
            .putString("og:title", getContext().getString(R.string.share_title, place.getName()));

    if (place.getDescription() != null) {
        objectBuilder.putString("og:description", place.getDescription());
    }

    if (place.hasLocation()) {
        objectBuilder.putDouble("fitness:metrics:location:latitude", place.getLocation().getLatitude());
        objectBuilder.putDouble("fitness:metrics:location:longitude", place.getLocation().getLongitude());
    }

    // Create an action
    ShareOpenGraphAction.Builder actionBuilder = new ShareOpenGraphAction.Builder()
            .setActionType("fitness.walks")
            .putObject("fitness:course", objectBuilder.build());
    if (theCheckin.getImageUrl(SHARE_IMAGE_WIDTH) != null) {
        SharePhoto photo = new SharePhoto.Builder()
                .setImageUrl(Uri.parse(theCheckin.getImageUrl(SHARE_IMAGE_WIDTH)))
                .setUserGenerated(true)
                .build();
        ArrayList<SharePhoto> photoArray = new ArrayList<>();
        photoArray.add(photo);
        actionBuilder.putPhotoArrayList("image", photoArray);
    }

    return new ShareOpenGraphContent.Builder()
            .setPreviewPropertyName("fitness:course")
            .setAction(actionBuilder.build())
            .build();
}
项目:Carbonizr    文件:CustomAdapter.java   
@OnClick(R.id.button_social)
public void share(final View view) {
    if (editing) {
        setTextAndHideKeyboard(view);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(context)
                .setTitle("Share with:")
                .setItems(MainActivity.SOCIAL_MEDIA_PLATFORMS, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        switch (which) {
                            case 0:
                                makeSnackbar(view, "Selected " + MainActivity.SOCIAL_MEDIA_PLATFORMS[0]);
                                Bitmap crop = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
                                Bitmap preview = ((BitmapDrawable) previewImage.getDrawable()).getBitmap();
                                SharePhoto cropPhoto = new SharePhoto.Builder()
                                        .setBitmap(crop)
                                        .build();
                                SharePhoto previewPhoto = new SharePhoto.Builder()
                                        .setBitmap(preview)
                                        .build();
                                ShareContent shareContent = new ShareMediaContent.Builder()
                                        .addMedium(cropPhoto)
                                        .addMedium(previewPhoto)
                                        .build();

                                ShareDialog shareDialog = new ShareDialog((Activity) context);
                                shareDialog.show(shareContent, ShareDialog.Mode.AUTOMATIC);
                                break;
                        }
                    }
                });
        builder.show();
    }
}
项目:journal    文件:FbInfoFragment.java   
private void publishImage(Bitmap img) {
    SharePhoto photo = new SharePhoto.Builder()
            .setBitmap(img)
            .build();
    SharePhotoContent content = new SharePhotoContent.Builder()
            .addPhoto(photo)
            .build();
    Log.e("abc", content.toString());
    shareDialog.show(content);
}
项目:android-fagyi    文件:FacebookHandler.java   
/**
 * share bitmap content.
 * @param bitmap
 */
public void sharePhoto(Bitmap bitmap) {

    SharePhoto photo = new SharePhoto.Builder()
            .setBitmap(bitmap)
            .build();

    SharePhotoContent photoContent = new SharePhotoContent.Builder().addPhoto(photo).build();

    ShareDialog shareDialog = new ShareDialog(activity);

    if (ShareDialog.canShow(SharePhotoContent.class)) {
        shareDialog.show(photoContent);
    }
}
项目:Move-Alarm_ORCA    文件:OpenGraphJSONUtility.java   
public static Object toJSONValue(
        @Nullable final Object object,
        final PhotoJSONProcessor photoJSONProcessor) throws JSONException {
    if (object == null) {
        return JSONObject.NULL;
    }
    if ((object instanceof String) ||
            (object instanceof Boolean) ||
            (object instanceof Double) ||
            (object instanceof Float) ||
            (object instanceof Integer) ||
            (object instanceof Long)) {
        return object;
    }
    if (object instanceof SharePhoto) {
        if (photoJSONProcessor != null) {
            return photoJSONProcessor.toJSONObject((SharePhoto) object);
        }
        return null;
    }
    if (object instanceof ShareOpenGraphObject) {
        return toJSONObject((ShareOpenGraphObject) object, photoJSONProcessor);
    }
    if (object instanceof List) {
        return toJSONArray((List) object, photoJSONProcessor);
    }
    throw new IllegalArgumentException(
            "Invalid object found for JSON serialization: " +object.toString());
}
项目:Move-Alarm_ORCA    文件:ShareContentValidation.java   
private static void validatePhotoForWebDialog(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Uri imageUri = photo.getImageUrl();
    if (imageUri == null || !Utility.isWebUri(imageUri)) {
        throw new FacebookException(
                "SharePhoto must have a non-null imageUrl set to the Uri of an image " +
                        "on the web");
    }
}
项目:Move-Alarm_ORCA    文件:ShareContentValidation.java   
private static void validateVideoContent(
        ShareVideoContent videoContent, Validator validator) {
    validator.validate(videoContent.getVideo());

    SharePhoto previewPhoto = videoContent.getPreviewPhoto();
    if (previewPhoto != null) {
        validator.validate(previewPhoto);
    }
}
项目:Move-Alarm_ORCA    文件:ShareContentValidation.java   
private static void validateOpenGraphValueContainerObject(
        Object o, Validator validator) {
    if (o instanceof ShareOpenGraphObject) {
        validator.validate((ShareOpenGraphObject) o);
    } else if (o instanceof SharePhoto) {
        validator.validate((SharePhoto) o);
    }
}
项目:Move-Alarm_ORCA    文件:ShareInternalUtility.java   
public static JSONObject toJSONObjectForCall(
        final UUID callId,
        final ShareOpenGraphAction action)
        throws JSONException {

    final ArrayList<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>();
    JSONObject actionJSON = OpenGraphJSONUtility.toJSONObject(
            action,
            new OpenGraphJSONUtility.PhotoJSONProcessor() {
                @Override
                public JSONObject toJSONObject(SharePhoto photo) {
                    NativeAppCallAttachmentStore.Attachment attachment = getAttachment(
                            callId,
                            photo);

                    if (attachment == null) {
                        return null;
                    }

                    attachments.add(attachment);

                    JSONObject photoJSONObject = new JSONObject();
                    try {
                        photoJSONObject.put(
                                NativeProtocol.IMAGE_URL_KEY, attachment.getAttachmentUrl());
                        if (photo.getUserGenerated()) {
                            photoJSONObject.put(NativeProtocol.IMAGE_USER_GENERATED_KEY, true);
                        }
                    } catch (JSONException e) {
                        throw new FacebookException("Unable to attach images", e);
                    }
                    return photoJSONObject;
                }
            });

    NativeAppCallAttachmentStore.addAttachments(attachments);

    return actionJSON;
}
项目:SocioBlood    文件:OpenGraphJSONUtility.java   
public static Object toJSONValue(
        @Nullable final Object object,
        final PhotoJSONProcessor photoJSONProcessor) throws JSONException {
    if (object == null) {
        return JSONObject.NULL;
    }
    if ((object instanceof String) ||
            (object instanceof Boolean) ||
            (object instanceof Double) ||
            (object instanceof Float) ||
            (object instanceof Integer) ||
            (object instanceof Long)) {
        return object;
    }
    if (object instanceof SharePhoto) {
        if (photoJSONProcessor != null) {
            return photoJSONProcessor.toJSONObject((SharePhoto) object);
        }
        return null;
    }
    if (object instanceof ShareOpenGraphObject) {
        return toJSONObject((ShareOpenGraphObject) object, photoJSONProcessor);
    }
    if (object instanceof List) {
        return toJSONArray((List) object, photoJSONProcessor);
    }
    throw new IllegalArgumentException(
            "Invalid object found for JSON serialization: " +object.toString());
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validatePhotoForNativeDialog(SharePhoto photo, Validator validator) {
    validatePhotoForApi(photo, validator);

    if (photo.getBitmap() != null || !Utility.isWebUri(photo.getImageUrl())) {
        Validate.hasContentProvider(FacebookSdk.getApplicationContext());
    }
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validatePhotoForWebDialog(SharePhoto photo, Validator validator) {
    if (photo == null) {
        throw new FacebookException("Cannot share a null SharePhoto");
    }

    Uri imageUri = photo.getImageUrl();
    if (imageUri == null || !Utility.isWebUri(imageUri)) {
        throw new FacebookException(
                "SharePhoto must have a non-null imageUrl set to the Uri of an image " +
                        "on the web");
    }
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validateVideoContent(
        ShareVideoContent videoContent, Validator validator) {
    validator.validate(videoContent.getVideo());

    SharePhoto previewPhoto = videoContent.getPreviewPhoto();
    if (previewPhoto != null) {
        validator.validate(previewPhoto);
    }
}
项目:SocioBlood    文件:ShareContentValidation.java   
private static void validateOpenGraphValueContainerObject(
        Object o, Validator validator) {
    if (o instanceof ShareOpenGraphObject) {
        validator.validate((ShareOpenGraphObject) o);
    } else if (o instanceof SharePhoto) {
        validator.validate((SharePhoto) o);
    }
}
项目:SocioBlood    文件:ShareInternalUtility.java   
public static JSONObject toJSONObjectForCall(
        final UUID callId,
        final ShareOpenGraphAction action)
        throws JSONException {

    final ArrayList<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>();
    JSONObject actionJSON = OpenGraphJSONUtility.toJSONObject(
            action,
            new OpenGraphJSONUtility.PhotoJSONProcessor() {
                @Override
                public JSONObject toJSONObject(SharePhoto photo) {
                    NativeAppCallAttachmentStore.Attachment attachment = getAttachment(
                            callId,
                            photo);

                    if (attachment == null) {
                        return null;
                    }

                    attachments.add(attachment);

                    JSONObject photoJSONObject = new JSONObject();
                    try {
                        photoJSONObject.put(
                                NativeProtocol.IMAGE_URL_KEY, attachment.getAttachmentUrl());
                        if (photo.getUserGenerated()) {
                            photoJSONObject.put(NativeProtocol.IMAGE_USER_GENERATED_KEY, true);
                        }
                    } catch (JSONException e) {
                        throw new FacebookException("Unable to attach images", e);
                    }
                    return photoJSONObject;
                }
            });

    NativeAppCallAttachmentStore.addAttachments(attachments);

    return actionJSON;
}
项目:journal    文件:FbInfoFragment.java   
private void publishImage(Bitmap img) {
    SharePhoto photo = new SharePhoto.Builder()
            .setBitmap(img)
            .build();
    SharePhotoContent content = new SharePhotoContent.Builder()
            .addPhoto(photo)
            .build();
    Log.e("abc", content.toString());
    shareDialog.show(content);
}
项目:kognitivo    文件:ShareContentValidation.java   
@Override
public void validate(final SharePhoto photo) {
    validatePhotoForWebDialog(photo, this);
}
项目:kognitivo    文件:ShareContentValidation.java   
@Override
public void validate(final SharePhoto photo) {
    validatePhotoForApi(photo, this);
}
项目:kognitivo    文件:ShareContentValidation.java   
public void validate(final SharePhoto photo) {
    validatePhotoForNativeDialog(photo, this);
}