Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Cover the entire screen
Started by maximo97 Nov 13 2019 03:19 PM

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

maximo97

[GLOBAL: userInfoPane.html]
maximo97
  • Contributor

  • 232 posts
  • Corona SDK

Hi guys in my app I use the following config:

.
.
.
	content =
	{
		width = 320,
		height = 480, 
		scale = "letterbox",
		fps = 60,
		
		imageSuffix =
		{
			    ["@2x"] = 1.5, --<---- changed from 2 to 1.5
			    ["@4x"] = 3,   --<---- changed from 4 to 3
		},
	},
.
.
.

I also hide the notification bar using:

display.setStatusBar( display.HiddenStatusBar )

and finally I create my background by doing something like:

local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight)

All this works well and the many test projects are done.

 

 

The problem is that on Android the navigation bar is very annoying so I hide it with:

	local function onResize( event )
        if (system.getInfo("androidApiLevel") >= 19) then
            native.setProperty("androidSystemUiVisibility", "immersiveSticky")
        else
            native.setProperty("androidSystemUiVisibility", "lowProfile")
        end
	end
	onResize()
	Runtime:addEventListener( "resize", onResize )

And here the problem is created. Apparently display.actualContentWidth and display.actualContentHeight refer to the entire screen without bar. and when I hide the bar everything is centered, leaving small black edges above and below the screen. 

Is there a way to know the new dimensions? something to solve this?



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,020 posts
  • Corona SDK

The issue is that when the navigation bar becomes visible, it will resize the display objects, but simply setting the UI visibility back to immersiveSticky will not resize said display objects back.

I fought with this same issue for a good while with one on-going client project. The way that you should be able to solve this, and how I went about solving this, is to remove all affected display objects and then recreate them and/or move back any affected display objects to their original places.

 

-

 

Now, if @Rob or someone else knows, I would also greatly appreciate knowing what specifically happens during this resize event when the Android navigation bar reappears. How does Corona (or the system) determine what display objects are scaled and how does the scaling happen?

 

Would there be an easier way to resize, or rather scale back, everything after this resize event? Is there some "master canvas/group" that could just be set "group.xScale, group.yScale = 1, 1" and everything is magically fixed? Because surely there must be a simpler approach than removing and recreating everything. If it is scaled once, then shouldn't we be able to just scale it back to the original dimensions?


  • maximo97 and pixec like this

[TOPIC: post.html]
#3

maximo97

[GLOBAL: userInfoPane.html]
maximo97
  • Contributor

  • 232 posts
  • Corona SDK

You hit the problem!

 

Your solution works but I don't know if I can do this. In my app I also use physics and other elements that are difficult to eliminate and recreate exactly as before.

 

I hope someone can provide a simpler and more decisive approach



[TOPIC: post.html]
#4

maximo97

[GLOBAL: userInfoPane.html]
maximo97
  • Contributor

  • 232 posts
  • Corona SDK

No updates on this? Is there a possible solution for this?




[topic_controls]
[/topic_controls]