Class ImageUploadHelper



  • public class ImageUploadHelper
    extends java.lang.Object
    Class for helping an Activity of keeping track of uploaded/uploading images
    • Method Detail

      • uploadImage

        public void uploadImage(BelvedereResult file,
                                java.lang.String mimeType)
        Start uploading a file
        Parameters:
        file - Reference to a file on external storage
        mimeType - the mime type of the image to upload
      • isImageUploadCompleted

        public boolean isImageUploadCompleted()
        Check if all added images were uploaded
        Returns:
        true if the image upload is complete, false otherwise.
      • getUploadedAttachments

        public java.util.List<Attachment> getUploadedAttachments()
        Helper method. Get all Attachment from all successfully uploaded images
        Returns:
        A list of Attachment
      • removeDuplicateFilesFromList

        public java.util.List<BelvedereResult> removeDuplicateFilesFromList(java.util.List<BelvedereResult> files)
        Helper method. Remove all file from provided list which already been added to upload queue.
        Parameters:
        files - A list of File
        Returns:
        A list of unique File
      • reset

        public void reset()
        Reset the state of ImageUploadHelper
      • removeImage

        public void removeImage(java.io.File file)
        Remove a single attachment
        Parameters:
        file - The file to remove
      • deleteAllAttachmentsBeforeShutdown

        public void deleteAllAttachmentsBeforeShutdown()
        This is the last call you will make on ImageUploadHelper. All uploaded attachments will be deleted on the remote server.

        There is no guarantee that all attachments will be deleted on the remote server. If deletion fails, they will be deleted automatically after UploadResponse.expiresAt