From 60ea5ba3a7fec595df8e62eaba859b071bf23b16 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 9 Aug 2023 20:02:51 +0930 Subject: [PATCH 1/2] Hide send button when message contains only whitespace --- .../securesms/conversation/v2/input_bar/InputBar.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt index 73e2d571c0..ffdc425c5b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt @@ -13,6 +13,7 @@ import android.view.MotionEvent import android.view.inputmethod.EditorInfo import android.widget.RelativeLayout import android.widget.TextView +import androidx.core.view.isGone import androidx.core.view.isVisible import network.loki.messenger.R import network.loki.messenger.databinding.ViewInputBarBinding @@ -118,8 +119,8 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li // region Updating override fun inputBarEditTextContentChanged(text: CharSequence) { - sendButton.isVisible = text.isNotEmpty() - microphoneButton.isVisible = text.isEmpty() + microphoneButton.isVisible = text.all { it.isWhitespace() } + sendButton.isVisible = microphoneButton.isGone delegate?.inputBarEditTextContentChanged(text) } From 031a18061dd273b988db15ab63deeecd6c6ce022 Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Mon, 24 Jun 2024 17:26:36 +1000 Subject: [PATCH 2/2] Using trim and empty to capture semantic concept of nothing being in there --- .../securesms/conversation/v2/input_bar/InputBar.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt index f183cff13f..c036ed38b4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt @@ -120,7 +120,7 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li // region Updating override fun inputBarEditTextContentChanged(text: CharSequence) { - microphoneButton.isVisible = text.all { it.isWhitespace() } + microphoneButton.isVisible = text.trim().isEmpty() sendButton.isVisible = microphoneButton.isGone delegate?.inputBarEditTextContentChanged(text) }