Java Code Examples for com.facebook.internal.Validate#containsNoNulls()

The following examples show how to use com.facebook.internal.Validate#containsNoNulls() . 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: NativeAppCallAttachmentStore.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a number of bitmap attachments associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
 *                         the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
    Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");

    addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
        @Override
        public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            try {
                attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
            } finally {
                Utility.closeQuietly(outputStream);
            }
        }
    });
}
 
Example 2
Source File: NativeAppCallAttachmentStore.java    From KlyphMessenger with MIT License 6 votes vote down vote up
/**
 * Adds a number of bitmap attachments associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
 *                         the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
    Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");

    addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
        @Override
        public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            try {
                attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
            } finally {
                Utility.closeQuietly(outputStream);
            }
        }
    });
}
 
Example 3
Source File: NativeAppCallAttachmentStore.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a number of bitmap attachments associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
 *                         the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
    Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");

    addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
        @Override
        public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            try {
                attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
            } finally {
                Utility.closeQuietly(outputStream);
            }
        }
    });
}
 
Example 4
Source File: NativeAppCallAttachmentStore.java    From android-skeleton-project with MIT License 5 votes vote down vote up
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
 
Example 5
Source File: NativeAppCallAttachmentStore.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
 
Example 6
Source File: NativeAppCallAttachmentStore.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
 
Example 7
Source File: NativeAppCallAttachmentStore.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
 
Example 8
Source File: NativeAppCallAttachmentStore.java    From KlyphMessenger with MIT License 5 votes vote down vote up
/**
 * Adds a number of bitmap attachment files associated with a native app call. The attachments will be
 * served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
 *
 * @param context the Context the call is being made from
 * @param callId the unique ID of the call
 * @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
 *                         part of the URI processed by openFile
 * @throws java.io.IOException
 */
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
    Validate.notNull(context, "context");
    Validate.notNull(callId, "callId");
    Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
    Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");

    addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
        @Override
        public void processAttachment(File attachment, File outputFile) throws IOException {
            FileOutputStream outputStream = new FileOutputStream(outputFile);
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(attachment);

                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) > 0) {
                    outputStream.write(buffer, 0, len);
                }
            } finally {
                Utility.closeQuietly(outputStream);
                Utility.closeQuietly(inputStream);
            }
        }
    });
}
 
Example 9
Source File: FacebookDialog.java    From Abelana-Android with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 * <p/>
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty  the name of a property on the action that corresponds to an Open Graph object;
 *                        the object must be marked as a new object to be created
 *                        (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                        true) or an exception will be thrown
 * @param bitmapFiles     a list of Bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public CONCRETE setImageAttachmentFilesForObject(String objectProperty,
        List<File> bitmapFiles, boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    @SuppressWarnings("unchecked")
    CONCRETE result = (CONCRETE) this;
    return result;
}
 
Example 10
Source File: FacebookDialog.java    From Klyph with MIT License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForAction(List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    return this;
}
 
Example 11
Source File: FacebookDialog.java    From KlyphMessenger with MIT License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
 *                       the object must be marked as a new object to be created
 *                       (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                       true) or an exception will be thrown
 * @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentFilesForObject(String objectProperty,
        List<File> bitmapFiles, boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    return this;
}
 
Example 12
Source File: FacebookDialog.java    From platform-friends-android with BSD 2-Clause "Simplified" License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
 *                       the object must be marked as a new object to be created
 *                       (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                       true) or an exception will be thrown
 * @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentFilesForObject(String objectProperty,
        List<File> bitmapFiles, boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    return this;
}
 
Example 13
Source File: FacebookDialog.java    From platform-friends-android with BSD 2-Clause "Simplified" License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
 *                       the object must be marked as a new object to be created
 *                       (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                       true) or an exception will be thrown
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object
 * @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForObject(String objectProperty, List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    return this;
}
 
Example 14
Source File: FacebookDialog.java    From KlyphMessenger with MIT License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
 *                       the object must be marked as a new object to be created
 *                       (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                       true) or an exception will be thrown
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object
 * @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForObject(String objectProperty, List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    return this;
}
 
Example 15
Source File: FacebookDialog.java    From platform-friends-android with BSD 2-Clause "Simplified" License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentFilesForAction(List<File> bitmapFiles,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    return this;
}
 
Example 16
Source File: FacebookDialog.java    From barterli_android with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForAction(List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    return this;
}
 
Example 17
Source File: FacebookDialog.java    From barterli_android with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentFilesForAction(List<File> bitmapFiles,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    return this;
}
 
Example 18
Source File: FacebookDialog.java    From barterli_android with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Specifies a list of images for an Open Graph object referenced by the action that should be uploaded
 * prior to publishing the action. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.
 * The action must already have been set prior to calling this method, and
 * the action must have a GraphObject-valued property with the specified property name. This method will
 * generate unique names for the image attachments and update the graph object to refer to these
 * attachments. Note that calling setObject again after calling this method, or modifying the value of the
 * specified property, will not clear the image attachments already set, but the new action (or objects)
 * will have no reference to the existing attachments.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object;
 *                       the object must be marked as a new object to be created
 *                       (i.e., {@link com.facebook.model.OpenGraphObject#getCreateObject()} must return
 *                       true) or an exception will be thrown
 * @param objectProperty the name of a property on the action that corresponds to an Open Graph object
 * @param bitmapFiles a list of Files containing bitmaps to be uploaded and attached to the Open Graph object
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForObject(String objectProperty, List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.notNull(objectProperty, "objectProperty");
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateObjectAttachmentUrls(objectProperty, attachmentUrls, isUserGenerated);

    return this;
}
 
Example 19
Source File: FacebookDialog.java    From platform-friends-android with BSD 2-Clause "Simplified" License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information.</p>
 *
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmaps a list of Bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public OpenGraphActionDialogBuilder setImageAttachmentsForAction(List<Bitmap> bitmaps,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmaps, "bitmaps");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachments(bitmaps);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    return this;
}
 
Example 20
Source File: FacebookDialog.java    From FacebookImageShareIntent with MIT License 3 votes vote down vote up
/**
 * <p>Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the
 * action. The action must already have been set prior to calling this method. The images may be marked as being
 * user-generated -- refer to
 * <a href="https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/">this article</a>
 * for more information. This method will generate unique
 * names for the image attachments and update the action to refer to these attachments. Note that calling
 * setAction again after calling this method will not clear the image attachments already set, but the new
 * action will have no reference to the existing attachments.</p>
 * <p/>
 * <p>In order for the images to be provided to the Facebook application as part of the app call, the
 * NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.</p>
 *
 * @param bitmapFiles     a list of Files containing bitmaps to be uploaded and attached to the Open Graph action
 * @param isUserGenerated if true, specifies that the user_generated flag should be set for these images
 * @return this instance of the builder
 */
public CONCRETE setImageAttachmentFilesForAction(List<File> bitmapFiles,
        boolean isUserGenerated) {
    Validate.containsNoNulls(bitmapFiles, "bitmapFiles");
    if (action == null) {
        throw new FacebookException("Can not set attachments prior to setting action.");
    }

    List<String> attachmentUrls = addImageAttachmentFiles(bitmapFiles);
    updateActionAttachmentUrls(attachmentUrls, isUserGenerated);

    @SuppressWarnings("unchecked")
    CONCRETE result = (CONCRETE) this;
    return result;
}