Skip to main content
Every component in the Android UI Kit follows a three-layer architecture. Understanding these layers is the key to unlocking deep customization without rebuilding components from scratch.

Architecture

Each component is composed of three collaborating classes:
LayerRoleExample Class
ViewRenders the UI, handles user interaction, and exposes setter methods for customization.CometChatConversations
ViewModelManages data fetching, state, and business logic via LiveData.ConversationsViewModel
AdapterBinds data to RecyclerView items and controls how each list row is rendered.ConversationsAdapter

Accessing Internal Layers

The View layer provides accessor methods to reach the other layers:
MethodReturnsPurpose
getViewModel()ConversationsViewModelAccess the ViewModel to observe LiveData, call mutation methods, or configure request builders.
getConversationsAdapter()ConversationsAdapterAccess the Adapter to manipulate list data or set view slots directly on the adapter.
getRecyclerView()RecyclerViewAccess the underlying RecyclerView for scroll listeners, layout manager changes, or item decorations.
getBinding()CometchatConversationsListViewBindingAccess the ViewBinding for direct manipulation of the component’s internal views.
val conversations = CometChatConversations(context)

// Access the ViewModel
val viewModel = conversations.getViewModel()

// Access the Adapter
val adapter = conversations.getConversationsAdapter()

// Access the RecyclerView
val recyclerView = conversations.getRecyclerView()

Customization Categories

The UI Kit provides eight categories of customization entry points. Each category has a dedicated guide:

View Slots

Replace specific regions of a component’s UI (leading view, title, subtitle, trailing view) using the ViewHolderListener pattern.

Styles

Customize visual appearance using XML theme attributes or programmatic setter methods on the View layer.

ViewModel & Data

Configure data fetching with RequestBuilders, observe LiveData, and call mutation methods on the ViewModel.

Adapters

Access or replace the RecyclerView Adapter to control how list items are rendered and manage list data.

Events & Callbacks

Handle click events, selection mode, and global UI Kit events with component-level and static event listeners.

State Views

Replace or restyle the default empty, error, and loading state views with custom layouts.

Text Formatters

Create custom text processors for hashtags, mentions, links, or any pattern using the CometChatTextFormatter API.

Menu & Options

Add, replace, or extend context menu actions and composer attachment options on components.
For global-level customization that spans across all message types and components, see the DataSource & ChatConfigurator guide.

What’s Next

If you’re new to customization, start with View Slots for quick UI changes, or Styles to match your brand. For advanced use cases like custom message types or global behavior changes, head to DataSource & ChatConfigurator.