mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Hide keyboard when pressing search key
This commit is contained in:
parent
054a6cf566
commit
f4189e4124
2 changed files with 10 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import android.content.pm.PackageManager
|
|||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
|
|
@ -279,6 +280,14 @@ class MasterContactsFragment : MasterFragment<ContactMasterFragmentBinding, Cont
|
|||
listViewModel.updateContactsList(false)
|
||||
}
|
||||
|
||||
binding.searchBar.setOnEditorActionListener({ view, id, event ->
|
||||
if (id == EditorInfo.IME_ACTION_SEARCH) {
|
||||
(requireActivity() as MainActivity).hideKeyboard()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
})
|
||||
|
||||
binding.setNewContactClickListener {
|
||||
// Remove any previously selected contact
|
||||
sharedViewModel.selectedContact.value = null
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@
|
|||
android:inputType="textPersonName|textNoSuggestions"
|
||||
android:drawableLeft="@drawable/search"
|
||||
android:drawablePadding="10dp"
|
||||
android:imeOptions="actionSearch"
|
||||
android:background="@color/transparent_color"
|
||||
android:backgroundTint="@color/transparent_color"
|
||||
android:hint="@string/contact_filter_hint"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue