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
8dd58ee9
Commit
8dd58ee9
authored
Mar 16, 2021
by
李增强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复activity插件异常问题
parent
5d638134
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+16
-10
No files found.
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
8dd58ee9
...
@@ -2,15 +2,19 @@ package com.idlefish.flutterboost.containers;
...
@@ -2,15 +2,19 @@ package com.idlefish.flutterboost.containers;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
import
androidx.lifecycle.Lifecycle
;
import
androidx.lifecycle.Lifecycle
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.PixelFormat
;
import
android.graphics.PixelFormat
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
android.view.*
;
import
android.view.*
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -23,12 +27,14 @@ import com.idlefish.flutterboost.FlutterBoost;
...
@@ -23,12 +27,14 @@ import com.idlefish.flutterboost.FlutterBoost;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IFlutterViewContainer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
com.idlefish.flutterboost.interfaces.IOperateSyncer
;
import
io.flutter.Log
;
import
io.flutter.Log
;
import
io.flutter.app.FlutterActivity
;
import
io.flutter.app.FlutterActivity
;
import
io.flutter.embedding.android.*
;
import
io.flutter.embedding.android.*
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.plugins.PluginRegistry
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
static
android
.
content
.
ComponentCallbacks2
.
TRIM_MEMORY_RUNNING_LOW
;
import
static
android
.
content
.
ComponentCallbacks2
.
TRIM_MEMORY_RUNNING_LOW
;
...
@@ -37,7 +43,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -37,7 +43,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
private
static
final
String
TAG
=
"FlutterActivityAndFragmentDelegate"
;
private
static
final
String
TAG
=
"FlutterActivityAndFragmentDelegate"
;
private
static
int
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
=
0
;
private
static
int
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
=
0
;
@NonNull
@NonNull
private
Host
host
;
private
Host
host
;
@Nullable
@Nullable
...
@@ -179,20 +185,18 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -179,20 +185,18 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
public
void
onResume
()
{
public
void
onResume
()
{
if
(
mSyncer
.
isLocked
())
return
;
if
(
mSyncer
.
isLocked
())
return
;
mSyncer
.
onAppear
();
mSyncer
.
onAppear
();
Log
.
v
(
TAG
,
"onResume()"
);
Log
.
v
(
TAG
,
"onResume()"
);
ensureAlive
();
ensureAlive
();
flutterEngine
.
getLifecycleChannel
().
appIsResumed
();
flutterEngine
.
getLifecycleChannel
().
appIsResumed
();
if
(
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
==
0
||
if
(
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
==
0
||
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
!=
this
.
host
.
getActivity
().
hashCode
()){
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
=
host
.
getActivity
().
hashCode
();
ACTIVITY_CONTROL_SURFACE_ATTACH_TO_ACTVITY_HASH_CODE
=
host
.
getActivity
().
hashCode
();
}
}
}
}
...
@@ -213,7 +217,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -213,7 +217,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
public
void
onPause
()
{
public
void
onPause
()
{
Log
.
v
(
TAG
,
"onPause()"
);
Log
.
v
(
TAG
,
"onPause()"
);
if
(
mSyncer
.
isLocked
())
return
;
if
(
mSyncer
.
isLocked
())
return
;
ensureAlive
();
ensureAlive
();
mSyncer
.
onDisappear
();
mSyncer
.
onDisappear
();
flutterEngine
.
getLifecycleChannel
().
appIsInactive
();
flutterEngine
.
getLifecycleChannel
().
appIsInactive
();
...
@@ -249,7 +253,8 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -249,7 +253,8 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
if
(
host
.
getActivity
().
isChangingConfigurations
())
{
if
(
host
.
getActivity
().
isChangingConfigurations
())
{
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
flutterEngine
.
getActivityControlSurface
().
detachFromActivityForConfigChanges
();
}
else
{
}
else
{
flutterEngine
.
getActivityControlSurface
().
detachFromActivity
();
// flutterEngine.getActivityControlSurface().detachFromActivity();
}
}
}
}
Utils
.
fixInputMethodManagerLeak
(
host
.
getActivity
());
Utils
.
fixInputMethodManagerLeak
(
host
.
getActivity
());
...
@@ -360,7 +365,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -360,7 +365,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
* <p>
* <p>
* An {@code IllegalStateException} is thrown if this delegate has been {@link #release()}'ed.
* An {@code IllegalStateException} is thrown if this delegate has been {@link #release()}'ed.
*/
*/
private
void
ensureAlive
()
{
private
void
ensureAlive
()
{
if
(
host
==
null
)
{
if
(
host
==
null
)
{
throw
new
IllegalStateException
(
"Cannot execute method on a destroyed FlutterActivityAndFragmentDelegate."
);
throw
new
IllegalStateException
(
"Cannot execute method on a destroyed FlutterActivityAndFragmentDelegate."
);
}
}
...
@@ -481,6 +486,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -481,6 +486,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
*/
*/
PlatformPlugin
providePlatformPlugin
(
PlatformPlugin
providePlatformPlugin
(
@Nullable
Activity
activity
,
@NonNull
FlutterEngine
flutterEngine
);
@Nullable
Activity
activity
,
@NonNull
FlutterEngine
flutterEngine
);
/**
/**
* Hook for the host to configure the {@link FlutterEngine} as desired.
* Hook for the host to configure the {@link FlutterEngine} as desired.
*/
*/
...
...
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