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