From 34fc888c5e3d653b1d5d32915280d9d9ec1ac13d Mon Sep 17 00:00:00 2001 From: adbenitez Date: Wed, 26 Nov 2025 23:40:23 +0100 Subject: [PATCH] WebViewActivity: improve integrated map's edge-to-edge --- .../org/thoughtcrime/securesms/WebViewActivity.java | 12 ++++++++++-- .../org/thoughtcrime/securesms/WebxdcActivity.java | 9 ++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/thoughtcrime/securesms/WebViewActivity.java b/src/main/java/org/thoughtcrime/securesms/WebViewActivity.java index 7e8ae018b..c62800968 100644 --- a/src/main/java/org/thoughtcrime/securesms/WebViewActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/WebViewActivity.java @@ -38,6 +38,9 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity protected WebView webView; + /** Return true the window content should display fullscreen/edge-to-edge ex. in the integrated maps app */ + protected boolean immersiveMode() { return false; } + protected boolean shouldAskToOpenLink() { return false; } protected void toggleFakeProxy(boolean enable) { @@ -67,8 +70,13 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity webView = findViewById(R.id.webview); - // add padding to avoid content hidden behind system bars - ViewUtil.applyWindowInsets(findViewById(R.id.content_container)); + if(immersiveMode()) { + // set a shadow in the status bar to make it more readable + findViewById(R.id.status_bar_background).setBackgroundResource(R.drawable.search_toolbar_shadow); + } else { + // add padding to avoid content hidden behind system bars + ViewUtil.applyWindowInsets(findViewById(R.id.content_container)); + } webView.setWebViewClient(new WebViewClient() { // IMPORTANT: this is will likely not be called inside iframes unless target=_blank is used in the anchor/link tag. diff --git a/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java b/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java index 82b06fb96..9e8604465 100644 --- a/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java @@ -150,15 +150,18 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE .getIntents(); } + @Override + protected boolean immersiveMode() { return hideActionBar; } + @Override protected void onCreate(Bundle state, boolean ready) { + Bundle b = getIntent().getExtras(); + hideActionBar = b.getBoolean(EXTRA_HIDE_ACTION_BAR, false); + super.onCreate(state, ready); rpc = DcHelper.getRpc(this); initTTS(); - Bundle b = getIntent().getExtras(); - hideActionBar = b.getBoolean(EXTRA_HIDE_ACTION_BAR, false); - // enter fullscreen mode if necessary, // this is needed here because if the app is opened while already in landscape mode, onConfigurationChanged() is not triggered setScreenMode(getResources().getConfiguration());