Refactored hideSoftKeyboard