Prevent hiding the keyboard from crashing on <API 32
Fixes
@@ -6,7 +6,6 @@ import android.view.KeyEvent
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.FrameLayout
-import androidx.content.systemService
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.airbnb.lottie.samples.R
@@ -37,7 +36,8 @@ class SearchInputItemView @JvmOverloads constructor(
@ModelProp(options = [ModelProp.Option.DoNotHash])
fun setSearchClickListener(listener: (String) -> Unit) {
searchButton.setOnClickListener({
- context.systemService<InputMethodManager>().hideSoftInputFromWindow(windowToken, 0)
+ val inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
+ inputMethodManager.hideSoftInputFromInputMethod(windowToken, 0)
listener(searchEditText.text.toString())
})
}
