Java Code Examples for com.facebook.share.model.SharePhoto#getBitmap()

The following examples show how to use com.facebook.share.model.SharePhoto#getBitmap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShareContentValidation.java    From kognitivo with Apache License 2.0 6 votes vote down vote up
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");
        }
    }
}
 
Example 2
Source File: ShareInternalUtility.java    From kognitivo with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: ShareContentValidation.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private static void validatePhotoForNativeDialog(SharePhoto photo, Validator validator) {
    validatePhotoForApi(photo, validator);

    if (photo.getBitmap() != null || !Utility.isWebUri(photo.getImageUrl())) {
        Validate.hasContentProvider(FacebookSdk.getApplicationContext());
    }
}