mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +03:00
Use AppCompatEditText instead of EditText
This commit is contained in:
parent
6d55c15761
commit
dbc17ae515
2 changed files with 7 additions and 7 deletions
|
@ -421,7 +421,7 @@ class RoomDetailFragment :
|
|||
if (text != composerLayout.composerEditText.text.toString()) {
|
||||
// Ignore update to avoid saving a draft
|
||||
composerLayout.composerEditText.setText(text)
|
||||
composerLayout.composerEditText.setSelection(composerLayout.composerEditText.text.length)
|
||||
composerLayout.composerEditText.setSelection(composerLayout.composerEditText.text?.length ?: 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1135,21 +1135,21 @@ class RoomDetailFragment :
|
|||
val myDisplayName = session.getUser(session.myUserId)?.displayName
|
||||
if (myDisplayName == text) {
|
||||
// current user
|
||||
if (composerLayout.composerEditText.text.isBlank()) {
|
||||
if (composerLayout.composerEditText.text.isNullOrBlank()) {
|
||||
composerLayout.composerEditText.append(Command.EMOTE.command + " ")
|
||||
composerLayout.composerEditText.setSelection(composerLayout.composerEditText.text.length)
|
||||
composerLayout.composerEditText.setSelection(composerLayout.composerEditText.text?.length ?: 0)
|
||||
// vibrate = true
|
||||
}
|
||||
} else {
|
||||
// another user
|
||||
if (composerLayout.composerEditText.text.isBlank()) {
|
||||
if (composerLayout.composerEditText.text.isNullOrBlank()) {
|
||||
// Ensure displayName will not be interpreted as a Slash command
|
||||
if (text.startsWith("/")) {
|
||||
composerLayout.composerEditText.append("\\")
|
||||
}
|
||||
composerLayout.composerEditText.append(sanitizeDisplayName(text) + ": ")
|
||||
} else {
|
||||
composerLayout.composerEditText.text.insert(composerLayout.composerEditText.selectionStart, sanitizeDisplayName(text) + " ")
|
||||
composerLayout.composerEditText.text?.insert(composerLayout.composerEditText.selectionStart, sanitizeDisplayName(text) + " ")
|
||||
}
|
||||
|
||||
// vibrate = true
|
||||
|
|
|
@ -23,12 +23,12 @@ import android.os.Build
|
|||
import android.util.AttributeSet
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputConnection
|
||||
import android.widget.EditText
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat
|
||||
|
||||
class ComposerEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = android.R.attr.editTextStyle)
|
||||
: EditText(context, attrs, defStyleAttr) {
|
||||
: AppCompatEditText(context, attrs, defStyleAttr) {
|
||||
|
||||
interface Callback {
|
||||
fun onRichContentSelected(contentUri: Uri): Boolean
|
||||
|
|
Loading…
Reference in a new issue