|
|
@@ -1,25 +1,35 @@
|
|
|
package com.atmob.keyboard
|
|
|
|
|
|
+import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.os.Handler
|
|
|
import android.os.Looper
|
|
|
+import com.atmob.keyboard.config.AppConfig
|
|
|
import com.atmob.keyboard.util.JumpAppPageUtil
|
|
|
import io.flutter.embedding.android.FlutterActivity
|
|
|
import io.flutter.embedding.engine.FlutterEngine
|
|
|
+import io.flutter.embedding.engine.FlutterEngineCache
|
|
|
|
|
|
class MainActivity : FlutterActivity() {
|
|
|
private val mMainHandler = Handler(Looper.getMainLooper())
|
|
|
|
|
|
+ /**
|
|
|
+ * 使用预缓存的引擎
|
|
|
+ */
|
|
|
+ override fun provideFlutterEngine(context: Context): FlutterEngine? {
|
|
|
+ return FlutterEngineCache.getInstance().get(AppConfig.FLUTTER_ENGINE_ID)
|
|
|
+ }
|
|
|
+
|
|
|
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
|
|
super.configureFlutterEngine(flutterEngine)
|
|
|
- mMainHandler.postDelayed({
|
|
|
- JumpAppPageUtil.jumpAppPage(intent, flutterEngine)
|
|
|
- }, 150)
|
|
|
+ // 执行路由跳转
|
|
|
+ JumpAppPageUtil.jumpAppPage(intent, flutterEngine)
|
|
|
}
|
|
|
|
|
|
override fun onNewIntent(intent: Intent) {
|
|
|
super.onNewIntent(intent)
|
|
|
setIntent(intent)
|
|
|
+ // 执行路由跳转
|
|
|
flutterEngine?.let {
|
|
|
JumpAppPageUtil.jumpAppPage(intent, it)
|
|
|
}
|