Package com.zendesk.sdk.attachment
Class ImageUploadHelper
- java.lang.Object
-
- com.zendesk.sdk.attachment.ImageUploadHelper
-
public class ImageUploadHelper extends java.lang.Object
Class for helping anActivity
of keeping track of uploaded/uploading images
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
ImageUploadHelper.ImageUploadProgressListener
ImageUploadHelper
will allow to set a listener that will be notified when something interesting happens to an image.
-
Constructor Summary
Constructors Constructor and Description ImageUploadHelper(ImageUploadHelper.ImageUploadProgressListener imageUploadProgressListener, UploadProvider uploadProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
deleteAllAttachmentsBeforeShutdown()
This is the last call you will make on ImageUploadHelper.java.util.HashMap<AttachmentContainerHost.AttachmentState,java.util.List<java.io.File>>
getRecentState()
java.util.List<Attachment>
getUploadedAttachments()
Helper method.java.util.List<java.lang.String>
getUploadTokens()
Helper method.boolean
isImageUploadCompleted()
Check if all added images were uploadedjava.util.List<BelvedereResult>
removeDuplicateFilesFromList(java.util.List<BelvedereResult> files)
Helper method.void
removeImage(java.io.File file)
Remove a single attachmentvoid
reset()
Reset the state of ImageUploadHelpervoid
setImageUploadProgressListener(ImageUploadHelper.ImageUploadProgressListener imageUploadProgressListener)
void
uploadImage(BelvedereResult file, java.lang.String mimeType)
Start uploading a file
-
-
-
Constructor Detail
-
ImageUploadHelper
public ImageUploadHelper(ImageUploadHelper.ImageUploadProgressListener imageUploadProgressListener, UploadProvider uploadProvider)
-
-
Method Detail
-
uploadImage
public void uploadImage(BelvedereResult file, java.lang.String mimeType)
Start uploading a file- Parameters:
file
- Reference to a file on external storagemimeType
- 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.
-
getUploadTokens
public java.util.List<java.lang.String> getUploadTokens()
Helper method. Get allUploadResponse.token
from all successfully uploaded images- Returns:
- A list of
UploadResponse.token
-
getUploadedAttachments
public java.util.List<Attachment> getUploadedAttachments()
Helper method. Get allAttachment
from all successfully uploaded images- Returns:
- A list of
Attachment
-
getRecentState
public java.util.HashMap<AttachmentContainerHost.AttachmentState,java.util.List<java.io.File>> getRecentState()
-
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 ofFile
- Returns:
- A list of unique
File
-
reset
public void reset()
Reset the state of ImageUploadHelper
-
setImageUploadProgressListener
public void setImageUploadProgressListener(ImageUploadHelper.ImageUploadProgressListener imageUploadProgressListener)
- Parameters:
imageUploadProgressListener
- AImageUploadHelper.ImageUploadProgressListener
-
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
-
-