Skip to content

Commit

Permalink
Separate android initialization from Activity (#11891)
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander authored Jan 10, 2025
1 parent c64197b commit d14c93c
Show file tree
Hide file tree
Showing 16 changed files with 2,317 additions and 2,154 deletions.
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

0 comments on commit d14c93c

Please sign in to comment.