<io.getstream.chat.android.ui.feature.mentions.list.MentionListView
android:id="@+id/mentionsListView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Mention List
MentionListView
is a UI Component that shows previews of messages that contain mentions of the current user.
Light Mode | Dark Mode |
---|---|
Usage
You can add this View via XML:
We recommend using this view with its ViewModel, which supplies it with data from the Stream API.
The basic setup of the ViewModel and connecting it to the View is done the following way:
val viewModel: MentionListViewModel by viewModels()
viewModel.bindView(mentionListView, viewLifecycleOwner)
MentionListViewModel viewModel = new ViewModelProvider(this).get(MentionListViewModel.class);
MentionListViewModelBinding.bind(viewModel, mentionListView, getViewLifecycleOwner());
From that point, you should be able to see messages which contain mentions of the current user.
bindView
sets listeners on the View and the ViewModel. Any additional listeners should be set after calling bindView
.
Handling Actions
MentionListView
allows you to configure certain actions on it:
mentionListView.setMentionSelectedListener { message ->
// Handle a mention item being clicked
}
mentionListView.setMentionSelectedListener(message -> {
// Handle a mention item being clicked
});
The full list of available listeners is available here.