AttachmentPreviewFactoryManager

class AttachmentPreviewFactoryManager @JvmOverloads constructor(attachmentPreviewFactories: List<AttachmentPreviewFactory> = listOf( MediaAttachmentPreviewFactory(), AudioRecordAttachmentPreviewFactory(), FileAttachmentPreviewFactory(), ), fallbackAttachmentPreviewFactory: FallbackAttachmentPreviewFactory = FallbackAttachmentPreviewFactory())

A manager for registered attachment preview factories.

Parameters

attachmentPreviewFactories

The list of ViewHolder factories for attachment preview items.

fallbackAttachmentPreviewFactory

The fallback factory that will be used in case there are no other factories that can handle the attachment.

Constructors

Link copied to clipboard
constructor(attachmentPreviewFactories: List<AttachmentPreviewFactory> = listOf( MediaAttachmentPreviewFactory(), AudioRecordAttachmentPreviewFactory(), FileAttachmentPreviewFactory(), ), fallbackAttachmentPreviewFactory: FallbackAttachmentPreviewFactory = FallbackAttachmentPreviewFactory())

Functions

Link copied to clipboard
fun getItemViewType(attachment: Attachment): Int

Finds the first factory that is capable of displaying the given attachment and return a view type associated with the factory.

Link copied to clipboard
fun onCreateViewHolder(parentView: ViewGroup, viewType: Int, attachmentRemovalListener: (Attachment) -> Unit, style: MessageComposerViewStyle? = null): AttachmentPreviewViewHolder

Creates and instantiates a new instance of AttachmentPreviewViewHolder.