Fix onMainRequestPermissionsResult callback for Android plugins.
This commit is contained in:
parent
5d8ae492ba
commit
14e7f6fa7c
2 changed files with 25 additions and 0 deletions
|
@ -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;
|
||||
|
@ -70,6 +71,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) {
|
||||
|
|
|
@ -287,8 +287,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;
|
||||
|
@ -303,8 +305,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 (int i = 0; i < singleton_count; i++) {
|
||||
singletons[i].onMainRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue