Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How does Corona work with cutouts on the modern phones screen's?
Started by stalxerhd Jun 22 2019 10:42 AM

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

stalxerhd

[GLOBAL: userInfoPane.html]
stalxerhd
  • Observer

  • 11 posts
  • Corona SDK

How does Corona work with cutouts on the modern phones screen's?
 
I don't have a modern phone to test myself, so I want to ask about it. I mean these cutouts (attached). 
 
I had watched some videos, and game apps very often go full widescreen, so these areas (for front camera and sensors) - on top of the smartphone - are also in use. 
 
But if I want to use a top part of the phone for gameplay info (speed, score, lives, what's coming next, messages, etc how I could now, what part in pixels I shouldn't use?
 
There is another problem - these cutouts are very different. Big or small, like a circle or like a rectangle.
 
I already made resolution-independent prototype, so I use such commands like
display.actualContentWidth
display.actualContentHeight
display.pixelWidth
display.pixelHeight

But I forgot about cutoffs and now apprehend, that some info may be hidden or not fully visible...

 

Will it happen?

Attached Files

  • Attached File  003.jpg   193.37KB   0 downloads
  • Attached File  002.jpg   116.59KB   0 downloads


[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,197 posts
  • Enterprise

Corona has API's that are for devices with Notches. Look for the display.* API's with the word "Safe" in their name. However I believe they are only working correctly on iOS devices. My understanding is that we will need to target Android SDK 28 (Android 9/Pie) before notch support will work. We have to get 64-bit out the door then we will address SDK 28. Then there may need to be more work to hook up those API's to our existing safe zone APIs.

 

 

Rob


  • roaminggamer and stalxerhd like this

[TOPIC: post.html]
#3

stalxerhd

[GLOBAL: userInfoPane.html]
stalxerhd
  • Observer

  • 11 posts
  • Corona SDK

Corona has API's that are for devices with Notches. Look for the display.* API's with the word "Safe" in their name. However I believe they are only working correctly on iOS devices. My understanding is that we will need to target Android SDK 28 (Android 9/Pie) before notch support will work. We have to get 64-bit out the door then we will address SDK 28. Then there may need to be more work to hook up those API's to our existing safe zone APIs.

 

 

Rob

Rob, good day, I missed Corona updates from July, is this feature added?



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

Search the API docs for word safe

 

https://docs.coronalabs.com/api/

 

These features have been in place for a long while.

 

 

**UPDATE** See my post below.  I missed Rob's clear answer on Android + Notices.

 

Whatever the case, I feel your pain.  Notches are the worst (at least when it comes to designing game GUIs).


Edited by roaminggamer, 22 September 2019 - 04:00 PM.


[TOPIC: post.html]
#5

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 934 posts
  • Corona SDK

These features have indeed been available for a long time on iOS, but I don't think I've heard any mention of them being supported on Android.


  • roaminggamer likes this

[TOPIC: post.html]
#6

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

UPDATE: I just went through my email backlog (I keep all forums posts) and did not find a mention of this specifically....

 

So I am wrong.  It seems while this is well supported for Apple.  Not so much for Android.

 

Note: I should also read Rob's responses more closely.  He clearly says ' we will need to target Android SDK 28 (Android 9/Pie) before notch support will work.'

 

Not sure why I thought this worked... sigh...

 

 

 

These features have indeed been available for a long time on iOS, but I don't think I've heard any mention of them being supported on Android.

 

 Notches: I still wish these had never come along.  They cause/require so much extra work as the OP has noticed.
 


Edited by roaminggamer, 22 September 2019 - 03:59 PM.

  • XeduR @Spyric likes this

[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,197 posts
  • Enterprise

I've spent some time today trying to find an emulator with a notch for Android Studio that I could test against, but I've not had any luck. My Android test devices don't have a notch so I can't run my own test.

 

What I would suggest is write a small app that does something like:

 

print("display.contentHeight", display.contentHeight)

print("display.actualContentHeight", display.actualContentHeight)

print("display.safeActualContentHeight", display.safeActualContentHeight)

print("display.screenOriginY", display.screenOriginY)

print("display.safeScreenOriginY", display.safeScreenOriginY)

 

(if you do a landscape app, do width's and X's, but it would be best to do this on a portrait app, or print the width/X values too).

 

It might also be helpful to print display.pixelHeight and display.contentScaleY so we can check the math. 

 

But if display.actualContentHeight and display.safeActualContentHeight are equal then we are not detecting then notch. If they are different and the value is about the right number of points then you're good (remember these values will be scaled to whatever you put in your config.lua for height.)

 

Rob


  • stalxerhd likes this

[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,197 posts
  • Enterprise

Oh, you will need to build it and run it on a real device, not the simulator and use "adb logcat" to get the values.

 

Rob



[TOPIC: post.html]
#9

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 934 posts
  • Corona SDK

I agree with roaminggamer in wishing that these displays had never come along.

 

Not only do they make the process of designing and creating apps more difficult, but such displays are also more expensive to manufacture compared to their rectangular counterparts. Oh, and not to mention that almost all content is designed for rectangular screens, be it movies, e-books, games, apps, you name it.

 

Who benefits from having such things?! :D



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,197 posts
  • Enterprise

While I agree that there are challenges with the notches, I do have to credit them with making a decent use of them (well at least on Apple since I don't have an Android to use). The notch basically splits the status bar in two. Now left swipes down and right swipes down do different things. From a user perspective it's not bad and instead of having a status bar that spans the whole width, the area wit the notch is good for the status bar.

 

From a developer perspective it's a pain in the behind because the vendors let us control the showing of the status bar and give us that area for our own content.



[TOPIC: post.html]
#11

gamebit.labs

[GLOBAL: userInfoPane.html]
gamebit.labs
  • Contributor

  • 196 posts
  • Corona SDK

We had a difficult time handling notches when displaying our UI for Android...the safe apis worked very well in iOS.

 

We used Amazon's Device Farm to test how our UI display against a range of Android notches & screen ratios and finally solved it. You get 1000 mins of free test time with a new signup. The list of devices are good.

 

Ben




[topic_controls]
[/topic_controls]