> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Compact Message Composer

> A compact, single-line message input component with rich text formatting, attachments, mentions, and voice recording support.

## Overview

CometChatCompactMessageComposer is a [Component](/ui-kit/android/components-overview#components) that provides a compact, single-line message input designed for chat applications. It offers a streamlined interface with optional rich text formatting capabilities, supporting bold, italic, strikethrough, code, links, lists, and blockquotes.

Features such as **Rich Text Formatting**, **Attachments**, **Message Editing**, **Mentions**, **Stickers**, and **Voice Recording** are supported.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/21UBnagXOw-XG0Sv/images/android-compact-composer.png?fit=max&auto=format&n=21UBnagXOw-XG0Sv&q=85&s=4fe8108dc467b24bc18d3fbc9e11dade" width="840" height="152" data-path="images/android-compact-composer.png" />
</Frame>

## Usage

### Integration

The following code snippet illustrates how you can directly incorporate the CompactMessageComposer component into your `layout.xml` file.

```xml theme={null}
<com.cometchat.chatuikit.compactmessagecomposer.CometChatCompactMessageComposer
    android:id="@+id/compact_message_composer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
```

<Warning>
  The CompactMessageComposer is responsible for managing runtime permissions. To ensure the **ActivityResultLauncher** is properly initialized, its object should be created in the **onCreate** state of an activity. To ensure that the composer is loaded within the fragment, it is important to make sure that the fragment is loaded in the `onCreate` state of the activity.
</Warning>

### Actions

[Actions](/ui-kit/android/components-overview#actions) dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.

##### setOnSendClickListener

The `setOnSendClickListener` event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer. However, you can override this action with the following code snippet.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setOnSendClickListener(new CometChatCompactMessageComposer.SendButtonClickListener() {
        @Override
        public void onSendClick(Context context, BaseMessage baseMessage) {
            Toast.makeText(context, "OnSendButtonClicked ..", Toast.LENGTH_SHORT).show();
        }
    });
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setOnSendClickListener(
        CometChatCompactMessageComposer.SendButtonClickListener { context, baseMessage ->
            Toast.makeText(context, "OnSendButtonClicked ..", Toast.LENGTH_SHORT).show()
        }
    )
    ```
  </Tab>
</Tabs>

##### setOnErrorListener

This action doesn't change the behavior of the component but rather listens for any errors that occur in the CompactMessageComposer component.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setOnErrorListener(new CometChatCompactMessageComposer.OnErrorListener() {
        @Override
        public void onError(Exception e) {
            // Your Exception Handling code.
        }
    });
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setOnErrorListener(
        CometChatCompactMessageComposer.OnErrorListener { e ->
            // Your Exception Handling code.
        }
    )
    ```
  </Tab>
</Tabs>

##### setOnTextChangeListener

Function triggered whenever the message input's text value changes, enabling dynamic text handling.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setOnTextChangeListener(new CometChatCompactMessageComposer.OnTextChangeListener() {
        @Override
        public void onTextChange(String text) {
            // Handle text change
        }
    });
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setOnTextChangeListener(
        CometChatCompactMessageComposer.OnTextChangeListener { text ->
            // Handle text change
        }
    )
    ```
  </Tab>
</Tabs>

##### setOnAttachmentClickListener

This action is triggered when the attachment button is clicked. You can override the default attachment sheet behavior with a custom implementation.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setOnAttachmentClickListener(new CometChatCompactMessageComposer.OnAttachmentClickListener() {
        @Override
        public void onAttachmentClick() {
            // Your custom attachment handling
        }
    });
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setOnAttachmentClickListener(
        CometChatCompactMessageComposer.OnAttachmentClickListener {
            // Your custom attachment handling
        }
    )
    ```
  </Tab>
</Tabs>

***

### Filters

CompactMessageComposer component does not have any available filters.

***

### Events

[Events](/ui-kit/android/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.

The CompactMessageComposer Component does not emit any events of its own.

***

## Customization

To fit your app's design requirements, you can customize the appearance of the CompactMessageComposer component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

### Style

Using Style you can customize the look and feel of the component in your app. These parameters typically control elements such as the color, size, shape, and fonts used within the component.

```html theme={null}
<!-- active send button drawable -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32"
    android:viewportHeight="32">
    <path
        android:fillColor="#F76808"
        android:pathData="M16,0L16,0A16,16 0,0 1,32 16L32,16A16,16 0,0 1,16 32L16,32A16,16 0,0 1,0 16L0,16A16,16 0,0 1,16 0z" />
    <group>
        <clip-path android:pathData="M4,4h24v24h-24z" />
        <path
            android:fillColor="?attr/cometchatColorWhite"
            android:pathData="M10.767,22.723C10.465,22.843 10.178,22.818 9.907,22.646C9.636,22.474 9.5,22.223 9.5,21.894V17.673L16.423,16L9.5,14.327V10.106C9.5,9.777 9.636,9.526 9.907,9.354C10.178,9.182 10.465,9.157 10.767,9.277L24.723,15.161C25.095,15.328 25.281,15.608 25.281,16.002C25.281,16.395 25.095,16.674 24.723,16.838L10.767,22.723Z" />
    </group>
</vector>
```

```xml theme={null}
<!-- themes.xml -->
<style name="CustomCompactMessageComposerStyle" parent="CometChatCompactMessageComposerStyle">
    <item name="cometchatCompactMessageComposerAttachmentIconTint">#F76808</item>
    <item name="cometchatCompactMessageComposerVoiceRecordingIconTint">#F76808</item>
    <item name="cometchatCompactMessageComposerStickerIconTint">#F76808</item>
    <item name="cometchatCompactMessageComposerAIIconTint">#F76808</item>
    <item name="cometchatCompactMessageComposerActiveSendButtonDrawable">
        @drawable/active_send_button
    </item>
</style>
```

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setStyle(R.style.CustomCompactMessageComposerStyle);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setStyle(R.style.CustomCompactMessageComposerStyle)
    ```
  </Tab>
</Tabs>

***

### Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.

Below is a list of customizations along with corresponding code snippets

| Property                                       | Description                                                                                                                                                                                                                                      | Code                                                        |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| **User**                                       | Used to pass user object of which header specific details will be shown                                                                                                                                                                          | `.setUser(user)`                                            |
| **Group**                                      | Used to pass group object of which header specific details will be shown                                                                                                                                                                         | `.setGroup(group)`                                          |
| **setParentMessageId**                         | Sets the parent message ID for threaded replies                                                                                                                                                                                                  | `.setParentMessageId(long)`                                 |
| **setPlaceholderText**                         | Sets the placeholder text for the input field                                                                                                                                                                                                    | `.setPlaceholderText("Type a message...")`                  |
| **setMaxLines**                                | Maximum lines allowed to increase in the input field                                                                                                                                                                                             | `.setMaxLines(int)`                                         |
| **setEnterKeyBehavior**                        | Determines the behavior of the Enter key. `SEND_MESSAGE` sends the message, `NEW_LINE` inserts a new line                                                                                                                                        | `.setEnterKeyBehavior(EnterKeyBehavior.SEND_MESSAGE)`       |
| **setText**                                    | Used to set text programmatically                                                                                                                                                                                                                | `.setText("Your_Text")`                                     |
| **setEnableRichTextFormatting**                | Master switch to enable or disable rich text formatting (bold, italic, etc.)                                                                                                                                                                     | `.setEnableRichTextFormatting(boolean)`                     |
| **setRichTextFormattingOptionsVisibility**     | Controls the visibility of the rich text formatting toolbar                                                                                                                                                                                      | `.setRichTextFormattingOptionsVisibility(View.VISIBLE)`     |
| **setShowTextSelectionMenuItems**              | Shows formatting options (Bold, Italic, Strikethrough, Code) in the text selection context menu                                                                                                                                                  | `.setShowTextSelectionMenuItems(true)`                      |
| **setDisableTypingEvents**                     | Used to disable/enable typing events, default false                                                                                                                                                                                              | `.setDisableTypingEvents(boolean)`                          |
| **setDisableSoundForMessages**                 | Used to toggle sound for outgoing messages                                                                                                                                                                                                       | `.setDisableSoundForMessages(boolean)`                      |
| **setCustomSoundForMessages**                  | Used to give custom sounds to outgoing messages                                                                                                                                                                                                  | `.setCustomSoundForMessages(R.raw.sound)`                   |
| **setDisableMentions**                         | Sets whether mentions in text should be disabled. Processes the text formatters. If there are text formatters available and the disableMentions flag is set to true, it removes any formatters that are instances of CometChatMentionsFormatter. | `.setDisableMentions(true)`                                 |
| **setDisableMentionAll**                       | Controls whether group mentions like @all appear in suggestions                                                                                                                                                                                  | `.setDisableMentionAll(true)`                               |
| **setAttachmentButtonVisibility**              | Hides the attachment button in the composer                                                                                                                                                                                                      | `.setAttachmentButtonVisibility(View.VISIBLE)`              |
| **setVoiceRecordingButtonVisibility**          | Hides the voice recording button in the composer                                                                                                                                                                                                 | `.setVoiceRecordingButtonVisibility(View.GONE)`             |
| **setStickerButtonVisibility**                 | Hides the sticker button in the composer                                                                                                                                                                                                         | `.setStickerButtonVisibility(View.GONE)`                    |
| **setAIButtonVisibility**                      | Hides the AI button in the composer                                                                                                                                                                                                              | `.setAIButtonVisibility(View.GONE)`                         |
| **setSendButtonVisibility**                    | Hides the send button in the composer                                                                                                                                                                                                            | `.setSendButtonVisibility(View.VISIBLE)`                    |
| **setCameraAttachmentOptionVisibility**        | Controls whether camera attachments are allowed                                                                                                                                                                                                  | `.setCameraAttachmentOptionVisibility(View.VISIBLE)`        |
| **setImageAttachmentOptionVisibility**         | Controls whether image attachments are allowed                                                                                                                                                                                                   | `.setImageAttachmentOptionVisibility(View.VISIBLE)`         |
| **setVideoAttachmentOptionVisibility**         | Controls whether video attachments are allowed                                                                                                                                                                                                   | `.setVideoAttachmentOptionVisibility(View.VISIBLE)`         |
| **setAudioAttachmentOptionVisibility**         | Controls whether audio attachments are allowed                                                                                                                                                                                                   | `.setAudioAttachmentOptionVisibility(View.VISIBLE)`         |
| **setFileAttachmentOptionVisibility**          | Controls whether file attachments are allowed                                                                                                                                                                                                    | `.setFileAttachmentOptionVisibility(View.VISIBLE)`          |
| **setPollAttachmentOptionVisibility**          | Controls whether polls can be shared                                                                                                                                                                                                             | `.setPollAttachmentOptionVisibility(View.VISIBLE)`          |
| **setCollaborativeDocumentOptionVisibility**   | Controls whether collaborative documents can be shared                                                                                                                                                                                           | `.setCollaborativeDocumentOptionVisibility(View.VISIBLE)`   |
| **setCollaborativeWhiteboardOptionVisibility** | Controls whether collaborative whiteboards can be shared                                                                                                                                                                                         | `.setCollaborativeWhiteboardOptionVisibility(View.VISIBLE)` |

***

### Rich Text Formatting

`CometChatCompactMessageComposer` includes built-in rich text formatting support with an inline toolbar displayed above the input field.

#### Configuration

| Property                                 | Type      | Default        | Description                                                                                                                       |
| ---------------------------------------- | --------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `setEnableRichTextFormatting`            | `boolean` | `true`         | Master switch for rich text formatting. When false, toolbar and text selection menu items are disabled                            |
| `setRichTextFormattingOptionsVisibility` | `int`     | `View.VISIBLE` | Controls whether the rich text toolbar is visible above the composer. Only works when `enableRichTextFormatting` is true          |
| `setShowTextSelectionMenuItems`          | `boolean` | `true`         | Controls whether formatting options appear in the text selection context menu. Only works when `enableRichTextFormatting` is true |

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // Enable rich text with all options (default)
    compactMessageComposer.setEnableRichTextFormatting(true);
    compactMessageComposer.setRichTextFormattingOptionsVisibility(View.VISIBLE);
    compactMessageComposer.setShowTextSelectionMenuItems(true);

    // Disable rich text formatting entirely
    compactMessageComposer.setEnableRichTextFormatting(false);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Enable rich text with all options (default)
    compactMessageComposer.isEnableRichTextFormatting = true
    compactMessageComposer.richTextFormattingOptionsVisibility = View.VISIBLE
    compactMessageComposer.isShowTextSelectionMenuItems = true

    // Disable rich text formatting entirely
    compactMessageComposer.isEnableRichTextFormatting = false
    ```
  </Tab>
</Tabs>

#### Supported Format Types

| Format        | Description             | Markdown Syntax |
| ------------- | ----------------------- | --------------- |
| Bold          | Makes text bold         | `**text**`      |
| Italic        | Makes text italic       | `*text*`        |
| Strikethrough | Strikes through text    | `~~text~~`      |
| Inline Code   | Formats as inline code  | `` `code` ``    |
| Code Block    | Creates a code block    | ` ```code``` `  |
| Blockquote    | Creates a blockquote    | `> text`        |
| Numbered List | Creates a numbered list | `1. item`       |
| Bullet List   | Creates a bullet list   | `- item`        |
| Link          | Creates a hyperlink     | `[text](url)`   |

#### Enter Key Behavior

Configure what happens when the Enter key is pressed using `setEnterKeyBehavior`.

| Value                           | Behavior                      |
| ------------------------------- | ----------------------------- |
| `EnterKeyBehavior.NEW_LINE`     | Inserts a new line (default)  |
| `EnterKeyBehavior.SEND_MESSAGE` | Sends the message immediately |

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // Send message on Enter
    compactMessageComposer.setEnterKeyBehavior(EnterKeyBehavior.SEND_MESSAGE);

    // New line on Enter (default)
    compactMessageComposer.setEnterKeyBehavior(EnterKeyBehavior.NEW_LINE);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Send message on Enter
    compactMessageComposer.setEnterKeyBehavior(EnterKeyBehavior.SEND_MESSAGE)

    // New line on Enter (default)
    compactMessageComposer.setEnterKeyBehavior(EnterKeyBehavior.NEW_LINE)
    ```
  </Tab>
</Tabs>

***

### Advanced

For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.

***

#### setTextFormatters

Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out [CometChatMentionsFormatter](/ui-kit/android/mentions-formatter-guide)

**Example**

```xml themes.xml theme={null}
<style name="CustomCompactMessageComposerMentionsStyle" parent="CometChatMessageComposerMentionsStyle">
    <item name="cometchatMentionTextAppearance">?attr/cometchatTextAppearanceBodyRegular</item>
    <item name="cometchatMentionTextColor">#000000</item>
    <item name="cometchatMentionBackgroundColor">#000000</item>
    <item name="cometchatSelfMentionTextColor">#30A46C</item>
    <item name="cometchatSelfMentionTextAppearance">?attr/cometchatTextAppearanceBodyRegular</item>
    <item name="cometchatSelfMentionBackgroundColor">#30A46C</item>
</style>
```

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // Initialize CometChatMentionsFormatter
    CometChatMentionsFormatter mentionFormatter = new CometChatMentionsFormatter(context);

    // set style to customize composer mention text
    mentionFormatter.setMessageComposerMentionTextStyle(context, R.style.CustomCompactMessageComposerMentionsStyle);

    // This can be passed as an array of formatter in CometChatCompactMessageComposer by using setTextFormatters method.
    List<CometChatTextFormatter> textFormatters = new ArrayList<>();
    textFormatters.add(mentionFormatter);
    compactMessageComposer.setTextFormatters(textFormatters);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Initialize CometChatMentionsFormatter
    val mentionFormatter = CometChatMentionsFormatter(context)
    // set style to customize composer mention text
    mentionFormatter.setMessageComposerMentionTextStyle(context, R.style.CustomCompactMessageComposerMentionsStyle)

    // This can be passed as an array of formatter in CometChatCompactMessageComposer by using setTextFormatters method.
    val textFormatters: MutableList<CometChatTextFormatter> = ArrayList()
    textFormatters.add(mentionFormatter)
    compactMessageComposer.setTextFormatters(textFormatters)
    ```
  </Tab>
</Tabs>

#### setAttachmentOptions

By using `setAttachmentOptions()`, you can set a list of custom `MessageComposerActions` for the CompactMessageComposer Component. This will override the existing list of `MessageComposerActions`.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setAttachmentOptions(actionList);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setAttachmentOptions(actionList)
    ```
  </Tab>
</Tabs>

**Example**

In this example, we are overriding the existing MessageComposerActions List with custom actions.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    List<CometChatMessageComposerAction> actionList = new ArrayList<>();

    CometChatMessageComposerAction action1 = new CometChatMessageComposerAction();
    action1.setTitle("Custom Option 1");
    action1.setIcon(R.drawable.ic_cp_1);
    action1.setOnClick(new OnClick() {
        @Override
        public void onClick() {
            Toast.makeText(context, "Custom Option 1 !!!", Toast.LENGTH_SHORT).show();
        }
    });
    actionList.add(action1);

    CometChatMessageComposerAction action2 = new CometChatMessageComposerAction();
    action2.setTitle("Custom Option 2");
    action2.setIcon(R.drawable.ic_cp_2);
    action2.setOnClick(new OnClick() {
        @Override
        public void onClick() {
            Toast.makeText(context, "Custom Option 2 !!!", Toast.LENGTH_SHORT).show();
        }
    });
    actionList.add(action2);

    compactMessageComposer.setAttachmentOptions(actionList);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    val actionList = ArrayList<CometChatMessageComposerAction>()

    val action1 = CometChatMessageComposerAction()
    action1.title = "Custom Option 1"
    action1.icon = R.drawable.ic_cp_1
    action1.onClick = {
        Toast.makeText(context, "Custom Option 1 !!!", Toast.LENGTH_SHORT).show()
    }
    actionList.add(action1)

    val action2 = CometChatMessageComposerAction()
    action2.title = "Custom Option 2"
    action2.icon = R.drawable.ic_cp_2
    action2.onClick = {
        Toast.makeText(context, "Custom Option 2 !!!", Toast.LENGTH_SHORT).show()
    }
    actionList.add(action2)

    compactMessageComposer.setAttachmentOptions(actionList)
    ```
  </Tab>
</Tabs>

***

#### setAuxiliaryButtonView

You can insert a custom view into the CompactMessageComposer component to add additional functionality using the following method.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setAuxiliaryButtonView(view);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setAuxiliaryButtonView(view)
    ```
  </Tab>
</Tabs>

Please note that the CompactMessageComposer Component utilizes the AuxiliaryButton to provide sticker functionality. Overriding the AuxiliaryButton will subsequently replace the sticker functionality.

**Example**

In this example, we'll be adding a custom button with click functionality. You'll first need to create a layout file and then inflate it inside the `.setAuxiliaryButtonView()` function.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    ImageView imageView = new ImageView(this);
    imageView.setImageResource(R.drawable.save_icon);
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);

    linearLayout.addView(imageView);
    compactMessageComposer.setAuxiliaryButtonView(linearLayout);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    val imageView = ImageView(this)
    imageView.setImageResource(R.drawable.save_icon)
    val linearLayout = LinearLayout(this)
    linearLayout.orientation = LinearLayout.HORIZONTAL

    linearLayout.addView(imageView)
    compactMessageComposer.setAuxiliaryButtonView(linearLayout)
    ```
  </Tab>
</Tabs>

***

#### setSendButtonView

You can set a custom view in place of the already existing send button view using the following method.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setSendButtonView(view);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setSendButtonView(view)
    ```
  </Tab>
</Tabs>

**Example**

```xml drawable/custom_send_button.xml theme={null}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32"
    android:viewportHeight="32">
  <path
      android:pathData="M4,0L28,0A4,4 0,0 1,32 4L32,28A4,4 0,0 1,28 32L4,32A4,4 0,0 1,0 28L0,4A4,4 0,0 1,4 0z"
      android:fillColor="#EDEAFA"/>
  <path
      android:pathData="M16.977,24.922C16.612,24.922 16.349,24.792 16.188,24.531C16.026,24.271 15.888,23.945 15.773,23.555L14.531,19.43C14.458,19.169 14.432,18.961 14.453,18.805C14.474,18.643 14.56,18.482 14.711,18.32L22.688,9.719C22.734,9.672 22.758,9.62 22.758,9.563C22.758,9.505 22.737,9.458 22.695,9.422C22.654,9.385 22.604,9.367 22.547,9.367C22.495,9.362 22.445,9.383 22.398,9.43L13.828,17.438C13.656,17.594 13.49,17.682 13.328,17.703C13.167,17.719 12.961,17.688 12.711,17.609L8.492,16.328C8.117,16.213 7.807,16.078 7.563,15.922C7.318,15.76 7.195,15.5 7.195,15.141C7.195,14.859 7.307,14.617 7.531,14.414C7.755,14.211 8.031,14.047 8.359,13.922L21.797,8.773C21.979,8.706 22.148,8.654 22.305,8.617C22.466,8.576 22.612,8.555 22.742,8.555C22.997,8.555 23.198,8.628 23.344,8.773C23.49,8.919 23.563,9.12 23.563,9.375C23.563,9.51 23.542,9.656 23.5,9.813C23.463,9.969 23.412,10.138 23.344,10.32L18.227,23.688C18.081,24.063 17.906,24.362 17.703,24.586C17.5,24.81 17.258,24.922 16.977,24.922Z"
      android:fillColor="#6852D6"/>
</vector>
```

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    ImageView imageView = new ImageView(this);
    imageView.setImageResource(R.drawable.custom_send_button);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(YourActivity.this, "Custom Send Button Clicked !!!", Toast.LENGTH_SHORT).show();
        }
    });
    compactMessageComposer.setSendButtonView(imageView);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    val imageView = ImageView(this)
    imageView.setImageResource(R.drawable.custom_send_button)
    imageView.setOnClickListener {
        Toast
            .makeText(this@YourActivity, "Custom Send Button Clicked !!!", Toast.LENGTH_SHORT)
            .show()
    }
    compactMessageComposer.setSendButtonView(imageView)
    ```
  </Tab>
</Tabs>

***

#### setHeaderView

You can set custom headerView to the CompactMessageComposer component using the following method.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setHeaderView(view);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setHeaderView(view)
    ```
  </Tab>
</Tabs>

**Example**

In the following example, we're going to apply a mock smart reply view to the CompactMessageComposer Component using the `.setHeaderView()` method.

```xml custom_header_layout.xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <com.google.android.material.card.MaterialCardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/cometchat_10dp"
        android:layout_marginTop="@dimen/cometchat_margin_1"
        android:layout_marginEnd="@dimen/cometchat_10dp"
        android:layout_marginBottom="@dimen/cometchat_margin_1"
        android:elevation="0dp"
        app:cardBackgroundColor="#EDEAFA"
        app:cardCornerRadius="@dimen/cometchat_10dp"
        app:cardElevation="0dp">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/cometchat_padding_3"
            android:layout_marginTop="@dimen/cometchat_padding_1"
            android:layout_marginEnd="@dimen/cometchat_padding_3"
            android:layout_marginBottom="@dimen/cometchat_padding_1"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="20dp"
                android:layout_height="@dimen/cometchat_20dp"
                android:src="@drawable/ic_calls"
                app:tint="?attr/cometchatPrimaryColor" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/cometchat_margin_1"
                android:text="Notes"
                android:textAppearance="?attr/cometchatTextAppearanceBodyRegular"
                android:textColor="?attr/cometchatTextColorPrimary" />
        </LinearLayout>
    </com.google.android.material.card.MaterialCardView>

</LinearLayout>
```

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    View view = getLayoutInflater().inflate(R.layout.custom_header_layout, null);
    compactMessageComposer.setHeaderView(view);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    val view: View = LayoutInflater.from(context).inflate(R.layout.custom_header_layout, null)
    compactMessageComposer.setHeaderView(view)
    ```
  </Tab>
</Tabs>

***

#### setFooterView

You can set a custom footer view to the CompactMessageComposer component using the following method.

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    compactMessageComposer.setFooterView(view);
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    compactMessageComposer.setFooterView(view)
    ```
  </Tab>
</Tabs>
