Fixes #1683: Only show/hide keyboard in search fragment
parent
146492bd59
commit
28a852b17b
|
@ -124,6 +124,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSoftwareKeyboardIfNecessary() {
|
private fun showSoftwareKeyboardIfNecessary() {
|
||||||
|
if (navHost.navController.currentDestination?.id != R.id.searchFragment) { return }
|
||||||
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
|
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
|
||||||
currentFocus?.also {
|
currentFocus?.also {
|
||||||
this.showSoftInput(it, 0)
|
this.showSoftInput(it, 0)
|
||||||
|
@ -132,6 +133,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideSoftwareKeyboardIfNecessary() {
|
private fun hideSoftwareKeyboardIfNecessary() {
|
||||||
|
if (navHost.navController.currentDestination?.id != R.id.searchFragment) { return }
|
||||||
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
|
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
|
||||||
currentFocus?.also {
|
currentFocus?.also {
|
||||||
this.hideSoftInputFromWindow(it.windowToken, 0)
|
this.hideSoftInputFromWindow(it.windowToken, 0)
|
||||||
|
|
Loading…
Reference in New Issue