Skip to content

Support for display-cutout #2766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/source/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ options (this list may not be exhaustive):
- ``--permission``: A permission that needs to be declared into the App ``AndroidManifest.xml``.
For multiple permissions, add multiple ``--permission`` arguments.
``--home-app`` Gives you the option to set your application as a home app (launcher) on your Android device.
``--display-cutout``: A display cutout is an area on some devices that extends into the display surface.
It allows for an edge-to-edge experience while providing space for important sensors on the front of the device.
(Available options for Android ``API >= 28`` are ``default``, ``shortEdges``, ``never`` and defaults to ``never``)
`Android documentation <https://developer.android.com/develop/ui/views/layout/display-cutout>`__.

.. Note ::
``--permission`` accepts the following syntaxes:
Expand Down
5 changes: 4 additions & 1 deletion pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ def make_package(args):
)
render_args = {
"args": args,
"private_version": hashlib.sha1(private_version.encode()).hexdigest()
"private_version": hashlib.sha1(private_version.encode()).hexdigest(),
"android_api": android_api
}
if get_bootstrap_name() == "sdl2":
render_args["url_scheme"] = url_scheme
Expand Down Expand Up @@ -777,6 +778,8 @@ def create_argument_parser():
'launcher, rather than a single app.'))
ap.add_argument('--home-app', dest='home_app', action='store_true', default=False,
help=('Turn your application into a home app (launcher)'))
ap.add_argument('--display-cutout', dest='display_cutout', default='never',
help=('Enables display-cutout that renders around the area (notch) on some devices that extends into the display surface'))
ap.add_argument('--permission', dest='permissions', action='append', default=[],
help='The permissions to give this app.', nargs='+')
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@
{% for m in args.meta_data %}
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>

<activity android:name="{{args.android_entrypoint}}"
android:label="@string/app_name"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode{% if args.min_sdk_version >= 8 %}|uiMode{% endif %}{% if args.min_sdk_version >= 13 %}|screenSize|smallestScreenSize{% endif %}{% if args.min_sdk_version >= 17 %}|layoutDirection{% endif %}{% if args.min_sdk_version >= 24 %}|density{% endif %}"
android:screenOrientation="{{ args.manifest_orientation }}"
android:exported="true"
{% if android_api >= 28 and args.display_cutout != 'never'%}
android:theme="@style/KivySupportCutout"
{% endif %}
{% if args.activity_launch_mode %}
android:launchMode="{{ args.activity_launch_mode }}"
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="KivySupportCutout">
<!-- Display cutout is an area on some devices that extends into the display surface -->
<item name="android:windowLayoutInDisplayCutoutMode">{{ args.display_cutout }}</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<string name="app_name">{{ args.name }}</string>
<string name="private_version">{{ private_version }}</string>
<string name="presplash_color">{{ args.presplash_color }}</string>
Expand Down