# Chatroom Page

![](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MX0mOAVWkotGme0iRzu%2F-MX71pAG9T-gEF3fYgW3%2F-MX74sEjM-aBTiAt32OH%2Fimage%20\(37\)%20\(1\).png?alt=media\&token=6b1d3a57-4e5a-4614-970b-27fa38a666a0)

## Message List Page Header

![](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MX0mOAVWkotGme0iRzu%2F-MX71pAG9T-gEF3fYgW3%2F-MX74xJiQmptWYfMp9hs%2Fimage%20\(38\)%20\(1\).png?alt=media\&token=b7cd0f0c-1e5d-48a7-89da-7f4b846246c6)

| Feature           | Description                                                                     |
| ----------------- | ------------------------------------------------------------------------------- |
| User avartar      | If the user has no avatar, the system will show the default avatar.             |
| User Display name | If  the user has no display name, the default display name will be 'anonymous'. |
| Back button       | Redirects user back to the previous page.                                       |

## Message List&#x20;

![](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MX0mOAVWkotGme0iRzu%2F-MX71pAG9T-gEF3fYgW3%2F-MX750kHSE4zEwFBLUeL%2Fimage%20\(39\)%20\(1\).png?alt=media\&token=46b81c9d-ddb4-4082-90af-750dc2bf4cf3)

| Feature              | Description                                                                                                    |
| -------------------- | -------------------------------------------------------------------------------------------------------------- |
| Show list of message | The latest message bubble will be on the bottom of the screen, and the user can scroll up to see all messages. |
| Date label           | Grouping messages by the sent date.                                                                            |

### Message bubble - Text message bubble

![](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MX0mOAVWkotGme0iRzu%2F-MX71pAG9T-gEF3fYgW3%2F-MX756LwuAsurdOqkVP8%2Fimage%20\(40\)%20\(1\).png?alt=media\&token=e17bd5e3-8d05-487d-87e6-60f29d1d4d30)

| Feature                         | Description                                                                                                                                                   |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Read more mode.                 | When the text is more than 13 lines, the system show read more mode. Once it is clicked on the read more button, it expands text to the full size.            |
| Long press to delete            | If the long click event occurs, the system will show the delete option.                                                                                       |
| Long press to edit              | If the long click event occurs, the system will show the edit option. When click the edit option, the system will redirect the user to the edit message page. |
| Error to send message indicator | If the message can not be sent, the system will show the error indicator in front of the message bubble.                                                      |
| Sent time stamp                 | Show as time stamp HH :MM.                                                                                                                                    |
| Edited label                    | If the message is edited , the edited label will be shown.                                                                                                    |
| Deleted message                 | If the message is deleted , the deleted view will be shown.                                                                                                   |

### Message bubble - Image message bubble

<figure><img src="https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2F0hTvWBudzSaBDDCkKJk2%2FScreenshot%202566-02-22%20at%2012.56.49.png?alt=media&#x26;token=9484dbe5-e1bd-4c56-8b52-6e2388b04a9e" alt=""><figcaption></figcaption></figure>

| Feature            | Description                                                                                                                 |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| Image thumbnails   | The system shows the image base on the image ratio. Once it is clicked, it will redirect the user to the edit message page. |
| Image upload state | The system will show the image uploading indicator while the image is being uploaded.                                       |

### Image Preview Page

<figure><img src="https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2FX68sVT0soYWpL7RVQnQB%2FScreenshot%202566-02-22%20at%2012.57.42.png?alt=media&#x26;token=79f539c2-d368-4c86-9ff0-a41e54de8524" alt=""><figcaption></figcaption></figure>

| Feature            | Description                                                |
| ------------------ | ---------------------------------------------------------- |
| Pinch zoom gesture | The user can pinch the screen to zoom in or out the image. |
| back               | Redirect user back to the previous page.                   |

### Message Bubble - Audio Message Bubble

<figure><img src="https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2FgHsOfyol7NA4CAbI9NIU%2FScreenshot%202566-02-22%20at%2013.10.39.png?alt=media&#x26;token=a72fcf82-9438-415e-94a9-526470a27286" alt=""><figcaption></figcaption></figure>

| Feature       | Description                                                                                                                    |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Click to play | If the user clicks on the voice message , the system will play the audio.                                                      |
| Click to stop | If the user clicks on the playing voice message or play another voice message, the system will stop playing the playing audio. |

### Audio message recorder

![](https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MX0mOAVWkotGme0iRzu%2F-MX71pAG9T-gEF3fYgW3%2F-MX75OtjGacPH7iMoykV%2Fimage%20\(44\)%20\(1\).png?alt=media\&token=f97ed6b9-2e52-4870-964d-330ec610a60e)

| Feature            | Description                                                                                                                                   |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Hold to record     | The user can hold to record an audio message for up to 60 seconds. Once the user releases the finger, the system will send the audio message. |
| Discard the record | The user can drag the finger to the bin button to discard the current recording session.                                                      |

### Edit Text Message Page

<figure><img src="https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2FPFwjj0rEGayMj41xPGgV%2FScreenshot%202566-02-22%20at%2013.11.40.png?alt=media&#x26;token=95235509-b503-43d7-a7fa-0b8e90150b54" alt=""><figcaption></figcaption></figure>

| Feature        | Description                                                                |
| -------------- | -------------------------------------------------------------------------- |
| Add text       | The user can update the text from the original input.                      |
| Save           | The user can click save button to save the changes he made.                |
| Discard change | The user can click 'x' to discard all changes before the user clicks save. |

## Usage

### **Start an Activity**&#x20;

&#x20;If you don’t need to do any customisation other than global theme customisation, you can use our AmityMessageListActivit&#x79;**.** Use the intent to move from one activity to the **AmityChatHomePageActivity** as follows:

```
//replace "channelId" with actual channelID
val messageIntent = AmityMessageListActivity.newIntent(this, "channelId")
startActivity(messageIntent)
```

### **Create a Fragment**&#x20;

&#x20;If you need to customize the user interface, you can use our  `AmityChatRoomFragment`**.**

```
class MainActivity : AppCompatActivity() {

   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)

        val chatRoomFragment = AmityChatRoomFragment
                                .newInstance("channelId")
                                .composeBar(AmityChatRoomComposeBar.TEXT)
                                .enableChatToolbar(boolean)
                                .enableConnectionBar(boolean)
                                .build(activity)
       
        val transaction = supportFragmentManager.beginTransaction()
        transaction.replace(R.id.fragmentContainer, chatRoomFragment)
        transaction.addToBackStack(null)
        transaction.commit()
   }
}
```

**Toolbar Option**&#x20;

We provide an ability to enable or disable Chatroom's toolbar by using `enableChatToolbar(boolean)` when initializing a fragment instance.

By default the UIKit comes with toolbar enabled.

```
AmityChatRoomFragment.newInstance(channelId)
            .enableChatToolbar(boolean)
            .build(this)
```

**Connection Bar Option**&#x20;

We provide an ability to enable or disable Chatroom's connection bar by using `enableConnectionBar(boolean)` when initializing a fragment instance.

By default the UIKit comes with connection bar enabled.

```
AmityChatRoomFragment.newInstance(channelId)
            .enableConnectionBar(boolean)
            .build(this)
```

**Compose bar Option**

There are two compose bar options avaialble in the UIKit.&#x20;

1. `AmityChatRoomComposeBar.DEFAULT` - has full functionalities including text, audio, and image message sending
2. `AmityChatRoomComposeBar.TEXT` - has simple functionalities which are only limited to text message sending

By default the UIKit comes with `AmityChatRoomComposeBar.DEFAULT`.

```
AmityChatRoomFragment.newInstance(channelId)
            .composeBar(AmityChatRoomComposeBar.TEXT)
            .build(this)
```
