1
0
Fork 0

Fixes #1683: Only show/hide keyboard in search fragment

master
Sawyer Blatz 2019-04-19 13:29:53 -07:00 committed by Colin Lee
parent 146492bd59
commit 28a852b17b
1 changed files with 2 additions and 0 deletions

View File

@ -124,6 +124,7 @@ open class HomeActivity : AppCompatActivity() {
}
private fun showSoftwareKeyboardIfNecessary() {
if (navHost.navController.currentDestination?.id != R.id.searchFragment) { return }
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
currentFocus?.also {
this.showSoftInput(it, 0)
@ -132,6 +133,7 @@ open class HomeActivity : AppCompatActivity() {
}
private fun hideSoftwareKeyboardIfNecessary() {
if (navHost.navController.currentDestination?.id != R.id.searchFragment) { return }
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
currentFocus?.also {
this.hideSoftInputFromWindow(it.windowToken, 0)