override fun onTouchEvent(event: MotionEvent?): Boolean {
val manager =
this.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
if (event?.getAction() === MotionEvent.ACTION_DOWN) {
if (this.getCurrentFocus() != null && this.getCurrentFocus().getWindowToken() != null) {
manager.hideSoftInputFromWindow(
this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS
)
}
}
return super.onTouchEvent(event)
}