diff --git a/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch b/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch index 71d2537e7c..434be4e8ba 100644 --- a/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch +++ b/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch @@ -1,18 +1,19 @@ --- a/src/main/java/org/libsdl/app/SDLActivity.java +++ b/src/main/java/org/libsdl/app/SDLActivity.java -@@ -222,6 +222,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -221,6 +221,8 @@ + // This is what SDL runs in. It invokes SDL_main(), eventually protected static Thread mSDLThread; - -+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + ++ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + protected static SDLGenericMotionListener_API12 getMotionListener() { if (mMotionListener == null) { - if (Build.VERSION.SDK_INT >= 26) { -@@ -324,6 +326,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -323,6 +325,15 @@ + Log.v(TAG, "Model: " + Build.MODEL); Log.v(TAG, "onCreate()"); super.onCreate(savedInstanceState); - ++ + SDLActivity.initialize(); + // So we can call stuff from static callbacks + mSingleton = this; @@ -21,11 +22,10 @@ + // We don't do this in onCreate because we unpack and load the app data on a thread + // and we can't run setup tasks until that thread completes. + protected void finishLoad() { -+ + try { Thread.currentThread().setName("SDLActivity"); - } catch (Exception e) { -@@ -835,7 +846,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -837,7 +848,7 @@ Handler commandHandler = new SDLCommandHandler(); // Send a message from the SDLMain thread @@ -34,28 +34,30 @@ Message msg = commandHandler.obtainMessage(); msg.arg1 = command; msg.obj = data; -@@ -1384,6 +1395,20 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -1385,7 +1396,22 @@ + return null; + } return SDLActivity.mSurface.getNativeSurface(); ++ } ++ ++ /** ++ * Calls turnActive() on singleton to keep loading screen active ++ */ ++ public static void triggerAppConfirmedActive() { ++ mSingleton.appConfirmedActive(); } - -+ /** -+ * Calls turnActive() on singleton to keep loading screen active -+ */ -+ public static void triggerAppConfirmedActive() { -+ mSingleton.appConfirmedActive(); -+ } ++ ++ /** ++ * Trick needed for loading screen, overridden by PythonActivity ++ * to keep loading screen active ++ */ ++ public void appConfirmedActive() { ++ } + -+ /** -+ * Trick needed for loading screen, overridden by PythonActivity -+ * to keep loading screen active -+ */ -+ public void appConfirmedActive() { -+ } -+ + // Input - /** -@@ -1878,6 +1903,7 @@ class SDLMain implements Runnable { +@@ -1881,6 +1907,7 @@ Log.v("SDL", "Running main function " + function + " from library " + library); @@ -63,7 +65,7 @@ SDLActivity.nativeRunMain(library, function, arguments); Log.v("SDL", "Finished main function"); -@@ -1935,8 +1961,7 @@ class DummyEdit extends View implements View.OnKeyListener { +@@ -1938,8 +1965,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); diff --git a/pythonforandroid/recipes/kivy/__init__.py b/pythonforandroid/recipes/kivy/__init__.py index ebf7b29e82..a2dc8798ae 100644 --- a/pythonforandroid/recipes/kivy/__init__.py +++ b/pythonforandroid/recipes/kivy/__init__.py @@ -66,9 +66,10 @@ def get_recipe_env(self, arch): env['USE_SDL2'] = '1' env['KIVY_SPLIT_EXAMPLES'] = '1' sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx) + sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx) env['KIVY_SDL2_PATH'] = ':'.join([ join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'), - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), + *sdl2_image_recipe.get_include_dirs(arch), *sdl2_mixer_recipe.get_include_dirs(arch), join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), ]) diff --git a/pythonforandroid/recipes/pygame/__init__.py b/pythonforandroid/recipes/pygame/__init__.py index 99124deff7..b77240e1b9 100644 --- a/pythonforandroid/recipes/pygame/__init__.py +++ b/pythonforandroid/recipes/pygame/__init__.py @@ -42,13 +42,18 @@ def prebuild_arch(self, arch): for include_dir in sdl2_mixer_recipe.get_include_dirs(arch): sdl_mixer_includes += f"-I{include_dir} " + sdl2_image_includes = "" + sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx) + for include_dir in sdl2_image_recipe.get_include_dirs(arch): + sdl2_image_includes += f"-I{include_dir} " + setup_file = setup_template.format( sdl_includes=( " -I" + join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include') + " -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch)) + " -L" + png_lib_dir + " -L" + jpeg_lib_dir + " -L" + arch.ndk_lib_dir_versioned), sdl_ttf_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), - sdl_image_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), + sdl_image_includes=sdl2_image_includes, sdl_mixer_includes=sdl_mixer_includes, jpeg_includes="-I"+jpeg_inc_dir, png_includes="-I"+png_inc_dir, diff --git a/pythonforandroid/recipes/sdl2_image/__init__.py b/pythonforandroid/recipes/sdl2_image/__init__.py index 85a37f3b5a..ec37c19805 100644 --- a/pythonforandroid/recipes/sdl2_image/__init__.py +++ b/pythonforandroid/recipes/sdl2_image/__init__.py @@ -12,6 +12,11 @@ class LibSDL2Image(BootstrapNDKRecipe): patches = ['enable-webp.patch'] + def get_include_dirs(self, arch): + return [ + os.path.join(self.ctx.bootstrap.build_dir, "jni", "SDL2_image", "include") + ] + def prebuild_arch(self, arch): # We do not have a folder for each arch on BootstrapNDKRecipe, so we # need to skip the external deps download if we already have done it.