bindViewDefaults

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

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. The main difference with bindView is that listeners in this function do not override the default behaviour.

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.