adding missing IME handling for the register next focus and server selection submit

This commit is contained in:
Adam Brown 2022-04-04 17:00:38 +01:00
parent c022a38dd4
commit 89f182ac35
3 changed files with 18 additions and 4 deletions

View file

@ -20,7 +20,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isEmpty
import android.view.inputmethod.EditorInfo
import im.vector.app.core.extensions.content
import im.vector.app.core.extensions.editText
import im.vector.app.core.extensions.realignPercentagesToParent
@ -47,10 +47,23 @@ class FtueAuthCombinedServerSelectionFragment @Inject constructor() : AbstractFt
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnBack))
}
views.chooseServerSubmit.debouncedClicks {
viewModel.handle(OnboardingAction.EditHomeServer(views.chooseServerInput.content().ensureProtocol().ensureTrailingSlash()))
views.chooseServerInput.editText?.setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_DONE -> {
updateServerUrl()
}
}
false
}
views.chooseServerSubmit.debouncedClicks {
updateServerUrl()
}
}
private fun updateServerUrl() {
viewModel.handle(OnboardingAction.EditHomeServer(views.chooseServerInput.content().ensureProtocol().ensureTrailingSlash()))
}
override fun resetViewModel() {
// do nothing

View file

@ -105,7 +105,7 @@
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionNext"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1" />

View file

@ -173,6 +173,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionNext"
android:nextFocusForward="@id/createAccountPasswordInput"
android:inputType="text"
android:maxLines="1" />