Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Setting androidSystemUiVisibility to immersiveSticky causes actual content values to clip to safe areas
Started by rune7 Oct 23 2018 09:14 AM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 331 posts
  • Corona SDK

There seem to be a bug in the behavior of:

native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) 

When I do not use this method (at start of my main) my code correctly stretches a background image to cover the entire screen size including the areas outside the safe zones. However, if I do use this method, the background image receives wrong values for the screen area (probably just the safe screen area instead of the full one).

 

The expected behavior is that display.actualContentWidth and display.actualContentHeight remains the same.

 

 



[TOPIC: post.html]
#2

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,236 posts
  • Enterprise

just guessing, but you may be trying to use those values "too soon" (before immersive actually kicks in)

immersive will resize the available screen, thus changing those values (assuming letterbox scaling)

sounds like you want the "after immersive" values, so you may need to listen for resize events



[TOPIC: post.html]
#3

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 331 posts
  • Corona SDK

Hi @davebollinger,

 

You are right of course :) should have thought about it myself.

 

Did some tests and seems we need to listen to the resize event due to several cases, such as suspend/resume events that cause the bar to reappear. Ended up with something like this to support immersive option on android:

local isAndroid = "Android" == system.getInfo("platformName")
if isAndroid then
    native.setProperty( "androidSystemUiVisibility", "immersiveSticky" )
end
display.setStatusBar( display.HiddenStatusBar )

local function onResize( event )
    if isAndroid and native.getProperty( "androidSystemUiVisibility" ) ~= "immersiveSticky" then
        native.setProperty( "androidSystemUiVisibility", "immersiveSticky" )
    end
    updateSizes() --update all game internal size values
end
Runtime:addEventListener( "resize", onResize )

Perhaps something like this should be in the method documentation.




[topic_controls]
[/topic_controls]