Code review fixes.

This commit is contained in:
Onuray Sahin 2021-11-11 13:38:39 +03:00
parent 89db5a6ecd
commit b6717f4e46
2 changed files with 11 additions and 7 deletions

View file

@ -17,6 +17,7 @@
package im.vector.app.features.form
import android.text.Editable
import android.view.inputmethod.EditorInfo
import android.widget.ImageButton
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
@ -70,12 +71,13 @@ abstract class FormEditTextWithDeleteItem : VectorEpoxyModel<FormEditTextWithDel
holder.textInputEditText.setTextIfDifferent(value)
holder.textInputEditText.isEnabled = enabled
if (singleLine) {
holder.textInputEditText.setSingleLine()
}
imeOptions?.let {
holder.textInputEditText.imeOptions = it
}
holder.textInputEditText.isSingleLine = singleLine
holder.textInputEditText.imeOptions =
imeOptions ?: when (singleLine) {
true -> EditorInfo.IME_ACTION_NEXT
false -> EditorInfo.IME_ACTION_NONE
}
holder.textInputEditText.addTextChangedListenerOnce(onTextChangeListener)

View file

@ -52,12 +52,14 @@ class CreatePollController @Inject constructor(
title(host.stringProvider.getString(R.string.create_poll_question_title))
}
val questionImeAction = if (currentState.options.isEmpty()) EditorInfo.IME_ACTION_DONE else EditorInfo.IME_ACTION_NEXT
formEditTextItem {
id("question")
value(currentState.question)
hint(host.stringProvider.getString(R.string.create_poll_question_hint))
singleLine(true)
imeOptions(EditorInfo.IME_ACTION_NEXT)
imeOptions(questionImeAction)
maxLength(500)
onTextChange {
host.callback?.onQuestionChanged(it)