Skip to content

Commit 658b268

Browse files
author
Jonas Thiem
committed
Bump to dev SDL2 for touch fix & extract .java from SDL2 tarball
1 parent e409aeb commit 658b268

File tree

17 files changed

+53
-5156
lines changed

17 files changed

+53
-5156
lines changed

pythonforandroid/bootstrap.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,23 @@ def name(self):
112112
modname = self.__class__.__module__
113113
return modname.split(".", 2)[-1]
114114

115+
def _copy_in_final_files(self):
116+
if self.name == "sdl2":
117+
# Get the paths for copying SDL2's java source code:
118+
sdl2_recipe = Recipe.get_recipe("sdl2", self.ctx)
119+
sdl2_build_dir = sdl2_recipe.get_jni_dir()
120+
src_dir = join(sdl2_build_dir, "SDL", "android-project",
121+
"app", "src", "main", "java",
122+
"org", "libsdl", "app")
123+
target_dir = join(self.dist_dir, 'src', 'main', 'java', 'org',
124+
'libsdl', 'app')
125+
126+
# Do actual copying:
127+
info('Copying in SDL2 .java files from: ' + str(src_dir))
128+
if not os.path.exists(target_dir):
129+
os.makedirs(target_dir)
130+
copy_files(src_dir, target_dir, override=True)
131+
115132
def prepare_build_dir(self):
116133
'''Ensure that a build dir exists for the recipe. This same single
117134
dir will be used for building all different archs.'''
@@ -134,7 +151,12 @@ def prepare_build_dir(self):
134151
def prepare_dist_dir(self, name):
135152
ensure_dir(self.dist_dir)
136153

137-
def run_distribute(self):
154+
def assemble_distribution(self):
155+
''' Copies all the files into the distribution (this function is
156+
overridden by the specific bootstrap classes to do this)
157+
and add in the distribution info.
158+
'''
159+
self._copy_in_final_files()
138160
self.distribution.save_info(self.dist_dir)
139161

140162
@classmethod

pythonforandroid/bootstraps/empty/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class EmptyBootstrap(Bootstrap):
88

99
can_be_chosen_automatically = False
1010

11-
def run_distribute(self):
11+
def assemble_distribution(self):
1212
print('empty bootstrap has no distribute')
1313
exit(1)
1414

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SDL2GradleBootstrap(Bootstrap):
1212
set(Bootstrap.recipe_depends).union({'sdl2'})
1313
)
1414

15-
def run_distribute(self):
15+
def assemble_distribution(self):
1616
info_main("# Creating Android project ({})".format(self.name))
1717

1818
arch = self.ctx.archs[0]
@@ -49,7 +49,7 @@ def run_distribute(self):
4949

5050
self.strip_libraries(arch)
5151
self.fry_eggs(site_packages_dir)
52-
super(SDL2GradleBootstrap, self).run_distribute()
52+
super(SDL2GradleBootstrap, self).assemble_distribution()
5353

5454

5555
bootstrap = SDL2GradleBootstrap()

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ public void considerLoadingScreenRemoval() {
425425
return;
426426
runOnUiThread(new Runnable() {
427427
public void run() {
428-
if (((PythonActivity)PythonActivity.mSingleton).mAppConfirmedActive &&
428+
if (((PythonActivity)PythonActivity.mSingleton) != null &&
429+
((PythonActivity)PythonActivity.mSingleton).mAppConfirmedActive &&
429430
loadingScreenRemovalTimer == null) {
430431
// Remove loading screen but with a delay.
431432
// (app can use p4a's android.loadingscreen module to
@@ -568,6 +569,7 @@ protected void onResume() {
568569
} catch (UnsatisfiedLinkError e) {
569570
// Catch resume while still in loading screen failing to
570571
// call native function (since it's not yet loaded)
572+
return; // no point in barging further
571573
}
572574
considerLoadingScreenRemoval();
573575
}
@@ -579,6 +581,7 @@ public void onWindowFocusChanged(boolean hasFocus) {
579581
} catch (UnsatisfiedLinkError e) {
580582
// Catch window focus while still in loading screen failing to
581583
// call native function (since it's not yet loaded)
584+
return; // no point in barging further
582585
}
583586
considerLoadingScreenRemoval();
584587
}

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/libsdl/app/HIDDevice.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)