diff --git a/app/src/main/java/com/ftw/hometerview/extension/FragmentExtension.kt b/app/src/main/java/com/ftw/hometerview/extension/FragmentExtension.kt new file mode 100644 index 0000000..ad12fd4 --- /dev/null +++ b/app/src/main/java/com/ftw/hometerview/extension/FragmentExtension.kt @@ -0,0 +1,10 @@ +package com.ftw.hometerview.extension + +import android.content.Context +import android.view.inputmethod.InputMethodManager +import androidx.fragment.app.Fragment + +fun Fragment.hideKeyboard() { + (context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager) + ?.hideSoftInputFromWindow(view?.windowToken, 0) +}