diff --git a/java/src/org/futo/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/org/futo/inputmethod/keyboard/internal/KeyboardBuilder.java index 60d57a77d..0b28d7c17 100644 --- a/java/src/org/futo/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/org/futo/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -256,8 +256,7 @@ public class KeyboardBuilder { try { final KeyboardParams params = mParams; - final int offset = (int)mProvider.getKeyboardBottomOffset(); - final int height = (int) (params.mId.mHeight * mProvider.getKeyboardHeightMultiplier() + offset); + final int height = (int) (params.mId.mHeight * mProvider.getKeyboardHeightMultiplier()); final int width = params.mId.mWidth; params.mOccupiedHeight = height; params.mOccupiedWidth = width; @@ -265,7 +264,6 @@ public class KeyboardBuilder { R.styleable.Keyboard_keyboardTopPadding, height, height, 0); params.mBottomPadding = (int)(keyboardAttr.getFraction( R.styleable.Keyboard_keyboardBottomPadding, height, height, 0) - + mProvider.getKeyboardBottomOffset() ); params.mLeftPadding = (int)keyboardAttr.getFraction( R.styleable.Keyboard_keyboardLeftPadding, width, width, 0); @@ -283,7 +281,7 @@ public class KeyboardBuilder { // rows are determined based on the entire keyboard height including top and bottom // paddings. params.mVerticalGap = (int)keyboardAttr.getFraction( - R.styleable.Keyboard_verticalGap, height - offset, height - offset, 0); + R.styleable.Keyboard_verticalGap, height, height, 0); final int baseHeight = params.mOccupiedHeight - params.mTopPadding - params.mBottomPadding + params.mVerticalGap; params.mBaseHeight = baseHeight; diff --git a/java/src/org/futo/inputmethod/latin/LatinIME.kt b/java/src/org/futo/inputmethod/latin/LatinIME.kt index 90f6877f3..b4feefc43 100644 --- a/java/src/org/futo/inputmethod/latin/LatinIME.kt +++ b/java/src/org/futo/inputmethod/latin/LatinIME.kt @@ -14,10 +14,12 @@ import android.view.inputmethod.InlineSuggestionsRequest import android.view.inputmethod.InlineSuggestionsResponse import android.view.inputmethod.InputMethodSubtype import androidx.annotation.RequiresApi +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.ColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.key import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clipToBounds @@ -54,6 +56,7 @@ import org.futo.inputmethod.latin.uix.EmojiTracker.useEmoji import org.futo.inputmethod.latin.uix.HiddenKeysSetting import org.futo.inputmethod.latin.uix.KeyBordersSetting import org.futo.inputmethod.latin.uix.KeyHintsSetting +import org.futo.inputmethod.latin.uix.KeyboardBottomOffsetSetting import org.futo.inputmethod.latin.uix.SUGGESTION_BLACKLIST import org.futo.inputmethod.latin.uix.THEME_KEY import org.futo.inputmethod.latin.uix.UixManager @@ -63,6 +66,7 @@ import org.futo.inputmethod.latin.uix.deferGetSetting import org.futo.inputmethod.latin.uix.deferSetSetting import org.futo.inputmethod.latin.uix.differsFrom import org.futo.inputmethod.latin.uix.getSetting +import org.futo.inputmethod.latin.uix.getSettingFlow import org.futo.inputmethod.latin.uix.setSetting import org.futo.inputmethod.latin.uix.theme.DarkColorScheme import org.futo.inputmethod.latin.uix.theme.ThemeOption @@ -336,10 +340,13 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save inputViewHeight = it.height } } + + val padding = getSettingFlow(KeyboardBottomOffsetSetting).collectAsState(initial = 0.0f) + key(legacyInputView) { AndroidView(factory = { legacyInputView!! - }, modifier = modifier, onRelease = { + }, modifier = modifier.padding(0.dp, 0.dp, 0.dp, padding.value.dp), onRelease = { val view = it as InputView view.deallocateMemory() view.removeAllViews() diff --git a/java/src/org/futo/inputmethod/latin/uix/BasicThemeProvider.kt b/java/src/org/futo/inputmethod/latin/uix/BasicThemeProvider.kt index 1e97026e1..680e3f378 100644 --- a/java/src/org/futo/inputmethod/latin/uix/BasicThemeProvider.kt +++ b/java/src/org/futo/inputmethod/latin/uix/BasicThemeProvider.kt @@ -85,10 +85,6 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch return keyboardHeight } - override fun getKeyboardBottomOffset(): Float { - return dp(keyboardBottomOffsetValue.dp) - } - private fun dp(dp: Dp): Float { return TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, @@ -136,7 +132,6 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch val showKeyHints: Boolean val keyboardHeight: Float - val keyboardBottomOffsetValue: Float fun hasUpdated(newPreferences: Preferences): Boolean { return when { @@ -145,7 +140,6 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch newPreferences[KeyHintsSetting.key] != showKeyHints -> true newPreferences[KeyboardHeightMultiplierSetting.key] != keyboardHeight -> true - newPreferences[KeyboardBottomOffsetSetting.key] != keyboardBottomOffsetValue -> true else -> false } @@ -167,7 +161,6 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch showKeyHints = context.getSettingBlocking(KeyHintsSetting) keyboardHeight = context.getSettingBlocking(KeyboardHeightMultiplierSetting.key, KeyboardHeightMultiplierSetting.default) - keyboardBottomOffsetValue = context.getSettingBlocking(KeyboardBottomOffsetSetting.key, KeyboardBottomOffsetSetting.default) val primary = colorScheme.primary.toArgb() val secondary = colorScheme.secondary.toArgb() diff --git a/java/src/org/futo/inputmethod/latin/uix/DynamicThemeProvider.kt b/java/src/org/futo/inputmethod/latin/uix/DynamicThemeProvider.kt index e683f006a..f63123768 100644 --- a/java/src/org/futo/inputmethod/latin/uix/DynamicThemeProvider.kt +++ b/java/src/org/futo/inputmethod/latin/uix/DynamicThemeProvider.kt @@ -23,7 +23,6 @@ interface DynamicThemeProvider { fun getDrawable(i: Int): Drawable? fun getKeyboardHeightMultiplier(): Float - fun getKeyboardBottomOffset(): Float companion object { @ColorInt