Channel Header View Model

LAST EDIT Aug 02 2021

ChannelsHederViewModel is responsible for keeping ChannelHeaderView up to date using StreamChatAndroidOffline library.

The view model watches for particular channel data changes and exposes information using the following LiveData objects:

  • members

  • channelState

  • anyOtherUsersOnline

Creating Channel HeaderView Model


ChannelHeaderViewModel can be instantiated using ChannelViewModelFactory:

Binding with ChannelHeaderView


ChannelsViewModel can be bound with ChannelHeaderView using ChannelHeaderViewModelBinding:

From that point, the view model will make sure that ChannelHeaderView displays correct:

  • Channel title

  • Members avatars

  • Active indicator

  • Last active date