aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/app/src/main/java/io/coinos/MainActivity.java23
-rw-r--r--android/app/src/main/res/layout/activity_main.xml13
-rw-r--r--android/app/src/main/res/values/styles.xml13
-rwxr-xr-xbun.lockbbin289631 -> 290051 bytes
-rw-r--r--package.json5
-rw-r--r--src/routes/+layout.svelte37
6 files changed, 50 insertions, 41 deletions
diff --git a/android/app/src/main/java/io/coinos/MainActivity.java b/android/app/src/main/java/io/coinos/MainActivity.java
index 791c89a9..501d2e0f 100644
--- a/android/app/src/main/java/io/coinos/MainActivity.java
+++ b/android/app/src/main/java/io/coinos/MainActivity.java
@@ -8,6 +8,7 @@ import androidx.core.view.ViewCompat;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Bridge;
+
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -25,25 +26,31 @@ import java.util.Arrays;
public class MainActivity extends BridgeActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ // ✅ Let Capacitor inflate its layout and wire everything
super.onCreate(savedInstanceState);
- // Ensure the WebView doesn't overlap the system status bar
+ WebView webView = bridge.getWebView(); // This works *after* super.onCreate()
+
+ // ✅ Ensure layout respects system bars
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
- WebView webView = bridge.getWebView();
+ // ✅ Apply top inset padding if needed
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ webView.setOnApplyWindowInsetsListener((v, insets) -> {
+ v.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);
+ return insets.consumeSystemWindowInsets();
+ });
+ }
+
+ // Other app setup
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
- // Ensure layout respects system window insets
- ViewCompat.setOnApplyWindowInsetsListener(webView, (v, insets) -> {
- v.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);
- return insets;
- });
-
handleIntent(getIntent());
}
diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml
index b5ad1387..3710e23b 100644
--- a/android/app/src/main/res/layout/activity_main.xml
+++ b/android/app/src/main/res/layout/activity_main.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".MainActivity">
+ android:fitsSystemWindows="true">
<WebView
+ android:id="@+id/webview"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</androidx.coordinatorlayout.widget.CoordinatorLayout>
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true" />
+</FrameLayout>
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index be874e54..07128ac1 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -1,9 +1,7 @@
-<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
- <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
@@ -15,8 +13,15 @@
<item name="android:background">@null</item>
</style>
-
+ <!-- 🚨 This is your actual launch theme. It must stop fullscreen mode. -->
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
<item name="android:background">@drawable/splash</item>
+
+ <!-- ✅ These lines are critical -->
+ <item name="android:windowFullscreen">false</item>
+ <item name="android:windowTranslucentStatus">false</item>
+ <item name="android:fitsSystemWindows">true</item>
+ <item name="android:statusBarColor">#000000</item> <!-- Or match your splash background -->
</style>
-</resources> \ No newline at end of file
+
+</resources>
diff --git a/bun.lockb b/bun.lockb
index bcf4f106..2a601932 100755
--- a/bun.lockb
+++ b/bun.lockb
Binary files differ
diff --git a/package.json b/package.json
index 685cb7bb..a2241d3c 100644
--- a/package.json
+++ b/package.json
@@ -68,5 +68,8 @@
"lint": "prettier --check .",
"format": "prettier --write ."
},
- "type": "module"
+ "type": "module",
+ "dependencies": {
+ "cordova-plugin-android-notch": "^1.0.3"
+ }
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 76db8abe..4317a6a2 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -16,16 +16,6 @@
? `http://${PUBLIC_DOMAIN}`
: `https://${PUBLIC_DOMAIN}`;
- function getSafeInsetTop() {
- const div = document.createElement("div");
- div.style.cssText = "position:absolute;top:0;padding-top:env(safe-area-inset-top);";
- document.body.appendChild(div);
- const computed = getComputedStyle(div).paddingTop;
- document.body.removeChild(div);
- const px = parseInt(computed, 10);
- return isNaN(px) ? 24 : px;
- }
-
onMount(() => {
if (!browser) return;
@@ -35,11 +25,18 @@
$installPrompt = event;
});
- // Fix: Apply top padding manually for Android WebView
- const insetTop = getSafeInsetTop();
- const main = document.querySelector("main");
- if (main && insetTop > 0) {
- main.style.paddingTop = `${insetTop}px`;
+ if (typeof window.AndroidNotch !== "undefined") {
+ window.AndroidNotch.getInsetTop(
+ (px) => {
+ document.documentElement.style.setProperty(
+ "--safe-area-inset-top",
+ px + "px",
+ );
+ },
+ (err) => {
+ console.error("Failed to get notch inset:", err);
+ },
+ );
}
});
</script>
@@ -75,15 +72,11 @@
--toastContainerBottom: 8rem;
--toastContainerLeft: calc(50vw - 8rem);
--toastBackground: #292929;
- }
- main {
- padding-top: env(safe-area-inset-top, 24px);
+ --safe-area-inset-top: 24px;
}
- @supports not (padding-top: env(safe-area-inset-top)) {
- main {
- padding-top: 24px;
- }
+ main {
+ padding-top: var(--safe-area-inset-top);
}
</style>