Hide send button when message contains only whitespace

This commit is contained in:
andrew 2023-08-09 20:02:51 +09:30
parent 9cf99480d6
commit 60ea5ba3a7

View File

@ -13,6 +13,7 @@ import android.view.MotionEvent
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.RelativeLayout import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import network.loki.messenger.R import network.loki.messenger.R
import network.loki.messenger.databinding.ViewInputBarBinding import network.loki.messenger.databinding.ViewInputBarBinding
@ -118,8 +119,8 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li
// region Updating // region Updating
override fun inputBarEditTextContentChanged(text: CharSequence) { override fun inputBarEditTextContentChanged(text: CharSequence) {
sendButton.isVisible = text.isNotEmpty() microphoneButton.isVisible = text.all { it.isWhitespace() }
microphoneButton.isVisible = text.isEmpty() sendButton.isVisible = microphoneButton.isGone
delegate?.inputBarEditTextContentChanged(text) delegate?.inputBarEditTextContentChanged(text)
} }