mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-02-07 14:58:24 +00:00
Added IME action for main fragments search bar to close keyboard
This commit is contained in:
parent
b55d7070b0
commit
59ebff6d15
2 changed files with 10 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ import android.content.res.Configuration
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.view.doOnPreDraw
|
||||
|
|
@ -197,6 +198,14 @@ abstract class AbstractMainFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
private fun initSearchBar(searchBar: TextInputLayout) {
|
||||
searchBar.editText?.setOnEditorActionListener { view, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
view.hideKeyboard()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
viewModel.focusSearchBarEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { show ->
|
||||
if (show) {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@
|
|||
android:textSize="16sp"
|
||||
android:inputType="text"
|
||||
android:paddingVertical="1dp"
|
||||
android:imeOptions="actionSearch"
|
||||
android:text="@={viewModel.searchFilter}"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue