diff --git a/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java b/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java
index bb33e2c0..cbf40056 100644
--- a/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java
+++ b/app/src/main/java/io/github/sspanak/tt9/hacks/DeviceInfo.java
@@ -5,7 +5,10 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
+import androidx.annotation.NonNull;
+
import io.github.sspanak.tt9.R;
+import io.github.sspanak.tt9.preferences.settings.SettingsStore;
public class DeviceInfo extends HardwareInfo {
public static final boolean AT_LEAST_ANDROID_6 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
@@ -26,7 +29,11 @@ public class DeviceInfo extends HardwareInfo {
}
- public static int getNavigationBarHeight(Context context, boolean isLandscape) {
+ public static int getNavigationBarHeight(@NonNull Context context, @NonNull SettingsStore settings, boolean isLandscape) {
+ if (!settings.getPrecalculateNavbarHeight()) {
+ return 0;
+ }
+
Resources resources = getResources(context);
// navBarMode = 0: 3-button, 1 = 2-button, 2 = gesture
diff --git a/app/src/main/java/io/github/sspanak/tt9/hacks/HardwareInfo.java b/app/src/main/java/io/github/sspanak/tt9/hacks/HardwareInfo.java
index 8b826111..245e98c3 100644
--- a/app/src/main/java/io/github/sspanak/tt9/hacks/HardwareInfo.java
+++ b/app/src/main/java/io/github/sspanak/tt9/hacks/HardwareInfo.java
@@ -11,6 +11,9 @@ import android.view.KeyEvent;
import androidx.annotation.NonNull;
public class HardwareInfo {
+ public static final boolean IS_SAMSUNG = Build.MANUFACTURER.equals("samsung") || Build.MANUFACTURER.equals("Samsung") || Build.MANUFACTURER.equals("SAMSUNG");
+
+
private static Resources resources;
diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/DebugScreen.java b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/DebugScreen.java
index 2cbb9958..243d68e7 100644
--- a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/DebugScreen.java
+++ b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/DebugScreen.java
@@ -25,6 +25,7 @@ public class DebugScreen extends BaseScreenFragment {
(new ItemText(activity, findPreference(DEVICE_INFO_CONTAINER))).populate(new DeviceInfo().toString()).enableClickHandler();
(new ItemExportLogcat(findPreference(ItemExportLogcat.NAME), activity)).enableClickHandler();
(new ItemDemoMode(findPreference(ItemDemoMode.NAME), activity)).populate().enableClickHandler();
+ (new ItemPrecalculateNavbarHeight(activity.getSettings(), findPreference(ItemPrecalculateNavbarHeight.NAME))).populate();
resetFontSize(false);
}
diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/ItemPrecalculateNavbarHeight.java b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/ItemPrecalculateNavbarHeight.java
new file mode 100644
index 00000000..65e8c0e8
--- /dev/null
+++ b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/debug/ItemPrecalculateNavbarHeight.java
@@ -0,0 +1,32 @@
+package io.github.sspanak.tt9.preferences.screens.debug;
+
+import androidx.annotation.NonNull;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreferenceCompat;
+
+import io.github.sspanak.tt9.hacks.DeviceInfo;
+import io.github.sspanak.tt9.preferences.items.ItemClickable;
+import io.github.sspanak.tt9.preferences.settings.SettingsStore;
+
+public class ItemPrecalculateNavbarHeight extends ItemClickable {
+ public static final String NAME = "hack_precalculate_navbar_height_v3";
+
+ private final SettingsStore settings;
+
+ public ItemPrecalculateNavbarHeight(@NonNull SettingsStore settings, Preference item) {
+ super(item);
+ this.settings = settings;
+ }
+
+ @Override
+ protected boolean onClick(Preference p) {
+ return true;
+ }
+
+ void populate() {
+ if (item != null) {
+ ((SwitchPreferenceCompat) item).setChecked(settings.getPrecalculateNavbarHeight());
+ item.setVisible(DeviceInfo.AT_LEAST_ANDROID_15);
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsHacks.java b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsHacks.java
index 3295ca97..08584099 100644
--- a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsHacks.java
+++ b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsHacks.java
@@ -51,7 +51,6 @@ class SettingsHacks extends BaseSettings {
* There were reports about this on Kyocera KYF31
* and on CAT S22.
*/
-
public int getKeyPadDebounceTime() {
int defaultTime = DeviceInfo.isCatS22Flip() ? 50 : 0;
defaultTime = DeviceInfo.isQinF21() ? 20 : defaultTime;
@@ -73,4 +72,14 @@ class SettingsHacks extends BaseSettings {
public boolean getAllowComposingText() {
return prefs.getBoolean("pref_allow_composing_text", true);
}
+
+ /**
+ * On Samsung S25 (SM-S931B), edge-to-edge does not work like on Pixel/Xiaomi/etc. Like on Android 14,
+ * the navigation bar is subtracted from the initial available screen size, so we must not add padding
+ * to compensate.
+ * @see extra space at the bottom of the layout
+ */
+ public boolean getPrecalculateNavbarHeight() {
+ return prefs.getBoolean("hack_precalculate_navbar_height_v3", !DeviceInfo.IS_SAMSUNG);
+ }
}
diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/BaseMainLayout.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/BaseMainLayout.java
index cf963ac8..99281744 100644
--- a/app/src/main/java/io/github/sspanak/tt9/ui/main/BaseMainLayout.java
+++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/BaseMainLayout.java
@@ -106,7 +106,7 @@ abstract class BaseMainLayout {
boolean isLandscape = DeviceInfo.isLandscapeOrientation(view.getContext());
int bottomPadding = isLandscape ? e2ePaddingBottomLandscape : e2ePaddingBottomPortrait;
- bottomPadding = bottomPadding < 0 ? DeviceInfo.getNavigationBarHeight(view.getContext(), isLandscape) : bottomPadding;
+ bottomPadding = bottomPadding < 0 ? DeviceInfo.getNavigationBarHeight(view.getContext(), tt9.getSettings(), isLandscape) : bottomPadding;
view.setPadding(view.getPaddingLeft(), 0, view.getPaddingRight(), bottomPadding);
}
diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java
index 451a2ace..186af347 100644
--- a/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java
+++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java
@@ -116,7 +116,7 @@ class MainLayoutNumpad extends BaseMainLayout {
int bottomPadding = 0;
if (DeviceInfo.AT_LEAST_ANDROID_15) {
bottomPadding = isLandscape ? e2ePaddingBottomLandscape : e2ePaddingBottomPortrait;
- bottomPadding = bottomPadding < 0 ? DeviceInfo.getNavigationBarHeight(tt9.getApplicationContext(), isLandscape) : bottomPadding;
+ bottomPadding = bottomPadding < 0 ? DeviceInfo.getNavigationBarHeight(tt9.getApplicationContext(), tt9.getSettings(), isLandscape) : bottomPadding;
}
int screenHeight = DeviceInfo.getScreenHeight(tt9.getApplicationContext()) - bottomPadding;
diff --git a/app/src/main/res/xml/prefs_screen_debug.xml b/app/src/main/res/xml/prefs_screen_debug.xml
index 26a1b109..993e3c5e 100644
--- a/app/src/main/res/xml/prefs_screen_debug.xml
+++ b/app/src/main/res/xml/prefs_screen_debug.xml
@@ -12,6 +12,10 @@
android:title="@string/pref_category_usage_stats" />
+
+