mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Restore Onuray's code: do not allow to send blank text
This commit is contained in:
parent
5097c45568
commit
e91b09ca44
3 changed files with 8 additions and 8 deletions
|
@ -1189,7 +1189,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
return sendUri(contentUri)
|
||||
}
|
||||
|
||||
override fun onTextEmptyStateChanged(isEmpty: Boolean) {
|
||||
override fun onTextBlankStateChanged(isBlank: Boolean) {
|
||||
// No op
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,11 @@ class ComposerEditText @JvmOverloads constructor(context: Context, attrs: Attrib
|
|||
|
||||
interface Callback {
|
||||
fun onRichContentSelected(contentUri: Uri): Boolean
|
||||
fun onTextEmptyStateChanged(isEmpty: Boolean)
|
||||
fun onTextBlankStateChanged(isBlank: Boolean)
|
||||
}
|
||||
|
||||
var callback: Callback? = null
|
||||
private var isEmptyText = true
|
||||
private var isBlankText = true
|
||||
|
||||
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection? {
|
||||
val ic = super.onCreateInputConnection(editorInfo) ?: return null
|
||||
|
@ -96,9 +96,9 @@ class ComposerEditText @JvmOverloads constructor(context: Context, attrs: Attrib
|
|||
spanToRemove = null
|
||||
}
|
||||
// Report blank status of EditText to be able to arrange other elements of the composer
|
||||
if (s.isEmpty() != isEmptyText) {
|
||||
isEmptyText = !isEmptyText
|
||||
callback?.onTextEmptyStateChanged(isEmptyText)
|
||||
if (s.isBlank() != isBlankText) {
|
||||
isBlankText = !isBlankText
|
||||
callback?.onTextBlankStateChanged(isBlankText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ class TextComposerView @JvmOverloads constructor(
|
|||
return callback?.onRichContentSelected(contentUri) ?: false
|
||||
}
|
||||
|
||||
override fun onTextEmptyStateChanged(isEmpty: Boolean) {
|
||||
views.sendButton.isVisible = currentConstraintSetId == R.layout.composer_layout_constraint_set_expanded || !isEmpty
|
||||
override fun onTextBlankStateChanged(isBlank: Boolean) {
|
||||
views.sendButton.isVisible = currentConstraintSetId == R.layout.composer_layout_constraint_set_expanded || !isBlank
|
||||
}
|
||||
}
|
||||
views.composerRelatedMessageCloseButton.setOnClickListener {
|
||||
|
|
Loading…
Reference in a new issue