8000 Add the build.py part of the option to launch an intent after running… · wtud/python-for-android@0e5ee9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e5ee9e

Browse files
committed
Add the build.py part of the option to launch an intent after running main.py (--launch-intent)
1 parent 3b971d2 commit 0e5ee9e

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ def make_package(args):
455455
'argument more than once to include multiple jars'))
456456
ap.add_argument('--meta-data', dest='meta_data', action='append',
457457
help='Custom key=value to add in application metadata')
458+
ap.add_argument('--launch-intent', dest='launch_intent',
459+
help=('If this is set, an intent will be launched after main.py exits '
460+
'(supports ClassName.class and org.example.com/ActivityName)'))
458461

459462
args = ap.parse_args()
460463

src/src/org/renpy/android/PythonActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ public void run() {
281281
mView.start();
282282
}
283283
});
284+
285+
/* TODO: Add intent launcher here */
284286
}
285287

286288
@Override

src/templates/Configuration.tmpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// Autogenerated file by build.py, don't change!
22

33
package org.renpy.android;
4+
import android.content.Intent;
45

56
public class Configuration {
7+
/* Billing configuration */
68
{% if args.billing_pubkey %}
79
static public boolean use_billing = true;
810
static public String billing_pubkey = "{{ args.billing_pubkey }}";
@@ -11,4 +13,18 @@ public class Configuration {
1113
static public String billing_pubkey = null;
1214
{% endif %}
1315
static public byte billing_salt[] = new byte[] {41, -90, -116, -41, 66, -53, 122, -110, -127, -96, -88, 77, 127, 115, 1, 73, 57, 110, 48, -116};
16+
17+
/* Loader configuration */
18+
{% if args.launch_intent %}
19+
static public boolean use_intent = true;
20+
{% else %}
21+
static public boolean use_intent = false;
22+
{% endif %}
23+
{% if args.launch_intent and args.launch_intent.endswith(".class") %}
24+
static public Intent launch_intent = Intent(this, {{ args.launch_intent }});
25+
{% elif args.launch_intent %}
26+
static public Intent launch_intent = Intent(this, "{{ args.launch_intent }}");
27+
{% else %}
28+
static public Intent launch_intent = null;
29+
{% endif %}
1430
}

0 commit comments

Comments
 (0)
0