Skip to content

Commit 1118066

Browse files
committed
cutout functionality
1 parent 62e0def commit 1118066

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

doc/source/buildoptions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ options (this list may not be exhaustive):
7272
- ``--permission``: A permission that needs to be declared into the App ``AndroidManifest.xml``.
7373
For multiple permissions, add multiple ``--permission`` arguments.
7474
``--home-app`` Gives you the option to set your application as a home app (launcher) on your Android device.
75+
``--display-cutout``: Enables the display cutout (notch) functionality.
76+
`Android documentation <https://developer.android.com/develop/ui/views/layout/display-cutout>`__.
7577

7678
.. Note ::
7779
``--permission`` accepts the following syntaxes:

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,9 @@ def make_package(args):
545545
"service_names": service_names,
546546
"android_api": android_api,
547547
"debug": "debug" in args.build_mode,
548-
"native_services": args.native_services
548+
"native_services": args.native_services,
549+
"support_cutout": all([android_api >= 28,
550+
args.display_cutout != 'never'])
549551
}
550552
if get_bootstrap_name() == "sdl2":
551553
render_args["url_scheme"] = url_scheme
@@ -598,7 +600,8 @@ def make_package(args):
598600
)
599601
render_args = {
600602
"args": args,
601-
"private_version": hashlib.sha1(private_version.encode()).hexdigest()
603+
"private_version": hashlib.sha1(private_version.encode()).hexdigest(),
604+
"android_api": android_api
602605
}
603606
if get_bootstrap_name() == "sdl2":
604607
render_args["url_scheme"] = url_scheme
@@ -777,6 +780,8 @@ def create_argument_parser():
777780
'launcher, rather than a single app.'))
778781
ap.add_argument('--home-app', dest='home_app', action='store_true', default=False,
779782
help=('Turn your application into a home app (launcher)'))
783+
ap.add_argument('--display-cutout', dest='display_cutout', default='never',
784+
help=('Enables display-cutout (notch) to render where the front camera is on newer devices. '))
780785
ap.add_argument('--permission', dest='permissions', action='append', default=[],
781786
help='The permissions to give this app.', nargs='+')
782787
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],

pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
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 %}"
7272
android:screenOrientation="{{ args.manifest_orientation }}"
7373
android:exported="true"
74+
{% if support_cutout %}
75+
android:theme="@style/BaseStyle"
76+
{% endif %}
7477
{% if args.activity_launch_mode %}
7578
android:launchMode="{{ args.activity_launch_mode }}"
7679
{% endif %}

pythonforandroid/bootstraps/sdl2/build/templates/strings.tmpl.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3+
<style name="BaseStyle">
4+
<item name="android:windowLayoutInDisplayCutoutMode">{{ args.display_cutout }}</item>
5+
<item name="android:windowTranslucentStatus">true</item>
6+
<item name="android:windowTranslucentNavigation">true</item>
7+
<item name="android:windowNoTitle">true</item>
8+
<item name="android:windowFullscreen">true</item>
9+
</style>
310
<string name="app_name">{{ args.name }}</string>
411
<string name="private_version">{{ private_version }}</string>
512
<string name="presplash_color">{{ args.presplash_color }}</string>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy