question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Allow fullscreen immersive mode in splash screen

See original GitHub issue

Feature Request

Describe the Feature Request

Android has an option to hide navigation bar and action bar to allow for full screen experience, they call it immersive: https://developer.android.com/training/system-ui/immersive

This is common for many apps and we can do it now in MainActivity.java however while splash screen is launching, it is still showing the navbar. Recent changes with addition of splashFullScreen allow us to hide action bar however.

Platform Support Requested

  • Android
  • iOS
  • Electron
  • Web

Describe Preferred Solution

ideally we could make another flag that allows to hide it?

Describe Alternatives

Not sure if any exist

Related Code

I was able to implement this in my MainActivity.java file like this:

package com.asimetriq.skimitar;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;

import com.asimetriq.skimitar.ASQPlugins.GoogleAuth;
import com.asimetriq.skimitar.ASQPlugins.SafeArea;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;

import java.util.ArrayList;

public class MainActivity extends BridgeActivity {


  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    hideSystemUI();

    /**
     * Initialize capacitor bridge
     */
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(GoogleAuth.class);
      add(SafeArea.class);
    }});
  }

  @Override
  public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
      hideSystemUI();
    }
  }

  /**
   * Hide android navbar and toolbar for full screen experience
   */
  private void hideSystemUI() {
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    View decorView = getWindow().getDecorView();

    decorView.setSystemUiVisibility(flags);
    decorView.setOnSystemUiVisibilityChangeListener((int visibility) ->  {
      if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
        decorView.setSystemUiVisibility(flags);
      }
    });
  }
}

Additional Context

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
0xAsimetriqcommented, Feb 7, 2020

I am open to implement this if you give me some pointers and we agree on how this implementation looks.

0reactions
ionitron-bot[bot]commented, Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Immersive mode on splash screen - android - Stack Overflow
I'm trying to implement a splash screen that takes the whole screen. So, the Status Bar needs to be hidden, but only during...
Read more >
Hide system bars for immersive mode - Android Developers
Use WindowInsetsControllerCompat.BEHAVIOR_SHOW_BARS_BY_SWIPE to reveal hidden system bars on any system gestures, such as swiping from the edge of the screen ...
Read more >
How to Enable Immersive Mode on Android - Lifewire
Launch the PhotoSafe Fullscreen Immersive app and tap Usage Access. · Tap Grant. · Tap Full Screen Immersive Mode. · Tap Allow usage...
Read more >
Supporting display cutouts on edge-to-edge screens
In landscape or fullscreen mode, your app window will be letterboxed so that none of your content is displayed in the cutout area....
Read more >
Instagram is Experimenting With a Full-Screen Home Mode ...
Instagram is testing a new feature that would offer a similar, instantly immersive experience, which it says is designed to “bring video more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found