3

I've previously used some of the solutions on this question to offset a PopUpWindow window directly underneath the status bar. This works fine on an S8+ (which reports a status bar height of 84 pixels) as long as the app has not been set as a "Full Screen App".

If the app has been set to be a "Full Screen App" under Settings -> Display -> Full Screen Apps, the PopUpWindow will not display directly beneath the (still visible) status bar. Although the system still reports a status bar height of 84 pixels, the correct offset at this point is 0.

I can work around this by calculating the aspect ratio of the screen and if it is 1.9388889, then the app is in full screen mode, so the PopUpWindow offset can be set to 0.

However, this feels fragile and I'm not sure how this will work on other devices that support tall aspect ratios (LG6, etc). Ideally I would have a way to detect if an app is running in full screen without relying on specific aspect ratios. This seemed ideal:

boolean fullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;

...but it returns false on an S8+ running an app set to be a Full Screen App. It appears Full Screen Mode and Full Screen App are two distinct concepts.

Rather than using specific aspect ratios, is there a better way to detect something is running as a Full Screen App? Or, a more robust way to calculate the status bar offset required, that will handle this Full Screen App scenario?

user1173706
  • 2,612
  • 3
  • 19
  • 29

0 Answers0