Last active
April 17, 2019 02:10
-
-
Save truongsinh/bf0d483da12cdad9c657b9e1129c7ff1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt step/06app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
index f2a07a4..6819729 100644 | |
--- step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
+++ step/06app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
@@ -18,12 +24,92 @@ class FlutterEmbeddingActivity : FlutterActivity(), FlutterFragment.FlutterEngin | |
private class IntentBuilder// Override the constructor to specify your class. | |
internal constructor() : FlutterActivity.IntentBuilder(FlutterEmbeddingActivity::class.java) | |
+ private fun createPluginRegistry(messenger: BinaryMessenger, activity: Activity): PluginRegistry { | |
+ return object : PluginRegistry { | |
+ override fun registrarFor(s: String): PluginRegistry.Registrar { | |
+ return object : PluginRegistry.Registrar { | |
+ override fun activity(): Activity { | |
+ return activity | |
+ } | |
+ | |
+ override fun context(): Context { | |
+ return activity | |
+ } | |
+ | |
+ override fun activeContext(): Context { | |
+ return activity | |
+ } | |
+ | |
+ override fun messenger(): BinaryMessenger { | |
+ return messenger | |
+ } | |
+ | |
+ override fun textures(): TextureRegistry? { | |
+ return null | |
+ } | |
+ | |
+ override fun platformViewRegistry(): PlatformViewRegistry? { | |
+ return null | |
+ } | |
+ | |
+ override fun view(): io.flutter.view.FlutterView? { | |
+ return null | |
+ } | |
+ | |
+ override fun lookupKeyForAsset(s: String): String? { | |
+ return null | |
+ } | |
+ | |
+ override fun lookupKeyForAsset(s: String, s1: String): String? { | |
+ return null | |
+ } | |
+ | |
+ override fun publish(o: Any): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ | |
+ override fun addRequestPermissionsResultListener(requestPermissionsResultListener: PluginRegistry.RequestPermissionsResultListener): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ | |
+ override fun addActivityResultListener(activityResultListener: PluginRegistry.ActivityResultListener): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ | |
+ override fun addNewIntentListener(newIntentListener: PluginRegistry.NewIntentListener): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ | |
+ override fun addUserLeaveHintListener(userLeaveHintListener: PluginRegistry.UserLeaveHintListener): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ | |
+ override fun addViewDestroyListener(viewDestroyListener: PluginRegistry.ViewDestroyListener): PluginRegistry.Registrar { | |
+ return this | |
+ } | |
+ } | |
+ } | |
+ | |
+ override fun hasPlugin(s: String): Boolean { | |
+ return false | |
+ } | |
+ | |
+ override fun <T> valuePublishedByPlugin(s: String): T? { | |
+ return null | |
+ } | |
+ } | |
+ } | |
+ | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
init(this) | |
val intentExtras = intent.extras.keySet().associateBy({it}, {intent.extras.get(it)}) | |
eventChannelSink?.success(intentExtras) | |
+ GeneratedPluginRegistrant.registerWith(createPluginRegistry(cachedFlutterEngine.dartExecutor, this)) | |
+ | |
MethodChannel(cachedFlutterEngine.dartExecutor, METHOD_CHANNEL_NAME).setMethodCallHandler { call, result -> | |
when { | |
call.method == "navigatorPop" -> { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment