diff --git a/app/build.gradle b/app/build.gradle index ba4ece9..7f21554 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { compileSdk 35 minSdkVersion 15 targetSdkVersion 35 - versionCode 9 - versionName "0.9" + versionCode 10 + versionName "0.10" } buildTypes { release { diff --git a/app/src/main/java/rkr/tinykeyboard/inputmethod/SoftKeyboard.java b/app/src/main/java/rkr/tinykeyboard/inputmethod/SoftKeyboard.java index 047e7a5..ab079c3 100644 --- a/app/src/main/java/rkr/tinykeyboard/inputmethod/SoftKeyboard.java +++ b/app/src/main/java/rkr/tinykeyboard/inputmethod/SoftKeyboard.java @@ -37,8 +37,8 @@ public class SoftKeyboard extends InputMethodService implements KeyboardView.OnKeyboardActionListener { private InputMethodManager mInputMethodManager; - private KeyboardView mInputView; + private static android.graphics.Insets mInsets; private int mLastDisplayWidth; private boolean mCapsLock; @@ -91,13 +91,10 @@ Context getDisplayContext() { mInputView.setOnKeyboardActionListener(this); mInputView.setPreviewEnabled(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + setLayoutParams(mInputView); mInputView.setOnApplyWindowInsetsListener((view, windowInsets) -> { - android.graphics.Insets insets = windowInsets.getInsets(WindowInsets.Type.systemBars()); - ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); - mlp.leftMargin = insets.left; - mlp.bottomMargin = insets.bottom; - mlp.rightMargin = insets.right; - view.setLayoutParams(mlp); + mInsets = windowInsets.getInsets(WindowInsets.Type.systemBars()); + setLayoutParams(mInputView); return WindowInsets.CONSUMED; }); } @@ -105,6 +102,16 @@ Context getDisplayContext() { return mInputView; } + private void setLayoutParams(View view) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && mInsets != null) { + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); + mlp.leftMargin = mInsets.left; + mlp.bottomMargin = mInsets.bottom; + mlp.rightMargin = mInsets.right; + view.setLayoutParams(mlp); + } + } + private void setLatinKeyboard(LatinKeyboard nextKeyboard) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { final boolean shouldSupportLanguageSwitchKey = mInputMethodManager.shouldOfferSwitchingToNextInputMethod(getToken()); diff --git a/build.gradle b/build.gradle index 1a66737..8536dbd 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.6.0' + classpath 'com.android.tools.build:gradle:8.7.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aea17e5..001f7ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip