Android Orientation Switching Broken On Nexus 7 Style Displays Due To Navigation Bar

Was the issue from this forum post ever resolved :

 

http://webcache.googleusercontent.com/search?q=cache:PxBRBq2HFKMJ:developer.coronalabs.com/forum/2012/10/02/android-orientation-switching-broken-nexus-7-style-displays+&cd=1&hl=en&ct=clnk&gl=uk

 

(I had to use a cached link otherwise it redirects to the main forum page :angry: )

 

 

Back in Oct '12 Joshua Quick said you might take a look at it in the future, just wondered if any progress has been made there?

Our app uses both landscape and portrait orientations, and limiting to just one orientation is not a solution for us, since the layout and scale of our content is based on the orientation (it zooms in more when in portrait so the user has a better view).

 

Or has anyone worked out their own solution?

I’m going to presume the answer is “no it’s not fixed”, for the moment at least.

I’ve also found this post:

http://developer.coronalabs.com/forum/2013/01/23/hiding-status-bar

Joshua Quick mentions that hiding the bar doesn’t solve the problem, since it will reappear when the user touches the screen. What I’m now wondering is:

Is there a way to detect which devices use an on screen navigation bar?

If there is, I could manually resize my content to fit. If this is possible, can we also find out the size of the navbar - since it will differ from device to device?

Alan,

The only work-around at the moment is to use a fixed orientation.

ie:  Portrait only or landscape only.

Note that this issue only happens on Android tablets running OS version 3.0 or higher.  This is not an issue with Android phones.

We’ve noticed that if you then suspend and resume the app by making the device go to sleep, the device will automatically correct the screen layout.

However this is not exactly convenient for users to have to resume and suspend every time they rotate the device, so it’s not really a ‘fix’. 

As I said in my first post, our app is heavily reliant on being able to change the screen orientation, and the device does seem to have some way of rectifying the problem that we don’t have access to.

It seems like something that would be an easy fix for corona, and I don’t think it’s unreasonable for developers to ask that their apps support such a basic feature.

This link contains a small demo project which shows the problem, just in case we’re talking about 2 different problems:

https://www.dropbox.com/s/dp6q6ffifv4qf17/orientationTest.zip

It displays the TOTAL available screen space, based on a config.lua with a contentWidth of 768 and a contentHeight of 1024. 

On a Nexus 7 the values show as:

Portrait: “Width = 768, Height = 1156”

Landscape: “Width = 1156, Height = 768”

But I would expect both of the height values to be lower than they are to accomodate the navbar if the orientation handler worked correctly on those devices.

You’ll also be able to see that you end up with content being pushed off screen or black borders depending on the orientation / screen-size, even though the positions are correct when the app is first started (regardless of orientation).

If anyone (Ansca or otherwise) has any work-arounds that solve the problem, I would be very happy if they could be shared with us.

Thanks

I’m going to presume the answer is “no it’s not fixed”, for the moment at least.

I’ve also found this post:

http://developer.coronalabs.com/forum/2013/01/23/hiding-status-bar

Joshua Quick mentions that hiding the bar doesn’t solve the problem, since it will reappear when the user touches the screen. What I’m now wondering is:

Is there a way to detect which devices use an on screen navigation bar?

If there is, I could manually resize my content to fit. If this is possible, can we also find out the size of the navbar - since it will differ from device to device?

Alan,

The only work-around at the moment is to use a fixed orientation.

ie:  Portrait only or landscape only.

Note that this issue only happens on Android tablets running OS version 3.0 or higher.  This is not an issue with Android phones.

We’ve tried the latest build (1076) and the graphics now fully fill the screen after rotation. Unfortunately the graphics are vertically squashed and the touch system does not line up to the graphics (horizontally at least).

Whatever orientation you start in is fine and the system reports the correct height and width - based on config.lua. When the device is rotated it simply swaps them around. This is not correct because the aspect ration has also changed due to the Android UI bar at the bottom moving from the old bottom to the new bottom.

We’ve updated our sample code + build to show it. We hope it helps!:

Code: https://www.dropbox.com/s/ucls8pvs0twe84u/orientationTest2.zip
Build: https://www.dropbox.com/s/v1ki0sk4o0l71sk/orientationTest2.apk

Press the coloured rounded rect to change its colour. If you can!

We’re aware of this issue and we know we haven’t fixed it yet.  There is no simple fix for this on our end, because this is a screen resize issue which most Corona developers do not expect to happen on a mobile device (at least in the iOS) world.  So, how to solve it is a debatable issue.  It will most likely involve us adding a “resize” event to Corona in order to resolve this issue… and when that event occurs, we’ll likely change the scale factor and keep the width/height the same for apps set up for dynamic scaling.  This means the letterbox area would increase/decrease in size when changing orientation, if in fact that is the desired effect.

In any case, the only solution at the moment is to set up your app with a fixed orientation such as portrait and portraitUpsideDown… or landscapeRight and landscapeLeft.

Hi Joshua,

Unfortunately the app has been fundamentally designed to use the orientation handling that was promoted as a feature of Corona. Simply making it portrait or landscape would make the Android version far inferior to the iOS version. Unfortunately it’s just not an option.

Ok… we could actually live with the distortion for now, which sounds like it is the difficult thing to fix, but is there any chance you can adjust the touch so it at least matches the current graphics? At least then we can release our first version!

Thanks a lot,

Ian

>> but is there any chance you can adjust the touch so it at least matches the current graphics?

Unfortunately no.  It all stems from the same issue where Corona does not currently support the screen’s aspect ratio changing at runtime at the moment, which is something that never happens on iOS or in the Corona Simulator.  We’ll have to add support for this to Corona’s core code, which will impact all platforms that we support.

Ouch. Can you give us an ETA? This will delay the launch of an important work for hire project for us.

I can’t commit to a date, but I will re-raise this issue with the team on my end.

We’ve noticed that if you then suspend and resume the app by making the device go to sleep, the device will automatically correct the screen layout.

However this is not exactly convenient for users to have to resume and suspend every time they rotate the device, so it’s not really a ‘fix’. 

As I said in my first post, our app is heavily reliant on being able to change the screen orientation, and the device does seem to have some way of rectifying the problem that we don’t have access to.

It seems like something that would be an easy fix for corona, and I don’t think it’s unreasonable for developers to ask that their apps support such a basic feature.

This link contains a small demo project which shows the problem, just in case we’re talking about 2 different problems:

https://www.dropbox.com/s/dp6q6ffifv4qf17/orientationTest.zip

It displays the TOTAL available screen space, based on a config.lua with a contentWidth of 768 and a contentHeight of 1024. 

On a Nexus 7 the values show as:

Portrait: “Width = 768, Height = 1156”

Landscape: “Width = 1156, Height = 768”

But I would expect both of the height values to be lower than they are to accomodate the navbar if the orientation handler worked correctly on those devices.

You’ll also be able to see that you end up with content being pushed off screen or black borders depending on the orientation / screen-size, even though the positions are correct when the app is first started (regardless of orientation).

If anyone (Ansca or otherwise) has any work-arounds that solve the problem, I would be very happy if they could be shared with us.

Thanks

We’ve tried the latest build (1076) and the graphics now fully fill the screen after rotation. Unfortunately the graphics are vertically squashed and the touch system does not line up to the graphics (horizontally at least).

Whatever orientation you start in is fine and the system reports the correct height and width - based on config.lua. When the device is rotated it simply swaps them around. This is not correct because the aspect ration has also changed due to the Android UI bar at the bottom moving from the old bottom to the new bottom.

We’ve updated our sample code + build to show it. We hope it helps!:

Code: https://www.dropbox.com/s/ucls8pvs0twe84u/orientationTest2.zip
Build: https://www.dropbox.com/s/v1ki0sk4o0l71sk/orientationTest2.apk

Press the coloured rounded rect to change its colour. If you can!

We’re aware of this issue and we know we haven’t fixed it yet.  There is no simple fix for this on our end, because this is a screen resize issue which most Corona developers do not expect to happen on a mobile device (at least in the iOS) world.  So, how to solve it is a debatable issue.  It will most likely involve us adding a “resize” event to Corona in order to resolve this issue… and when that event occurs, we’ll likely change the scale factor and keep the width/height the same for apps set up for dynamic scaling.  This means the letterbox area would increase/decrease in size when changing orientation, if in fact that is the desired effect.

In any case, the only solution at the moment is to set up your app with a fixed orientation such as portrait and portraitUpsideDown… or landscapeRight and landscapeLeft.

Hi Joshua,

Unfortunately the app has been fundamentally designed to use the orientation handling that was promoted as a feature of Corona. Simply making it portrait or landscape would make the Android version far inferior to the iOS version. Unfortunately it’s just not an option.

Ok… we could actually live with the distortion for now, which sounds like it is the difficult thing to fix, but is there any chance you can adjust the touch so it at least matches the current graphics? At least then we can release our first version!

Thanks a lot,

Ian

>> but is there any chance you can adjust the touch so it at least matches the current graphics?

Unfortunately no.  It all stems from the same issue where Corona does not currently support the screen’s aspect ratio changing at runtime at the moment, which is something that never happens on iOS or in the Corona Simulator.  We’ll have to add support for this to Corona’s core code, which will impact all platforms that we support.

Ouch. Can you give us an ETA? This will delay the launch of an important work for hire project for us.

I can’t commit to a date, but I will re-raise this issue with the team on my end.

Bump, is this any status update on this rather major issue?
Thanks
N