gluonhq / attach

GNU General Public License v3.0
50 stars 26 forks source link

Get iOS status bar height #243

Open javasuns opened 3 years ago

javasuns commented 3 years ago

Need a method to get status bar height.

Screenshot 2021-03-02 at 17 10 45
LordTylus commented 1 year ago

This Issue apparently solves exactly a requirement we have, since we somewhat try to figure out how to properly support the notch of a device.

We can ask the display if it does have a notch. But since there's centered content, we have to find out how far we have to move it down in order to look good.

Is there a chance, the PR - which is open for almost a year already - can be merged, and the missing Android implementation provided?

I know you can request the statusbar height from android via the following code:

        Resources resources = activity.getResources();

        int statusbarHeightResourceId = resources.getIdentifier("status_bar_height", "dimen", "android");

        if (statusbarHeightResourceId > 0)
            return resources.getDimensionPixelSize(statusBarHeightResourceId);

        return 0;

However, I don't know what I would have to do in order to properly test if it works with Gluon. I know in my native Android App it does. I Ill also add this snipped to the PR as comment.