Fix edit being stuck

This commit is contained in:
ganfra 2020-07-07 22:14:11 +02:00
parent a2c75e7c71
commit 0855806ae2
3 changed files with 10 additions and 12 deletions

View file

@ -289,7 +289,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.fragment:fragment:$fragment_version"
implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
// Keep at 2.0.0-beta4 at the moment, as updating is breaking some UI
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'androidx.core:core-ktx:1.3.0'
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"

View file

@ -636,7 +636,7 @@ class RoomDetailFragment @Inject constructor(
val document = parser.parse(messageContent.formattedBody ?: messageContent.body)
formattedBody = eventHtmlRenderer.render(document)
}
composerLayout.composerRelatedMessageContent.text = formattedBody ?: nonFormattedBody
composerLayout.composerRelatedMessageContent.text = (formattedBody ?: nonFormattedBody)
updateComposerText(defaultContent)

View file

@ -846,17 +846,14 @@ class RoomDetailViewModel @AssistedInject constructor(
}
}
private fun handleExitSpecialMode(action: RoomDetailAction.ExitSpecialMode) {
setState { copy(sendMode = SendMode.REGULAR(action.text)) }
withState { state ->
// For edit, just delete the current draft
if (state.sendMode is SendMode.EDIT) {
room.deleteDraft(NoOpMatrixCallback())
} else {
// Save a new draft and keep the previously entered text
room.saveDraft(UserDraft.REGULAR(action.text), NoOpMatrixCallback())
}
private fun handleExitSpecialMode(action: RoomDetailAction.ExitSpecialMode) = withState {
if (it.sendMode is SendMode.EDIT) {
room.deleteDraft(NoOpMatrixCallback())
} else {
// Save a new draft and keep the previously entered text
room.saveDraft(UserDraft.REGULAR(action.text), NoOpMatrixCallback())
}
setState { copy(sendMode = SendMode.REGULAR(action.text)) }
}
private fun handleOpenOrDownloadFile(action: RoomDetailAction.DownloadOrOpen) {