Fix a bug empty != blank
This commit is contained in:
parent
2f4aecd590
commit
b3921e3811
@ -1189,7 +1189,7 @@ class RoomDetailFragment @Inject constructor(
|
|||||||
return sendUri(contentUri)
|
return sendUri(contentUri)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextBlankStateChanged(isBlank: Boolean) {
|
override fun onTextEmptyStateChanged(isEmpty: 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 onTextBlankStateChanged(isBlank: Boolean)
|
fun onTextEmptyStateChanged(isEmpty: Boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
var isBlankText = true
|
private var isEmptyText = 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.isBlank() != isBlankText) {
|
if (s.isEmpty() != isEmptyText) {
|
||||||
isBlankText = !isBlankText
|
isEmptyText = !isEmptyText
|
||||||
callback?.onTextBlankStateChanged(isBlankText)
|
callback?.onTextEmptyStateChanged(isEmptyText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ import androidx.transition.TransitionSet
|
|||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.ComposerLayoutBinding
|
import im.vector.app.databinding.ComposerLayoutBinding
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulate the timeline composer UX.
|
* Encapsulate the timeline composer UX.
|
||||||
*
|
*
|
||||||
@ -72,8 +70,8 @@ class TextComposerView @JvmOverloads constructor(
|
|||||||
return callback?.onRichContentSelected(contentUri) ?: false
|
return callback?.onRichContentSelected(contentUri) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextBlankStateChanged(isBlank: Boolean) {
|
override fun onTextEmptyStateChanged(isEmpty: Boolean) {
|
||||||
views.sendButton.isVisible = currentConstraintSetId == R.layout.composer_layout_constraint_set_expanded || !isBlank
|
views.sendButton.isVisible = currentConstraintSetId == R.layout.composer_layout_constraint_set_expanded || !isEmpty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
views.composerRelatedMessageCloseButton.setOnClickListener {
|
views.composerRelatedMessageCloseButton.setOnClickListener {
|
||||||
@ -98,7 +96,7 @@ class TextComposerView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
currentConstraintSetId = R.layout.composer_layout_constraint_set_compact
|
currentConstraintSetId = R.layout.composer_layout_constraint_set_compact
|
||||||
applyNewConstraintSet(animate, transitionComplete)
|
applyNewConstraintSet(animate, transitionComplete)
|
||||||
views.sendButton.isVisible = !views.composerEditText.text.isNullOrBlank()
|
views.sendButton.isVisible = !views.composerEditText.text.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expand(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) {
|
fun expand(animate: Boolean = true, transitionComplete: (() -> Unit)? = null) {
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
<vector android:height="24dp" android:viewportHeight="24"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp"
|
||||||
<path android:fillColor="#C1C6CD" android:pathData="M20,5L4,5c-1.1,0 -1.99,0.9 -1.99,2L2,17c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,7c0,-1.1 -0.9,-2 -2,-2zM11,8h2v2h-2L11,8zM11,11h2v2h-2v-2zM8,8h2v2L8,10L8,8zM8,11h2v2L8,13v-2zM7,13L5,13v-2h2v2zM7,10L5,10L5,8h2v2zM16,17L8,17v-2h8v2zM16,13h-2v-2h2v2zM16,10h-2L14,8h2v2zM19,13h-2v-2h2v2zM19,10h-2L17,8h2v2z"/>
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#F00"
|
||||||
|
android:pathData="M20,5L4,5c-1.1,0 -1.99,0.9 -1.99,2L2,17c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,7c0,-1.1 -0.9,-2 -2,-2zM11,8h2v2h-2L11,8zM11,11h2v2h-2v-2zM8,8h2v2L8,10L8,8zM8,11h2v2L8,13v-2zM7,13L5,13v-2h2v2zM7,10L5,10L5,8h2v2zM16,17L8,17v-2h8v2zM16,13h-2v-2h2v2zM16,10h-2L14,8h2v2zM19,13h-2v-2h2v2zM19,10h-2L17,8h2v2z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
Loading…
Reference in New Issue
Block a user