From c2267c839ab832359241b494da731f4ea0fe71ba Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Wed, 17 Jul 2024 19:08:58 +0530 Subject: [PATCH] Reload keyboard only when necessary --- .../fossify/keyboard/services/SimpleKeyboardIME.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt b/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt index 2e420b9e..d90f1938 100644 --- a/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt +++ b/app/src/main/kotlin/org/fossify/keyboard/services/SimpleKeyboardIME.kt @@ -34,8 +34,7 @@ import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.updatePadding import org.fossify.commons.extensions.* -import org.fossify.commons.helpers.isNougatPlus -import org.fossify.commons.helpers.isPiePlus +import org.fossify.commons.helpers.* import org.fossify.keyboard.R import org.fossify.keyboard.databinding.KeyboardViewKeyboardBinding import org.fossify.keyboard.extensions.config @@ -519,8 +518,15 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared } override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { - keyboardView?.setupKeyboard() - updateBackgroundColors() + if (key != null && key in arrayOf( + SHOW_KEY_BORDERS, KEYBOARD_LANGUAGE, HEIGHT_PERCENTAGE, SHOW_NUMBERS_ROW, VOICE_INPUT_METHOD, + TEXT_COLOR, BACKGROUND_COLOR, PRIMARY_COLOR, ACCENT_COLOR, CUSTOM_TEXT_COLOR, CUSTOM_BACKGROUND_COLOR, + CUSTOM_PRIMARY_COLOR, CUSTOM_ACCENT_COLOR, IS_USING_SHARED_THEME, IS_USING_SYSTEM_THEME + ) + ) { + keyboardView?.setupKeyboard() + updateBackgroundColors() + } } private fun setupNavigationBarPadding() {