Commit c8463a14 authored by justin's avatar justin Committed by GitHub

Merge pull request #796 from ymfhcn/dev_shellargs1

support shellArgs
parents abeb415e 331b780b
...@@ -19,7 +19,9 @@ import io.flutter.plugin.common.PluginRegistry; ...@@ -19,7 +19,9 @@ import io.flutter.plugin.common.PluginRegistry;
import io.flutter.view.FlutterMain; import io.flutter.view.FlutterMain;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class FlutterBoost { public class FlutterBoost {
...@@ -214,10 +216,9 @@ public class FlutterBoost { ...@@ -214,10 +216,9 @@ public class FlutterBoost {
private INativeRouter router = null; private INativeRouter router = null;
private BoostLifecycleListener lifecycleListener; private List<String> shellArgs;
private BoostLifecycleListener lifecycleListener;
public ConfigBuilder(Application app, INativeRouter router) { public ConfigBuilder(Application app, INativeRouter router) {
this.router = router; this.router = router;
...@@ -249,12 +250,16 @@ public class FlutterBoost { ...@@ -249,12 +250,16 @@ public class FlutterBoost {
return this; return this;
} }
public ConfigBuilder lifecycleListener(BoostLifecycleListener lifecycleListener) { public ConfigBuilder lifecycleListener(BoostLifecycleListener lifecycleListener) {
this.lifecycleListener = lifecycleListener; this.lifecycleListener = lifecycleListener;
return this; return this;
} }
public ConfigBuilder shellArgs(List<String> shellArgs) {
this.shellArgs = shellArgs;
return this;
}
public Platform build() { public Platform build() {
Platform platform = new Platform() { Platform platform = new Platform() {
...@@ -286,6 +291,10 @@ public class FlutterBoost { ...@@ -286,6 +291,10 @@ public class FlutterBoost {
public FlutterView.RenderMode renderMode() { public FlutterView.RenderMode renderMode() {
return ConfigBuilder.this.renderMode; return ConfigBuilder.this.renderMode;
} }
public List<String> shellArgs() {
return ConfigBuilder.this.shellArgs;
}
}; };
platform.lifecycleListener = this.lifecycleListener; platform.lifecycleListener = this.lifecycleListener;
...@@ -320,7 +329,7 @@ public class FlutterBoost { ...@@ -320,7 +329,7 @@ public class FlutterBoost {
if (mEngine == null) { if (mEngine == null) {
FlutterMain.startInitialization(mPlatform.getApplication()); FlutterMain.startInitialization(mPlatform.getApplication());
FlutterShellArgs flutterShellArgs = new FlutterShellArgs(new String[0]); FlutterShellArgs flutterShellArgs = new FlutterShellArgs(mPlatform.shellArgs() != null ? mPlatform.shellArgs() : Arrays.asList(""));
FlutterMain.ensureInitializationComplete( FlutterMain.ensureInitializationComplete(
mPlatform.getApplication().getApplicationContext(), flutterShellArgs.toArray()); mPlatform.getApplication().getApplicationContext(), flutterShellArgs.toArray());
......
...@@ -6,6 +6,7 @@ import android.util.Log; ...@@ -6,6 +6,7 @@ import android.util.Log;
import com.idlefish.flutterboost.interfaces.IContainerRecord; import com.idlefish.flutterboost.interfaces.IContainerRecord;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List;
import java.util.Map; import java.util.Map;
import io.flutter.embedding.android.FlutterView; import io.flutter.embedding.android.FlutterView;
...@@ -40,8 +41,9 @@ public abstract class Platform { ...@@ -40,8 +41,9 @@ public abstract class Platform {
public abstract String initialRoute(); public abstract String initialRoute();
public FlutterBoost.BoostLifecycleListener lifecycleListener; public abstract List<String> shellArgs();
public FlutterBoost.BoostLifecycleListener lifecycleListener;
public void closeContainer(IContainerRecord record, Map<String, Object> result, Map<String, Object> exts) { public void closeContainer(IContainerRecord record, Map<String, Object> result, Map<String, Object> exts) {
if (record == null) return; if (record == null) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment