From 311e45168ebc2509c21bf60197e5964e211664e0 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Sun, 14 Jul 2024 22:59:26 +0200 Subject: [PATCH] fix: Ensure initial status length calculation includes the content warning (#821) Previous code set `doOnTextChanged` listener for the content warning *after* the initial value had been set. This meant the initial content warning text was not included when calculating the status' initial length. Fix that by setting the listener before the text is set. Fixes #815 --- .../java/app/pachli/components/compose/ComposeActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/pachli/components/compose/ComposeActivity.kt b/app/src/main/java/app/pachli/components/compose/ComposeActivity.kt index 8ceec49ce..c34eaab63 100644 --- a/app/src/main/java/app/pachli/components/compose/ComposeActivity.kt +++ b/app/src/main/java/app/pachli/components/compose/ComposeActivity.kt @@ -396,12 +396,12 @@ class ComposeActivity : } private fun setupContentWarningField(startingContentWarning: String?) { - if (startingContentWarning != null) { - binding.composeContentWarningField.setText(startingContentWarning) - } binding.composeContentWarningField.doOnTextChanged { newContentWarning, _, _, _ -> viewModel.onContentWarningChanged(newContentWarning?.toString() ?: "") } + if (startingContentWarning != null) { + binding.composeContentWarningField.setText(startingContentWarning) + } } private fun setupComposeField(