Fixes #430 - Hides software keyboard when you background the app
parent
5addcca524
commit
f37250127a
|
@ -4,10 +4,12 @@
|
|||
|
||||
package org.mozilla.fenix
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
|
@ -67,6 +69,19 @@ open class HomeActivity : AppCompatActivity() {
|
|||
super.onBackPressed()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
hideSoftwareKeyboard()
|
||||
}
|
||||
|
||||
private fun hideSoftwareKeyboard() {
|
||||
(getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
|
||||
currentFocus?.also {
|
||||
this.hideSoftInputFromWindow(it.windowToken, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openToBrowser() {
|
||||
val sessionId = SafeIntent(intent).getStringExtra(IntentProcessor.ACTIVE_SESSION_ID)
|
||||
val host = supportFragmentManager.findFragmentById(R.id.container) as NavHostFragment
|
||||
|
|
Loading…
Reference in New Issue