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

This commit is contained in:
Sylvain 2021-10-13 08:35:56 +02:00
parent 0e294e90ae
commit 325ae5c35d
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
1 changed files with 3 additions and 2 deletions

View File

@ -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: