Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_boost_1.22.4
Commits
dd9d72e5
Commit
dd9d72e5
authored
Nov 11, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复FLUTTER_ACTIVITY_CREATED 模式下的问题
parent
0d019c12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
7 deletions
+70
-7
android/src/main/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
...in/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
+5
-4
android/src/main/java/com/idlefish/flutterboost/NewFlutterBoost.java
.../main/java/com/idlefish/flutterboost/NewFlutterBoost.java
+9
-0
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
...m/idlefish/flutterboost/containers/FlutterSplashView.java
+35
-3
lib/flutter_boost.dart
lib/flutter_boost.dart
+21
-0
No files found.
android/src/main/java/com/idlefish/flutterboost/FlutterBoostPlugin.java
View file @
dd9d72e5
package
com.idlefish.flutterboost
;
package
com.idlefish.flutterboost
;
import
android.os.Handler
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.MethodChannel
;
...
@@ -217,6 +215,9 @@ public class FlutterBoostPlugin {
...
@@ -217,6 +215,9 @@ public class FlutterBoostPlugin {
}
}
result
.
success
(
pageInfo
);
result
.
success
(
pageInfo
);
NewFlutterBoost
.
instance
().
setFlutterPostFrameCallTime
(
new
Date
().
getTime
());
}
catch
(
Throwable
t
)
{
}
catch
(
Throwable
t
)
{
result
.
error
(
"no flutter page found!"
,
t
.
getMessage
(),
t
);
result
.
error
(
"no flutter page found!"
,
t
.
getMessage
(),
t
);
}
}
...
...
android/src/main/java/com/idlefish/flutterboost/NewFlutterBoost.java
View file @
dd9d72e5
...
@@ -31,6 +31,15 @@ public class NewFlutterBoost {
...
@@ -31,6 +31,15 @@ public class NewFlutterBoost {
private
PluginRegistry
mRegistry
;
private
PluginRegistry
mRegistry
;
static
NewFlutterBoost
sInstance
=
null
;
static
NewFlutterBoost
sInstance
=
null
;
private
long
FlutterPostFrameCallTime
=
0
;
public
long
getFlutterPostFrameCallTime
(){
return
FlutterPostFrameCallTime
;
}
public
void
setFlutterPostFrameCallTime
(
long
FlutterPostFrameCallTime
){
this
.
FlutterPostFrameCallTime
=
FlutterPostFrameCallTime
;
}
public
static
NewFlutterBoost
instance
()
{
public
static
NewFlutterBoost
instance
()
{
if
(
sInstance
==
null
)
{
if
(
sInstance
==
null
)
{
sInstance
=
new
NewFlutterBoost
();
sInstance
=
new
NewFlutterBoost
();
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
View file @
dd9d72e5
...
@@ -3,6 +3,7 @@ package com.idlefish.flutterboost.containers;
...
@@ -3,6 +3,7 @@ package com.idlefish.flutterboost.containers;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Parcel
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
...
@@ -18,6 +19,8 @@ import io.flutter.embedding.android.SplashScreen;
...
@@ -18,6 +19,8 @@ import io.flutter.embedding.android.SplashScreen;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
java.util.Date
;
/**
/**
* {@code View} that displays a {@link SplashScreen} until a given {@link FlutterView}
* {@code View} that displays a {@link SplashScreen} until a given {@link FlutterView}
* renders its first frame.
* renders its first frame.
...
@@ -39,7 +42,7 @@ public class FlutterSplashView extends FrameLayout {
...
@@ -39,7 +42,7 @@ public class FlutterSplashView extends FrameLayout {
@Nullable
@Nullable
private
String
previousCompletedSplashIsolate
;
private
String
previousCompletedSplashIsolate
;
private
boolean
hasRendered
=
false
;
private
Handler
handler
=
new
Handler
()
;
@NonNull
@NonNull
private
final
FlutterView
.
FlutterEngineAttachmentListener
flutterEngineAttachmentListener
=
new
FlutterView
.
FlutterEngineAttachmentListener
()
{
private
final
FlutterView
.
FlutterEngineAttachmentListener
flutterEngineAttachmentListener
=
new
FlutterView
.
FlutterEngineAttachmentListener
()
{
...
@@ -57,11 +60,40 @@ public class FlutterSplashView extends FrameLayout {
...
@@ -57,11 +60,40 @@ public class FlutterSplashView extends FrameLayout {
@NonNull
@NonNull
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
int
i
=
0
;
@Override
@Override
public
void
onFirstFrameRendered
()
{
public
void
onFirstFrameRendered
()
{
if
(
splashScreen
!=
null
)
{
transitionToFlutter
();
if
(
NewFlutterBoost
.
instance
().
platform
().
whenEngineStart
()==
NewFlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
){
long
now
=
new
Date
().
getTime
();
long
flutterPostFrameCallTime
=
NewFlutterBoost
.
instance
().
getFlutterPostFrameCallTime
();
if
(
flutterPostFrameCallTime
!=
0
&&
(
now
-
flutterPostFrameCallTime
)>
800
){
if
(
splashScreen
!=
null
)
{
transitionToFlutter
();
}
return
;
}
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
onFirstFrameRenderedListener
.
onFirstFrameRendered
();
}
},
200
);
}
else
{
if
(
splashScreen
!=
null
)
{
transitionToFlutter
();
}
}
}
}
}
};
};
...
...
lib/flutter_boost.dart
View file @
dd9d72e5
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'container/boost_container.dart'
;
import
'container/boost_container.dart'
;
...
@@ -60,6 +61,26 @@ class FlutterBoost {
...
@@ -60,6 +61,26 @@ class FlutterBoost {
PrePushRoute
prePush
,
PrePushRoute
prePush
,
PostPushRoute
postPush
})
{
PostPushRoute
postPush
})
{
if
(
Platform
.
isAndroid
){
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
){
singleton
.
channel
.
invokeMethod
<
Map
>(
'pageOnStart'
).
then
((
Map
pageInfo
){
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
if
(
pageInfo
.
containsKey
(
"name"
)
&&
pageInfo
.
containsKey
(
"params"
)
&&
pageInfo
.
containsKey
(
"uniqueId"
))
{
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
pageInfo
[
"name"
],
pageInfo
[
"params"
],
pageInfo
[
"uniqueId"
]);
}
});
});
}
return
(
BuildContext
context
,
Widget
child
)
{
return
(
BuildContext
context
,
Widget
child
)
{
assert
(
child
is
Navigator
,
'child must be Navigator, what is wrong?'
);
assert
(
child
is
Navigator
,
'child must be Navigator, what is wrong?'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment