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
2a03cb50
Commit
2a03cb50
authored
Oct 22, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/flutter_1.9_upgrade' into feature/flutter_1.9_androidx_upgrade
parents
47732cda
76beb384
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
80 deletions
+32
-80
android/src/main/java/com/idlefish/flutterboost/BoostPluginRegistry.java
...n/java/com/idlefish/flutterboost/BoostPluginRegistry.java
+12
-9
android/src/main/java/com/idlefish/flutterboost/NewFlutterBoost.java
.../main/java/com/idlefish/flutterboost/NewFlutterBoost.java
+14
-12
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
...src/main/java/com/idlefish/flutterboost/XFlutterView.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+1
-17
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
...m/idlefish/flutterboost/containers/FlutterSplashView.java
+4
-1
android/src/main/java/com/idlefish/flutterboost/containers/NewBoostFlutterActivity.java
...fish/flutterboost/containers/NewBoostFlutterActivity.java
+0
-8
android/src/main/java/com/idlefish/flutterboost/containers/NewFlutterFragment.java
.../idlefish/flutterboost/containers/NewFlutterFragment.java
+0
-32
No files found.
android/src/main/java/com/idlefish/flutterboost/BoostPluginRegistry.java
View file @
2a03cb50
...
...
@@ -2,9 +2,11 @@ package com.idlefish.flutterboost;
import
android.app.Activity
;
import
android.content.Context
;
import
android.support.annotation.Nullable
;
import
com.idlefish.flutterboost.interfaces.IContainerRecord
;
import
io.flutter.app.FlutterPluginRegistry
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry
;
import
io.flutter.plugin.common.BinaryMessenger
;
import
io.flutter.plugin.common.PluginRegistry
;
import
io.flutter.plugin.platform.PlatformViewRegistry
;
...
...
@@ -13,23 +15,24 @@ import io.flutter.view.TextureRegistry;
import
java.lang.ref.WeakReference
;
public
class
BoostPluginRegistry
extends
Flutter
PluginRegistry
{
public
class
BoostPluginRegistry
extends
Shim
PluginRegistry
{
protected
WeakReference
<
Activity
>
mCurrentActivityRef
;
private
FlutterEngine
mEngine
;
private
Context
mContext
;
public
BoostPluginRegistry
(
FlutterEngine
engine
,
Context
context
)
{
super
(
engine
,
context
);
super
(
engine
);
mEngine
=
engine
;
mContext
=
context
;
}
public
PluginRegistry
.
Registrar
registrarFor
(
String
pluginKey
)
{
return
new
BoostRegistrar
(
mEngine
,
super
.
registrarFor
(
pluginKey
));
}
public
void
currentActivity
(
@Nullable
Activity
activity
)
{
mCurrentActivityRef
=
new
WeakReference
<>(
activity
);
}
public
class
BoostRegistrar
implements
PluginRegistry
.
Registrar
{
...
...
@@ -70,12 +73,12 @@ public class BoostPluginRegistry extends FlutterPluginRegistry {
@Override
public
Context
context
()
{
return
mRegistrar
.
context
()
;
return
BoostPluginRegistry
.
this
.
mContext
;
}
@Override
public
Context
activeContext
()
{
return
mRegistrar
.
activeContext
()
;
return
BoostPluginRegistry
.
this
.
mContext
;
}
@Override
...
...
@@ -90,7 +93,7 @@ public class BoostPluginRegistry extends FlutterPluginRegistry {
@Override
public
PlatformViewRegistry
platformViewRegistry
()
{
return
m
Registrar
.
platformView
Registry
();
return
m
Engine
.
getPlatformViewsController
().
get
Registry
();
}
@Override
...
...
android/src/main/java/com/idlefish/flutterboost/NewFlutterBoost.java
View file @
2a03cb50
...
...
@@ -23,7 +23,7 @@ public class NewFlutterBoost {
private
FlutterViewContainerManager
mManager
;
private
Activity
mCurrentActiveActivity
;
private
BoostPluginRegistry
mRegistry
;
static
NewFlutterBoost
sInstance
=
null
;
...
...
@@ -40,10 +40,9 @@ public class NewFlutterBoost {
mPlatform
=
platform
;
mManager
=
new
FlutterViewContainerManager
();
if
(
mPlatform
.
whenEngineStart
()
==
ConfigBuilder
.
IMMEDIATELY
)
{
doInitialFlutterViewRun
(
mPlatform
);
}
mRegistry
=
new
BoostPluginRegistry
(
this
.
engineProvider
(),
mPlatform
.
getApplication
());
platform
.
getApplication
().
registerActivityLifecycleCallbacks
(
new
Application
.
ActivityLifecycleCallbacks
()
{
...
...
@@ -53,8 +52,8 @@ public class NewFlutterBoost {
if
(
mPlatform
.
whenEngineStart
()
==
ConfigBuilder
.
ANY_ACTIVITY_CREATED
)
{
Log
.
e
(
"bbbb2"
,
"xxxxx"
);
doInitialFlutterViewRun
(
mPlatform
);
mRegistry
.
currentActivity
(
activity
);
doInitialFlutterViewRun
(
mPlatform
,
mRegistry
);
}
}
...
...
@@ -116,15 +115,16 @@ public class NewFlutterBoost {
}
});
if
(
mPlatform
.
whenEngineStart
()
==
ConfigBuilder
.
IMMEDIATELY
)
{
doInitialFlutterViewRun
(
mPlatform
,
mRegistry
);
}
BoostPluginRegistry
registry
=
new
BoostPluginRegistry
(
this
.
engineProvider
(),
mPlatform
.
getApplication
());
mPlatform
.
registerPlugins
(
registry
);
}
private
void
doInitialFlutterViewRun
(
Platform
platform
)
{
private
void
doInitialFlutterViewRun
(
Platform
platform
,
BoostPluginRegistry
registry
)
{
// Don't attempt to start a FlutterEngine if we're using a cached FlutterEngine.
// if (host.getCachedEngineId() != null) {
// return;
...
...
@@ -137,8 +137,8 @@ public class NewFlutterBoost {
// So this is expected behavior in many cases.
return
;
}
platform
.
registerPlugins
(
registry
);
Log
.
e
(
"bbbb3"
,
"xxxxx"
);
// The engine needs to receive the Flutter app's initial route before executing any
// Dart code to ensure that the initial route arrives in time to be applied.
if
(
platform
.
initialRoute
()
!=
null
)
{
...
...
@@ -268,5 +268,7 @@ public class NewFlutterBoost {
return
mManager
.
findContainerById
(
id
);
}
public
BoostPluginRegistry
getPluginRegistry
(){
return
mRegistry
;
}
}
android/src/main/java/com/idlefish/flutterboost/XFlutterView.java
View file @
2a03cb50
...
...
@@ -686,7 +686,7 @@ public class XFlutterView extends FrameLayout {
resolveMemoryLeaks
();
// Instruct our FlutterRenderer that we are no longer interested in being its RenderSurface.
FlutterRenderer
flutterRenderer
=
flutterEngine
.
getRenderer
();
didRenderFirstFrame
=
false
;
//
didRenderFirstFrame = false;
flutterRenderer
.
removeOnFirstFrameRenderedListener
(
onFirstFrameRenderedListener
);
flutterRenderer
.
detachFromRenderSurface
();
flutterEngine
=
null
;
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
2a03cb50
...
...
@@ -28,7 +28,6 @@ import io.flutter.app.FlutterActivity;
import
io.flutter.embedding.android.*
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.view.FlutterMain
;
...
...
@@ -56,15 +55,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
protected
IOperateSyncer
mSyncer
;
@NonNull
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
@Override
public
void
onFirstFrameRendered
()
{
if
(
host
!=
null
){
host
.
onFirstFrameRendered
();
}
}
};
FlutterActivityAndFragmentDelegate
(
@NonNull
Host
host
)
{
this
.
host
=
host
;
...
...
@@ -171,7 +162,6 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
ensureAlive
();
flutterView
=
new
XFlutterView
(
host
.
getActivity
(),
NewFlutterBoost
.
instance
().
platform
().
renderMode
(),
host
.
getTransparencyMode
());
flutterView
.
addOnFirstFrameRenderedListener
(
onFirstFrameRenderedListener
);
flutterSplashView
=
new
FlutterSplashView
(
host
.
getContext
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
...
...
@@ -247,7 +237,6 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
mSyncer
.
onDestroy
();
ensureAlive
();
flutterView
.
removeOnFirstFrameRenderedListener
(
onFirstFrameRenderedListener
);
}
...
...
@@ -512,11 +501,6 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContaine
*/
boolean
shouldAttachEngineToActivity
();
/**
* Invoked by this delegate when its {@link FlutterView} has rendered its first Flutter
* frame.
*/
void
onFirstFrameRendered
();
void
finishContainer
(
Map
<
String
,
Object
>
result
)
;
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterSplashView.java
View file @
2a03cb50
...
...
@@ -39,6 +39,8 @@ public class FlutterSplashView extends FrameLayout {
@Nullable
private
String
previousCompletedSplashIsolate
;
private
boolean
hasRendered
=
false
;
@NonNull
private
final
FlutterView
.
FlutterEngineAttachmentListener
flutterEngineAttachmentListener
=
new
FlutterView
.
FlutterEngineAttachmentListener
()
{
@Override
...
...
@@ -57,8 +59,9 @@ public class FlutterSplashView extends FrameLayout {
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
@Override
public
void
onFirstFrameRendered
()
{
if
(
splashScreen
!=
null
)
{
if
(
splashScreen
!=
null
&&!
hasRendered
)
{
transitionToFlutter
();
hasRendered
=
true
;
}
}
};
...
...
android/src/main/java/com/idlefish/flutterboost/containers/NewBoostFlutterActivity.java
View file @
2a03cb50
...
...
@@ -466,14 +466,6 @@ public class NewBoostFlutterActivity extends Activity
return
true
;
}
@Override
public
void
onFirstFrameRendered
()
{
}
...
...
android/src/main/java/com/idlefish/flutterboost/containers/NewFlutterFragment.java
View file @
2a03cb50
...
...
@@ -232,20 +232,6 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
// implementation for details about why it exists.
private
FlutterActivityAndFragmentDelegate
delegate
;
private
final
OnFirstFrameRenderedListener
onFirstFrameRenderedListener
=
new
OnFirstFrameRenderedListener
()
{
@Override
public
void
onFirstFrameRendered
()
{
// Notify our subclasses that the first frame has been rendered.
NewFlutterFragment
.
this
.
onFirstFrameRendered
();
// Notify our owning Activity that the first frame has been rendered.
FragmentActivity
fragmentActivity
=
getActivity
();
if
(
fragmentActivity
instanceof
OnFirstFrameRenderedListener
)
{
OnFirstFrameRenderedListener
activityAsListener
=
(
OnFirstFrameRenderedListener
)
fragmentActivity
;
activityAsListener
.
onFirstFrameRendered
();
}
}
};
public
NewFlutterFragment
()
{
// Ensure that we at least have an empty Bundle of arguments so that we don't
...
...
@@ -502,24 +488,6 @@ public class NewFlutterFragment extends Fragment implements FlutterActivityAndFr
return
getArguments
().
getBoolean
(
ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY
);
}
/**
* Invoked after the {@link FlutterView} within this {@code NewFlutterFragment} renders its first
* frame.
* <p>
* This method forwards {@code onFirstFrameRendered()} to its attached {@code Activity}, if
* the attached {@code Activity} implements {@link OnFirstFrameRenderedListener}.
* <p>
* Subclasses that override this method must call through to the {@code super} method.
* <p>
* Used by this {@code NewFlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host}
*/
@Override
public
void
onFirstFrameRendered
()
{
FragmentActivity
attachedActivity
=
getActivity
();
if
(
attachedActivity
instanceof
OnFirstFrameRenderedListener
)
{
((
OnFirstFrameRenderedListener
)
attachedActivity
).
onFirstFrameRendered
();
}
}
@Override
public
void
finishContainer
(
Map
<
String
,
Object
>
result
)
{
...
...
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