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
0
Merge Requests
0
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
698e6a73
Commit
698e6a73
authored
Apr 22, 2020
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决泄漏问题
parent
126c10cc
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
342 additions
and
31 deletions
+342
-31
android/build.gradle
android/build.gradle
+1
-1
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
.../main/java/com/idlefish/flutterboost/XPlatformPlugin.java
+311
-0
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
...dlefish/flutterboost/containers/BoostFlutterActivity.java
+3
-6
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+23
-18
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
...com/idlefish/flutterboost/containers/FlutterFragment.java
+4
-6
No files found.
android/build.gradle
View file @
698e6a73
...
...
@@ -22,7 +22,7 @@ rootProject.allprojects {
apply
plugin:
'com.android.library'
android
{
compileSdkVersion
2
8
compileSdkVersion
2
9
buildToolsVersion
'28.0.3'
defaultConfig
{
minSdkVersion
16
...
...
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
0 → 100644
View file @
698e6a73
This diff is collapsed.
Click to expand it.
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
View file @
698e6a73
...
...
@@ -21,6 +21,7 @@ import android.view.*;
import
android.widget.*
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
import
io.flutter.Log
;
import
io.flutter.embedding.android.DrawableSplashScreen
;
import
io.flutter.embedding.android.FlutterView
;
...
...
@@ -439,12 +440,8 @@ public class BoostFlutterActivity extends Activity
@Nullable
@Override
public
PlatformPlugin
providePlatformPlugin
(
@Nullable
Activity
activity
,
@NonNull
FlutterEngine
flutterEngine
)
{
if
(
activity
!=
null
)
{
return
new
PlatformPlugin
(
getActivity
(),
flutterEngine
.
getPlatformChannel
());
}
else
{
return
null
;
}
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
return
new
XPlatformPlugin
(
flutterEngine
.
getPlatformChannel
());
}
/**
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
698e6a73
...
...
@@ -23,6 +23,7 @@ import java.util.Map;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
io.flutter.Log
;
...
...
@@ -30,6 +31,7 @@ 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.plugins.activity.ActivityControlSurface
;
import
io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
;
import
io.flutter.plugin.platform.PlatformPlugin
;
...
...
@@ -39,7 +41,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
private
static
final
String
TAG
=
"FlutterActivityAndFragmentDelegate"
;
private
static
int
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
=
0
;
@NonNull
private
Host
host
;
@Nullable
...
...
@@ -49,7 +51,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
@Nullable
private
XFlutterView
flutterView
;
@Nullable
private
PlatformPlugin
platformPlugin
;
private
X
PlatformPlugin
platformPlugin
;
private
boolean
isFlutterEngineFromHost
;
...
...
@@ -95,7 +97,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
// TODO(mattcarroll): the PlatformPlugin needs to be reimagined because it implicitly takes
// control of the entire window. This is unacceptable for non-fullscreen
// use-cases.
platformPlugin
=
host
.
providePlatformPlugin
(
host
.
getActivity
(),
flutterEngine
);
platformPlugin
=
host
.
providePlatformPlugin
(
flutterEngine
);
host
.
configureFlutterEngine
(
flutterEngine
);
...
...
@@ -129,13 +131,6 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
Log
.
v
(
TAG
,
"Creating FlutterView."
);
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
host
.
getActivity
(),
host
.
getLifecycle
()
);
mSyncer
=
FlutterBoost
.
instance
().
containerManager
().
generateSyncer
(
this
);
ensureAlive
();
...
...
@@ -176,13 +171,19 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
Log
.
v
(
TAG
,
"onResume()"
);
ensureAlive
();
flutterEngine
.
getLifecycleChannel
().
appIsResumed
();
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
host
.
getActivity
(),
host
.
getLifecycle
()
);
if
(
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
==
0
||
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
!=
this
.
host
.
getActivity
().
hashCode
()){
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
host
.
getActivity
(),
host
.
getLifecycle
()
);
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
=
this
.
host
.
getActivity
().
hashCode
();
}
if
(
platformPlugin
!=
null
)
platformPlugin
.
attachToActivity
(
host
.
getActivity
());
}
...
...
@@ -191,7 +192,6 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
public
void
onPostResume
()
{
Log
.
v
(
TAG
,
"onPostResume()"
);
ensureAlive
();
// Utils.setStatusBarLightMode(host.getActivity(), true);
}
...
...
@@ -230,10 +230,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
// Null out the platformPlugin to avoid a possible retain cycle between the plugin, this Fragment,
// and this Fragment's Activity.
if
(
platformPlugin
!=
null
)
{
// platformPlugin.destro
y();
platformPlugin
.
detachActivit
y
();
platformPlugin
=
null
;
}
if
(
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
!=
0
||
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
==
this
.
host
.
getActivity
().
hashCode
()){
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
}
Utils
.
fixInputMethodManagerLeak
(
host
.
getActivity
());
}
...
...
@@ -461,7 +466,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
* Flutter experience should control system chrome.
*/
@Nullable
PlatformPlugin
providePlatformPlugin
(
@Nullable
Activity
activity
,
@NonNull
FlutterEngine
flutterEngine
);
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
);
/**
* Hook for the host to configure the {@link FlutterEngine} as desired.
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
View file @
698e6a73
...
...
@@ -16,6 +16,7 @@ import androidx.fragment.app.FragmentActivity;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
import
io.flutter.embedding.android.*
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
...
...
@@ -467,12 +468,9 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
@Nullable
@Override
public
PlatformPlugin
providePlatformPlugin
(
@Nullable
Activity
activity
,
@NonNull
FlutterEngine
flutterEngine
)
{
if
(
activity
!=
null
)
{
return
new
PlatformPlugin
(
getActivity
(),
flutterEngine
.
getPlatformChannel
());
}
else
{
return
null
;
}
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
return
new
XPlatformPlugin
(
flutterEngine
.
getPlatformChannel
());
}
/**
...
...
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