Skip to content

Commit

Permalink
Twelve: Show and hide keyboard in search fragment automatically
Browse files Browse the repository at this point in the history
* After switching to search fragment, show keyboard if input text is
  empty.
* After switching from search fragment, hide keyboard unconditionally.

Change-Id: I7178c08bd79250b42d682a5246f5d645bf327597
  • Loading branch information
luk1337 authored and SebaUbuntu committed Nov 22, 2024
1 parent 9651832 commit 34d4c3e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/main/java/org/lineageos/twelve/fragments/SearchFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,21 @@ class SearchFragment : Fragment(R.layout.fragment_search) {
}
}

override fun onResume() {
super.onResume()

if (searchView.editText.text.isEmpty()) {
searchView.show()
searchView.requestFocusAndShowKeyboard()
}
}

override fun onPause() {
searchView.clearFocusAndHideKeyboard()

super.onPause()
}

override fun onDestroyView() {
recyclerView.adapter = null

Expand Down

0 comments on commit 34d4c3e

Please sign in to comment.