Commit 973ccd97 authored by justin's avatar justin

回滚 注册方式

parent 7a6ee43a
......@@ -52,7 +52,7 @@ class BoostRegistrar implements Registrar, FlutterPlugin, ActivityAware {
}
public Context context() {
return this.pluginBinding != null ? this.pluginBinding.getApplicationContext() : null;
return this.pluginBinding != null ? this.pluginBinding.getApplicationContext() : FlutterBoost.instance().platform().getApplication();
}
public Context activeContext() {
......
......@@ -15,6 +15,7 @@ import io.flutter.embedding.engine.FlutterJNI;
import io.flutter.embedding.engine.FlutterShellArgs;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.embedding.engine.loader.FlutterLoader;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.view.FlutterMain;
import java.lang.reflect.Method;
......@@ -33,6 +34,7 @@ public class FlutterBoost {
private long FlutterPostFrameCallTime = 0;
private Application.ActivityLifecycleCallbacks mActivityLifecycleCallbacks;
private PluginRegistry mRegistry;
public long getFlutterPostFrameCallTime() {
return FlutterPostFrameCallTime;
......@@ -323,8 +325,9 @@ public class FlutterBoost {
mPlatform.getApplication().getApplicationContext(), flutterShellArgs.toArray());
mEngine = new FlutterEngine(mPlatform.getApplication().getApplicationContext(),FlutterLoader.getInstance(),new FlutterJNI(),null,false);
registerPlugins(mEngine);
// registerPlugins(mEngine);
mRegistry = new BoostPluginRegistry(createEngine());
mPlatform.registerPlugins(mRegistry);
}
return mEngine;
......
......@@ -49,5 +49,14 @@ public abstract class Platform {
record.getContainer().finishContainer(result);
}
public void registerPlugins(PluginRegistry mRegistry) {
try {
Class clz = Class.forName("io.flutter.plugins.GeneratedPluginRegistrant");
Method method = clz.getDeclaredMethod("registerWith", PluginRegistry.class);
method.invoke(null, mRegistry);
} catch (Throwable t) {
Log.i("flutterboost.platform",t.toString());
}
}
}
......@@ -60,8 +60,8 @@
android:theme="@style/Theme.AppCompat"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:windowSoftInputMode="adjustResize"/>
<meta-data android:name="flutterEmbedding"
android:value="2">
</meta-data>
<!--<meta-data android:name="flutterEmbedding"-->
<!--android:value="2">-->
<!--</meta-data>-->
</application>
</manifest>
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