From faf4abb6afac27f2ff6df0520568a298525b295a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Fri, 3 Mar 2023 22:20:09 +0200 Subject: [PATCH 1/4] Home app functionality --- pythonforandroid/bootstraps/common/build/build.py | 2 ++ .../bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 01f5c881b5..97fd48daf6 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -773,6 +773,8 @@ def create_argument_parser(): ap.add_argument('--launcher', dest='launcher', action='store_true', help=('Provide this argument to build a multi-app ' '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('--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=[], diff --git a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml index f33e9c81e0..5af8a76fef 100644 --- a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml @@ -103,6 +103,10 @@ + {% if args.home_app %} + + + {%- endif -%} From 3f40d54165301d138c871361f0ab13356d9076f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Fri, 3 Mar 2023 23:38:31 +0200 Subject: [PATCH 2/4] Cleanup --- .../sdl2/build/templates/AndroidManifest.tmpl.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml index 5af8a76fef..c0579b6726 100644 --- a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml @@ -75,7 +75,12 @@ android:launchMode="{{ args.activity_launch_mode }}" {% endif %} > - + {% if args.home_app %} + + + + + {%- endif -%} {% if args.launcher %} @@ -103,10 +108,6 @@ - {% if args.home_app %} - - - {%- endif -%} From 8177c8fac43f22e4162b7c9a356ef6f78456ce09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Sat, 4 Mar 2023 11:57:15 +0200 Subject: [PATCH 3/4] Added --home-app to the docs --- doc/source/buildoptions.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/buildoptions.rst b/doc/source/buildoptions.rst index 98e07712d5..4acefa1885 100644 --- a/doc/source/buildoptions.rst +++ b/doc/source/buildoptions.rst @@ -71,6 +71,7 @@ options (this list may not be exhaustive): - ``--icon``: A path to the png file to use as the application icon. - ``--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. .. Note :: ``--permission`` accepts the following syntaxes: From dc62de2002d4d9f6f8eb52bb6a046aeb361f290f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Sat, 4 Mar 2023 14:07:34 +0200 Subject: [PATCH 4/4] Fixed the if statements within the intent-filter --- .../build/templates/AndroidManifest.tmpl.xml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml index c0579b6726..3353c0a0d5 100644 --- a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml @@ -75,25 +75,23 @@ android:launchMode="{{ args.activity_launch_mode }}" {% endif %} > - {% if args.home_app %} - - - - - {%- endif -%} - {% if args.launcher %} + + {% if args.launcher %} - {% else %} - - {% endif %} + {% if args.home_app %} + + + {% endif %} + + {%- if args.intent_filters -%} {{- args.intent_filters -}} {%- endif -%}