You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Activity.startActivityForResult(): use internalCreateActivity helper method
This commit is contained in:
@@ -321,11 +321,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
Slog.i(TAG, "startActivityForResult(" + intent + ", " + requestCode + "," + options + ") called");
|
Slog.i(TAG, "startActivityForResult(" + intent + ", " + requestCode + "," + options + ") called");
|
||||||
if (intent.getComponent() != null) {
|
if (intent.getComponent() != null) {
|
||||||
try {
|
try {
|
||||||
Class<? extends Activity> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Activity.class);
|
final Activity activity = internalCreateActivity(intent.getComponent().getClassName(), getWindow().native_window, intent);
|
||||||
Constructor<? extends Activity> constructor = cls.getConstructor();
|
|
||||||
final Activity activity = constructor.newInstance();
|
|
||||||
activity.intent = intent;
|
|
||||||
activity.getWindow().native_window = getWindow().native_window;
|
|
||||||
activity.resultRequestCode = requestCode;
|
activity.resultRequestCode = requestCode;
|
||||||
activity.resultActivity = this;
|
activity.resultActivity = this;
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@@ -334,7 +330,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
nativeStartActivity(activity);
|
nativeStartActivity(activity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent());
|
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent());
|
||||||
}
|
}
|
||||||
} else if (FILE_CHOOSER_ACTIONS.contains(intent.getAction())) {
|
} else if (FILE_CHOOSER_ACTIONS.contains(intent.getAction())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user