ImageMessage - admiral-team/admiralui-ios GitHub Wiki

Design

A view with background image with progress indicator and chat status.

Declaration

class ImageMessage @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr)

Overview

The component displays sent and received messages containing photos with progress indicators and chat status.

Live example

Configure an ImageMessage

To configure view at first you need to create it via xml:

<com.admiral.uikit.components.chat.image.ImageMessage
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:admiralMessageStatus="send"
    app:admiralTimeText="14:52" >

Then you need to put ChatImageView programmatically or via xml:

<com.admiral.uikit.components.chat.image.ImageMessage
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:admiralMessageStatus="send"
    app:admiralTimeText="14:52">

    <com.admiral.uikit.components.chat.image.ChatImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_chat_image" />
</com.admiral.uikit.components.chat.image.ImageMessage>

To set ChatImageView use method fun addImageView(imageView: ImageView?)

Active the progress indicator

(child as? ChatImageView)?.isLoading = true

You can set click listener on loading view:

(child as? ChatImageView)?.setLoaderClickListener {
    it.isLoading = true
}

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.