WebViewActivity: improve integrated map's edge-to-edge

This commit is contained in:
adbenitez
2025-11-26 23:40:23 +01:00
parent 0a7be040c3
commit 34fc888c5e
2 changed files with 16 additions and 5 deletions
@@ -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.
@@ -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());