diff options
| author | Adam Soltys <[email protected]> | 2025-07-08 03:35:34 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-08 03:36:16 -0700 |
| commit | 503fa32f2453d76ed34d4d15f3321c981fc8f952 (patch) | |
| tree | 5ea4a3dba4a830d79809b3390e54703eec9ac4d2 /android/app/src/main | |
| parent | ddf3e1cb1839310f28af092f6586992b3180cacd (diff) | |
| download | coinos-ui-503fa32f2453d76ed34d4d15f3321c981fc8f952.tar.gz coinos-ui-503fa32f2453d76ed34d4d15f3321c981fc8f952.zip | |
inset
Diffstat (limited to 'android/app/src/main')
| -rw-r--r-- | android/app/src/main/java/io/coinos/MainActivity.java | 23 | ||||
| -rw-r--r-- | android/app/src/main/res/layout/activity_main.xml | 13 | ||||
| -rw-r--r-- | android/app/src/main/res/values/styles.xml | 13 |
3 files changed, 31 insertions, 18 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> |
