Use renderComposerMode (disable formattedContent which crashes)
This commit is contained in:
parent
06bd7fa0c6
commit
e10c94b654
2 changed files with 8 additions and 4 deletions
|
|
@ -485,11 +485,15 @@ class RichTextComposerLayout @JvmOverloads constructor(
|
||||||
} else {
|
} else {
|
||||||
views.composerModeGroup.isGone = true
|
views.composerModeGroup.isGone = true
|
||||||
(mode as? MessageComposerMode.Normal)?.content?.let { text ->
|
(mode as? MessageComposerMode.Normal)?.content?.let { text ->
|
||||||
|
// TODO: un-comment once we update to a version of the lib > 0.8.0
|
||||||
|
/*
|
||||||
if (isTextFormattingEnabled) {
|
if (isTextFormattingEnabled) {
|
||||||
replaceFormattedContent(text)
|
replaceFormattedContent(text)
|
||||||
} else {
|
} else {
|
||||||
views.plainTextComposerEditText.setText(text)
|
views.plainTextComposerEditText.setText(text)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
views.plainTextComposerEditText.setText(text)
|
||||||
}
|
}
|
||||||
views.sendButton.contentDescription = resources.getString(ElementR.string.action_send)
|
views.sendButton.contentDescription = resources.getString(ElementR.string.action_send)
|
||||||
hasRelatedMessage = false
|
hasRelatedMessage = false
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ fun TextComposer(
|
||||||
FakeComposer(modifier)
|
FakeComposer(modifier)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val isInDarkMode = isSystemInDarkTheme()
|
val isInDarkMode = isSystemInDarkTheme()
|
||||||
AndroidView(
|
AndroidView(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
|
|
@ -86,10 +87,10 @@ fun TextComposer(
|
||||||
// Example of Compose -> View communication
|
// Example of Compose -> View communication
|
||||||
val messageComposerView = (view as MessageComposerView)
|
val messageComposerView = (view as MessageComposerView)
|
||||||
view.setFullScreen(fullscreen, animated = false, manageKeyboard = false)
|
view.setFullScreen(fullscreen, animated = false, manageKeyboard = false)
|
||||||
// TODO: un-comment once we update to a version of the lib > 0.8.0
|
messageComposerView.renderComposerMode(composerMode)
|
||||||
// messageComposerView.renderComposerMode(composerMode)
|
|
||||||
messageComposerView.sendButton.isInvisible = !composerCanSendMessage
|
messageComposerView.sendButton.isInvisible = !composerCanSendMessage
|
||||||
messageComposerView.setTextIfDifferent(composerText ?: "")
|
messageComposerView.setTextIfDifferent(composerText ?: "")
|
||||||
|
messageComposerView.editText.requestFocus()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -124,8 +125,7 @@ private fun MessageComposerView.setup(isDarkMode: Boolean, composerMode: Message
|
||||||
emojiButton?.isVisible = true
|
emojiButton?.isVisible = true
|
||||||
sendButton.isVisible = true
|
sendButton.isVisible = true
|
||||||
editText.maxLines = MessageComposerView.MAX_LINES_WHEN_COLLAPSED
|
editText.maxLines = MessageComposerView.MAX_LINES_WHEN_COLLAPSED
|
||||||
// TODO: un-comment once we update to a version of the lib > 0.8.0
|
renderComposerMode(composerMode)
|
||||||
// renderComposerMode(composerMode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue