Gathering reason input is refactored.

This commit is contained in:
onurays 2020-02-11 00:10:24 +03:00
parent ba0133a047
commit ce028f8bd2
1 changed files with 3 additions and 1 deletions

View File

@ -805,7 +805,9 @@ class RoomDetailFragment @Inject constructor(
.setView(layout)
.setTitle(R.string.delete_event_dialog_title)
.setPositiveButton(R.string.remove) { _, _ ->
val reason = if (reasonCheckBox.isChecked) reasonInput.text.toString().takeIf { it.isNotBlank() } else null
val reason = reasonInput.text.toString()
.takeIf { reasonCheckBox.isChecked }
?.takeIf { it.isNotBlank() }
roomDetailViewModel.handle(RoomDetailAction.RedactAction(eventId, reason))
}
.setNegativeButton(R.string.cancel, null)