Class PopupAttachmentManager


  • public final class PopupAttachmentManager
    extends Object
    Manages PopupAttachments for a Popup.
    Since:
    100.0.0
    • Constructor Detail

      • PopupAttachmentManager

        public PopupAttachmentManager​(ArcGISFeature arcGISFeature)
        Constructs a PopupAttachmentManager to manage the attachments of the provided ArcGISFeature.
        Parameters:
        arcGISFeature - the ArcGISFeature for which to manage the attachments
        Throws:
        IllegalArgumentException - if arcGISFeature is null
        Since:
        100.0.0
    • Method Detail

      • addAttachment

        public PopupAttachment addAttachment​(String name,
                                             android.graphics.Bitmap image,
                                             android.graphics.Bitmap.CompressFormat format)
                                      throws IOException
        Adds the specified Bitmap image as an attachment with the specified name and compression format.
        Parameters:
        name - the name of the attachment
        image - the image to attach
        format - the compression format of the image, either PNG or JPEG
        Returns:
        the created PopupAttachment
        Throws:
        IllegalArgumentException - if image is null
        IOException - if there is an issue trying to save the image to a temporary file
        Since:
        100.0.0
      • addAttachment

        public PopupAttachment addAttachment​(String name,
                                             String contentType,
                                             InputStream data)
                                      throws IOException
        Adds the specified data as an attachment with the specified name and content type.
        Parameters:
        name - the name of the attachment
        contentType - the content type of the data
        data - the data to attach
        Returns:
        the created PopupAttachment
        Throws:
        IOException - if the stream cannot be read
        Since:
        100.0.0
      • deleteAttachment

        public void deleteAttachment​(PopupAttachment attachment)
        Deletes the specified PopupAttachment.
        Parameters:
        attachment - the PopupAttachment to delete
        Since:
        100.0.0
      • fetchAttachmentsAsync

        public ListenableFuture<List<PopupAttachment>> fetchAttachmentsAsync()
        Fetches the Attachments from the ArcGISFeature and creates PopupAttachments from them.
        Returns:
        a ListenableFuture that represents the result of the operation; the result is a list of PopupAttachments wrapping the ArcGISFeature's Attachments
        Since:
        100.0.0
      • getAttachments

        public List<PopupAttachment> getAttachments()
        Gets the current list of PopupAttachments.
        Returns:
        the current list of PopupAttachments
        Since:
        100.0.0
      • filterAttachments

        public List<PopupAttachment> filterAttachments()
        Returns a list of only the PopupAttachments that can be displayed after having sorted them in an alphabetically ascending order.
        Returns:
        an alphabetically sorted list of PopupAttachments that can be shown
        Since:
        100.0.0
      • applyChangesAsync

        public ListenableFuture<Void> applyChangesAsync()
        Applies the current changes to the ArcGISFeature in its ArcGISFeatureTable.
        Returns:
        a ListenableFuture that can be used to track the status of the operation
        Since:
        100.0.0
      • revertChanges

        public void revertChanges()
        Reverts the current working changes made to the Popup's attachments (such as addAttachment and deleteAttachment). This does not reverse a call to applyChangesAsync().
        Since:
        100.0.0