Commit 325ae5c35d28ffc059dd91d7a94bcf62494debb3

Sylvain 2021-10-13T08:35:56

Android: getCurrentOrientation uses getContext() to retrieve the activity (see bug #4825)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index d71363f..f850b0a 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -381,10 +381,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
     public static int getCurrentOrientation() {
         int result = SDL_ORIENTATION_UNKNOWN;
 
-        if (mSingleton == null) {
+        Activity activity = (Activity)getContext();
+        if (activity == null) {
             return result;
         }
-        Display display = SDLActivity.mSingleton.getWindowManager().getDefaultDisplay();
+        Display display = activity.getWindowManager().getDefaultDisplay();
 
         switch (display.getRotation()) {
             case Surface.ROTATION_0: