未验证 提交 5e33f33a 编写于 作者: S Stanislav Baranov 提交者: GitHub

Refactor shared code into separate function to simplify further work. (#7410)

This should be a no-op change that behaves identical to as before.
上级 937ee8bf
......@@ -167,19 +167,9 @@ public final class FlutterActivityDelegate
return;
}
if (!flutterView.getFlutterNativeView().isApplicationRunning()) {
String appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
if (appBundlePath != null) {
FlutterRunArguments arguments = new FlutterRunArguments();
ArrayList<String> bundlePaths = new ArrayList<>();
if (FlutterMain.getUpdateInstallationPath() != null) {
bundlePaths.add(FlutterMain.getUpdateInstallationPath());
}
bundlePaths.add(appBundlePath);
arguments.bundlePaths = bundlePaths.toArray(new String[0]);
arguments.entrypoint = "main";
flutterView.runFromBundle(arguments);
}
String appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
if (appBundlePath != null) {
runBundle(appBundlePath);
}
}
......@@ -335,30 +325,34 @@ public final class FlutterActivityDelegate
String route = intent.getStringExtra("route");
String appBundlePath = intent.getDataString();
if (appBundlePath == null) {
// Fall back to the installation path if no bundle path
// was specified.
// Fall back to the installation path if no bundle path was specified.
appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
}
if (route != null) {
flutterView.setInitialRoute(route);
}
if (!flutterView.getFlutterNativeView().isApplicationRunning()) {
FlutterRunArguments args = new FlutterRunArguments();
ArrayList<String> bundlePaths = new ArrayList<>();
if (FlutterMain.getUpdateInstallationPath() != null) {
bundlePaths.add(FlutterMain.getUpdateInstallationPath());
}
bundlePaths.add(appBundlePath);
args.bundlePaths = bundlePaths.toArray(new String[0]);
args.entrypoint = "main";
flutterView.runFromBundle(args);
}
runBundle(appBundlePath);
return true;
}
return false;
}
private void runBundle(String appBundlePath) {
if (!flutterView.getFlutterNativeView().isApplicationRunning()) {
FlutterRunArguments args = new FlutterRunArguments();
ArrayList<String> bundlePaths = new ArrayList<>();
if (FlutterMain.getUpdateInstallationPath() != null) {
bundlePaths.add(FlutterMain.getUpdateInstallationPath());
}
bundlePaths.add(appBundlePath);
args.bundlePaths = bundlePaths.toArray(new String[0]);
args.entrypoint = "main";
flutterView.runFromBundle(args);
}
}
/**
* Creates a {@link View} containing the same {@link Drawable} as the one set as the
* {@code windowBackground} of the parent activity for use as a launch splash view.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册