@@ -33,6 +33,7 @@ import android.os.Bundle
3333import android.os.Looper
3434import android.os.Parcel
3535import android.os.Parcelable
36+ import android.provider.Settings
3637import android.text.Editable
3738import android.text.InputFilter
3839import android.text.Spannable
@@ -659,15 +660,20 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
659660
660661 override fun onCreateInputConnection (outAttrs : EditorInfo ): InputConnection {
661662 val baseInputConnection = requireNotNull(super .onCreateInputConnection(outAttrs))
662- return if (Build .MANUFACTURER .lowercase(Locale .US ) == " samsung" && Build .VERSION .SDK_INT == 33
663- && overrideSamsungPredictiveBehavior) {
664- AppLog .d(AppLog .T .EDITOR , " Overriding predictive text behavior on Samsung device with API 33" )
663+ return if (shouldOverridePredictiveTextBehavior()) {
664+ AppLog .d(AppLog .T .EDITOR , " Overriding predictive text behavior on Samsung device with Samsung Keyboard with API 33" )
665665 SamsungInputConnection (this , baseInputConnection)
666666 } else {
667667 baseInputConnection
668668 }
669669 }
670670
671+ private fun shouldOverridePredictiveTextBehavior (): Boolean {
672+ val currentKeyboard = Settings .Secure .getString(context.contentResolver, Settings .Secure .DEFAULT_INPUT_METHOD )
673+ return Build .MANUFACTURER .lowercase(Locale .US ) == " samsung" && Build .VERSION .SDK_INT >= 33 &&
674+ (currentKeyboard != = null && currentKeyboard.startsWith(" com.samsung.android.honeyboard" )) && overrideSamsungPredictiveBehavior
675+ }
676+
671677 // Setup the keyListener(s) for Backspace and Enter key.
672678 // Backspace: If listener does return false we remove the style here
673679 // Enter: Ask the listener if we need to insert or not the char
0 commit comments