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

View file

@ -52,12 +52,14 @@ class CreatePollController @Inject constructor(
title(host.stringProvider.getString(R.string.create_poll_question_title)) 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 { formEditTextItem {
id("question") id("question")
value(currentState.question) value(currentState.question)
hint(host.stringProvider.getString(R.string.create_poll_question_hint)) hint(host.stringProvider.getString(R.string.create_poll_question_hint))
singleLine(true) singleLine(true)
imeOptions(EditorInfo.IME_ACTION_NEXT) imeOptions(questionImeAction)
maxLength(500) maxLength(500)
onTextChange { onTextChange {
host.callback?.onQuestionChanged(it) host.callback?.onQuestionChanged(it)