Skip to content

Separate android initialization from Activity #11891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions android-project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ android {
lint {
abortOnError false
}
compileOptions {
// our minSdk, lollipop (API 21) uses java 7
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion android-project/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# public *;
#}

-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity {
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivityComponent {
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
java.lang.String clipboardGetText();
boolean clipboardHasText();
Expand Down
15 changes: 15 additions & 0 deletions android-project/app/src/main/java/org/libsdl/app/ActivityHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.libsdl.app;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Marker annotation for {@link SDLActivityComponent} methods that correspond to
* events in {@link android.app.Activity}.
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.METHOD)
public @interface ActivityHook {
}
4 changes: 2 additions & 2 deletions android-project/app/src/main/java/org/libsdl/app/SDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SDL {
// This function should be called first and sets up the native code
// so it can call into the Java classes
public static void setupJNI() {
SDLActivity.nativeSetupJNI();
SDLActivityComponent.nativeSetupJNI();
SDLAudioManager.nativeSetupJNI();
SDLControllerManager.nativeSetupJNI();
}
Expand All @@ -22,7 +22,7 @@ public static void setupJNI() {
public static void initialize() {
setContext(null);

SDLActivity.initialize();
SDLActivityComponent.initialize();
SDLAudioManager.initialize();
SDLControllerManager.initialize();
}
Expand Down
Loading
Loading