mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Use renderComposerMode (disable formattedContent which crashes)
This commit is contained in:
+4
@@ -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
|
||||||
|
|||||||
+4
-4
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user