Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: bottom app padding on Android

Ilian Sapundshiev59edbe770e1b
diff --git a/capacitor/android/app/src/main/java/org/tagspaces/mobileapp/MainActivity.java b/capacitor/android/app/src/main/java/org/tagspaces/mobileapp/MainActivity.java
index d887548bb..f60eaa365 100644
--- a/capacitor/android/app/src/main/java/org/tagspaces/mobileapp/MainActivity.java
+++ b/capacitor/android/app/src/main/java/org/tagspaces/mobileapp/MainActivity.java
@@ -21,18 +21,32 @@ public class MainActivity extends BridgeActivity {
// Android 15+ (targetSdk 35+) force-enables edge-to-edge: the WebView always
// extends behind the status bar, notch, and gesture nav. StatusBar plugin's
// setOverlaysWebView({overlay:false}) became a no-op, and the SDK-35 opt-out
- // flag was removed in SDK 36. We restore pre-edge-to-edge behavior by padding
- // the WebView's parent so the WebView itself no longer overlaps system bars —
- // this fixes both flow and position:fixed/absolute UI inside the WebView.
+ // flag was removed in SDK 36. We restore pre-edge-to-edge behavior on the
+ // top/left/right by padding the WebView's parent so the WebView no longer
+ // overlaps the status bar and display cutout — this fixes both flow and
+ // position:fixed/absolute UI inside the WebView.
+ //
+ // The BOTTOM is deliberately left unpadded: padding it pushed the WebView up
+ // and revealed the parent's (white) background under the gesture-nav bar — a
+ // ~15px dead strip. Instead we let the WebView extend to the screen edge so
+ // the app background fills that area, and we pass the bottom inset through to
+ // the WebView (instead of consuming it) so the web layer can keep its own
+ // content clear of the gesture bar via env(safe-area-inset-bottom)
+ // (viewport-fit=cover + body padding-bottom in index.html).
private void insetWebViewFromSystemBars() {
final View parent = (View) getBridge().getWebView().getParent();
if (parent == null) return;
ViewCompat.setOnApplyWindowInsetsListener(parent, (v, insets) -> {
- Insets bars = insets.getInsets(
- WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()
- );
- v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
- return WindowInsetsCompat.CONSUMED;
+ int typeMask = WindowInsetsCompat.Type.systemBars()
+ | WindowInsetsCompat.Type.displayCutout();
+ Insets bars = insets.getInsets(typeMask);
+ v.setPadding(bars.left, bars.top, bars.right, 0);
+ // Consume top/left/right (handled by the padding above) but keep the
+ // bottom inset so the WebView still receives it and env(safe-area-
+ // inset-bottom) resolves to the gesture-nav height in CSS.
+ return new WindowInsetsCompat.Builder(insets)
+ .setInsets(typeMask, Insets.of(0, 0, 0, bars.bottom))
+ .build();
});
ViewCompat.requestApplyInsets(parent);
}