@@ -24,23 +24,19 @@ def __init__(self, callback, actions=None, categories=None):
24
24
if not actions and not categories :
25
25
raise Exception ('You need to define at least actions or categories' )
26
26
27
- # resolve actions/categories first
28
- Intent = autoclass ('android.content.Intent' )
29
- resolved_actions = []
30
- if actions :
31
- for x in actions :
32
- name = 'ACTION_{}' .format (x .upper ())
27
+ def _expand_partial_name (partial_name ):
28
+ if '.' in partial_name :
29
+ return partial_name # Its actually a full dotted name
30
+ else :
31
+ name = 'ACTION_{}' .format (partial_name .upper ())
33
32
if not hasattr (Intent , name ):
34
33
raise Exception ('The intent {} doesnt exist' .format (name ))
35
- resolved_actions += [ getattr (Intent , name )]
34
+ return getattr (Intent , name )
36
35
37
- resolved_categories = []
38
- if categories :
39
- for x in categories :
40
- name = 'CATEGORY_{}' .format (x .upper ())
41
- if not hasattr (Intent , name ):
42
- raise Exception ('The intent {} doesnt exist' .format (name ))
43
- resolved_categories += [getattr (Intent , name )]
36
+ # resolve actions/categories first
37
+ Intent = autoclass ('android.content.Intent' )
38
+ resolved_actions = [_expand_partial_name (x ) for x in actions or []]
39
+ resolved_categories = [_expand_partial_name (x ) for x in categories or []]
44
40
45
41
# resolve android API
46
42
PythonActivity = autoclass ('org.renpy.android.PythonActivity' )
0 commit comments