bindView

@JvmName(name = "bind")
fun MessageComposerViewModel.bindView(view: MessageComposerView, lifecycleOwner: LifecycleOwner, messageBuilder: () -> Message = { buildNewMessage() }, sendMessageButtonClickListener: (Message) -> Unit = this.sendMessageButtonClickListener, textInputChangeListener: (String) -> Unit = this.textInputChangeListener, attachmentSelectionListener: (List<Attachment>) -> Unit = this.attachmentSelectionListener, attachmentRemovalListener: (Attachment) -> Unit = this.attachmentRemovalListener, pollSubmissionListener: (PollConfig) -> Unit = this.pollSubmissionListener, mentionSelectionListener: (User) -> Unit = this.mentionSelectionListener, commandSelectionListener: (Command) -> Unit = this.commandSelectionListener, alsoSendToChannelSelectionListener: (Boolean) -> Unit = this.alsoSendToChannelSelectionListener, dismissActionClickListener: () -> Unit = this.dismissActionClickListener, commandsButtonClickListener: () -> Unit = this.commandsButtonClickListener, dismissSuggestionsListener: () -> Unit = this.dismissSuggestionsListener, audioRecordButtonHoldListener: () -> Unit = this.audioRecordButtonHoldListener, audioRecordButtonLockListener: () -> Unit = this.audioRecordButtonLockListener, audioRecordButtonCancelListener: () -> Unit = this.audioRecordButtonCancelListener, audioRecordButtonReleaseListener: () -> Unit = this.audioRecordButtonReleaseListener, audioDeleteButtonClickListener: () -> Unit = this.audioDeleteButtonClickListener, audioStopButtonClickListener: () -> Unit = this.audioStopButtonClickListener, audioPlaybackButtonClickListener: () -> Unit = this.audioPlaybackButtonClickListener, audioCompleteButtonClickListener: () -> Unit = this.audioCompleteButtonClickListener, audioSliderDragStartListener: (Float) -> Unit = this.audioSliderDragStartListener, audioSliderDragStopListener: (Float) -> Unit = this.audioSliderDragStopListener)

Function which connects MessageComposerView to MessageComposerViewModel. As a result the view renders the state delivered by the ViewModel, and the ViewModel intercepts the user's actions automatically.

Parameters

view

An instance of MessageComposerView to bind to the ViewModel.

lifecycleOwner

LifecycleOwner of Activity or Fragment hosting the MessageComposerView

messageBuilder

A lambda function to build a new message.

sendMessageButtonClickListener

Click listener for the send message button.

textInputChangeListener

Text change listener invoked each time after text was changed.

attachmentSelectionListener

Selection listener invoked when attachments are selected.

attachmentRemovalListener

Click listener for the remove attachment button.

pollSubmissionListener

Selection listener invoked when a poll is submitted.

mentionSelectionListener

Selection listener invoked when a mention suggestion item is selected.

commandSelectionListener

Selection listener invoked when a command suggestion item is selected.

alsoSendToChannelSelectionListener

Selection listener for the "also send to channel" checkbox.

dismissActionClickListener

Click listener for the dismiss action button.

commandsButtonClickListener

Click listener for the pick commands button.

dismissSuggestionsListener

Click listener invoked when suggestion popup is dismissed.

audioRecordButtonHoldListener

Hold listener invoked when the microphone button gets pressed down.

audioRecordButtonLockListener

Lock listener invoked when the audio recording gets locked.

audioRecordButtonCancelListener

Cancel listener invoked when the audio recording gets cancelled.

audioRecordButtonReleaseListener

Release listener invoked when the microphone button gets released.

audioDeleteButtonClickListener

Click listener for the audio recording delete button.

audioStopButtonClickListener

Click listener for the audio recording stop button.

audioPlaybackButtonClickListener

Click listener for the audio recording playback button.

audioCompleteButtonClickListener

Click listener for the audio recording complete button.

audioSliderDragStartListener

Drag start listener invoked when the audio slider starts being dragged.

audioSliderDragStopListener

Drag stop listener invoked when the audio slider stops being dragged.


Binds MessageListHeaderView with MessageListHeaderViewModel, updating the view's state based on data provided by the ViewModel.

This function sets listeners on the view and ViewModel. Call this method before setting any additional listeners on these objects yourself.


@JvmName(name = "bind")
fun MessageListViewModel.bindView(view: MessageListView, lifecycleOwner: LifecycleOwner)

Binds MessageListView with MessageListViewModel, updating the view's state based on data provided by the ViewModel, and forwarding View events to the ViewModel.

This function sets listeners on the view and ViewModel. Call this method before setting any additional listeners on these objects yourself.

Parameters

view

The MessageListView to bind the ViewModel to.

lifecycleOwner

Current owner of the lifecycle in which the events are handled.