diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-17 17:52:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 17:52:55 +0100 |
commit | 3150ef3427c5647b16e5d62ee465cdda745dfb98 (patch) | |
tree | 3f5c5a01b8ecc59836019d2b3a0e2c861e4d0f8e | |
parent | 2db80131f27caa4d9a7e7755d898dd98bf44d5fc (diff) | |
parent | 8f285d93e8562504a91f4bfba7d352a5528bd59e (diff) |
Merge pull request #47104 from m4gr3d/fix_permissions_result_callback
Fix onMainRequestPermissionsResult callback for Android plugins.
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java | 21 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.java | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java index b966cda846..ec2ace4821 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java +++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java @@ -34,6 +34,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; +import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; @@ -69,6 +70,26 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God } } + @CallSuper + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (godotFragment != null) { + godotFragment.onActivityResult(requestCode, resultCode, data); + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + @CallSuper + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + if (godotFragment != null) { + godotFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); + } else { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + } + @Override public void onBackPressed() { if (godotFragment != null) { diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 6da47bb0fe..c601864880 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -195,8 +195,10 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC godotHost = null; } + @CallSuper @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); if (result_callback != null) { result_callback.callback(requestCode, resultCode, data); result_callback = null; @@ -207,8 +209,10 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC } } + @CallSuper @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) { plugin.onMainRequestPermissionsResult(requestCode, permissions, grantResults); } |