Skip to content

Commit

Permalink
Remove unnecessary SDK check
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed May 3, 2024
1 parent c8cfad6 commit 6c2c9aa
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,13 @@ abstract class BaseKeyboardHandler(

override fun registerEditText(editText: EditText) {
// alternative to this is editText.setOnTouchListener(new OnTouchWrapper());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
editText.inputType = InputType.TYPE_NULL
} else {
try {
val setShowSoftInputOnFocus =
editText::class.java.getMethod("setShowSoftInputOnFocus", Boolean::class.java)
setShowSoftInputOnFocus(editText, false)
} catch (@Suppress("TooGenericExceptionCaught") ex: Exception) {
// It's a hack, anything can go wrong.
Log.w("HACK", "Could not turn off input focus for EditText: $editText", ex)
}
try {
val setShowSoftInputOnFocus =
editText::class.java.getMethod("setShowSoftInputOnFocus", Boolean::class.java)
setShowSoftInputOnFocus(editText, false)
} catch (@Suppress("TooGenericExceptionCaught") ex: Exception) {
// It's a hack, anything can go wrong.
Log.w("HACK", "Could not turn off input focus for EditText: $editText", ex)
}
editText.isFocusable = true
editText.isFocusableInTouchMode = true
Expand Down

0 comments on commit 6c2c9aa

Please sign in to comment.