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
f3aff2af
Commit
f3aff2af
authored
Jun 02, 2020
by
shaode.lsd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimized:
把XPlatformPlugin进行复用,解决了statusbar在多个activity中显示异常的问题。
parent
9b5285b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
19 deletions
+39
-19
.gitignore
.gitignore
+1
-0
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
.../main/java/com/idlefish/flutterboost/XPlatformPlugin.java
+9
-10
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
...dlefish/flutterboost/containers/BoostFlutterActivity.java
+3
-2
android/src/main/java/com/idlefish/flutterboost/containers/BoostViewUtils.java
.../com/idlefish/flutterboost/containers/BoostViewUtils.java
+24
-0
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
...com/idlefish/flutterboost/containers/FlutterFragment.java
+1
-6
No files found.
.gitignore
View file @
f3aff2af
...
@@ -17,3 +17,4 @@ example/android/app/.classpath
...
@@ -17,3 +17,4 @@ example/android/app/.classpath
example/android/app/.project
example/android/app/.project
example/android/.project
example/android/.project
flutter_boost
flutter_boost
.flutter-plugins-dependencies
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
View file @
f3aff2af
...
@@ -29,8 +29,8 @@ public class XPlatformPlugin {
...
@@ -29,8 +29,8 @@ public class XPlatformPlugin {
public
static
final
int
DEFAULT_SYSTEM_UI
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
public
static
final
int
DEFAULT_SYSTEM_UI
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
;
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
;
private
Activity
activity
;
private
Activity
activity
;
private
PlatformChannel
platformChannel
;
private
PlatformChannel
platformChannel
;
private
PlatformChannel
.
SystemChromeStyle
currentTheme
;
private
PlatformChannel
.
SystemChromeStyle
currentTheme
;
private
int
mEnabledOverlays
;
private
int
mEnabledOverlays
;
...
@@ -96,26 +96,25 @@ public class XPlatformPlugin {
...
@@ -96,26 +96,25 @@ public class XPlatformPlugin {
}
}
};
};
public
XPlatformPlugin
(
PlatformChannel
platformChannel
)
{
public
XPlatformPlugin
(
PlatformChannel
platformChannel
)
{
this
.
platformChannel
=
platformChannel
;
this
.
platformChannel
=
platformChannel
;
this
.
platformChannel
.
setPlatformMessageHandler
(
mPlatformMessageHandler
);
mEnabledOverlays
=
DEFAULT_SYSTEM_UI
;
mEnabledOverlays
=
DEFAULT_SYSTEM_UI
;
}
}
public
void
attachToActivity
(
Activity
activity
){
public
void
attachToActivity
(
Activity
activity
){
this
.
activity
=
activity
;
this
.
activity
=
activity
;
this
.
platformChannel
.
setPlatformMessageHandler
(
mPlatformMessageHandler
);
}
}
/**
/**
* Releases all resources held by this {@code PlatformPlugin}.
* Releases all resources held by this {@code PlatformPlugin}.
* <p>
* <p>
* Do not invoke any methods on a {@code PlatformPlugin} after invoking this method.
* Do not invoke any methods on a {@code PlatformPlugin} after invoking this method.
*/
*/
public
void
detachActivity
()
{
public
void
detachActivity
(
Activity
activity
)
{
this
.
activity
=
null
;
if
(
activity
==
this
.
activity
)
{
this
.
mPlatformMessageHandler
=
null
;
this
.
activity
=
null
;
}
}
}
private
void
playSystemSound
(
PlatformChannel
.
SoundType
soundType
)
{
private
void
playSystemSound
(
PlatformChannel
.
SoundType
soundType
)
{
...
...
android/src/main/java/com/idlefish/flutterboost/containers/BoostFlutterActivity.java
View file @
f3aff2af
...
@@ -56,6 +56,7 @@ public class BoostFlutterActivity extends Activity
...
@@ -56,6 +56,7 @@ public class BoostFlutterActivity extends Activity
// Default configuration.
// Default configuration.
protected
static
final
String
DEFAULT_BACKGROUND_MODE
=
BackgroundMode
.
opaque
.
name
();
protected
static
final
String
DEFAULT_BACKGROUND_MODE
=
BackgroundMode
.
opaque
.
name
();
private
static
XPlatformPlugin
sXPlatformPlugin
;
public
static
Intent
createDefaultIntent
(
@NonNull
Context
launchContext
)
{
public
static
Intent
createDefaultIntent
(
@NonNull
Context
launchContext
)
{
return
withNewEngine
().
build
(
launchContext
);
return
withNewEngine
().
build
(
launchContext
);
...
@@ -440,8 +441,8 @@ public class BoostFlutterActivity extends Activity
...
@@ -440,8 +441,8 @@ public class BoostFlutterActivity extends Activity
@Nullable
@Nullable
@Override
@Override
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
return
new
XPlatformPlugin
(
flutterEngine
.
getPlatformChannel
());
return
BoostViewUtils
.
getPlatformPlugin
(
flutterEngine
.
getPlatformChannel
());
}
}
/**
/**
...
...
android/src/main/java/com/idlefish/flutterboost/containers/BoostViewUtils.java
0 → 100644
View file @
f3aff2af
package
com.idlefish.flutterboost.containers
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
import
io.flutter.embedding.engine.systemchannels.PlatformChannel
;
class
BoostViewUtils
{
private
static
volatile
XPlatformPlugin
mInstance
;
private
BoostViewUtils
()
{
}
public
static
XPlatformPlugin
getPlatformPlugin
(
PlatformChannel
channel
)
{
if
(
mInstance
==
null
)
{
synchronized
(
BoostViewUtils
.
class
)
{
if
(
mInstance
==
null
)
{
mInstance
=
new
XPlatformPlugin
(
channel
);
}
}
}
return
mInstance
;
}
}
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
f3aff2af
...
@@ -228,7 +228,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -228,7 +228,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
// Null out the platformPlugin to avoid a possible retain cycle between the plugin, this Fragment,
// Null out the platformPlugin to avoid a possible retain cycle between the plugin, this Fragment,
// and this Fragment's Activity.
// and this Fragment's Activity.
if
(
platformPlugin
!=
null
)
{
if
(
platformPlugin
!=
null
)
{
platformPlugin
.
detachActivity
();
platformPlugin
.
detachActivity
(
getContextActivity
()
);
platformPlugin
=
null
;
platformPlugin
=
null
;
}
}
...
...
android/src/main/java/com/idlefish/flutterboost/containers/FlutterFragment.java
View file @
f3aff2af
...
@@ -2,8 +2,6 @@ package com.idlefish.flutterboost.containers;
...
@@ -2,8 +2,6 @@ package com.idlefish.flutterboost.containers;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.arch.lifecycle.Lifecycle
;
import
android.arch.lifecycle.Lifecycle
;
import
android.graphics.Color
;
import
android.view.*
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Build
;
...
@@ -17,13 +15,11 @@ import android.view.View;
...
@@ -17,13 +15,11 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.FlutterBoost
;
import
com.idlefish.flutterboost.Utils
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.XFlutterView
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
import
com.idlefish.flutterboost.XPlatformPlugin
;
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.plugin.platform.PlatformPlugin
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -472,8 +468,7 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
...
@@ -472,8 +468,7 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm
@Nullable
@Nullable
@Override
@Override
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
public
XPlatformPlugin
providePlatformPlugin
(
@NonNull
FlutterEngine
flutterEngine
)
{
return
new
XPlatformPlugin
(
flutterEngine
.
getPlatformChannel
());
return
BoostViewUtils
.
getPlatformPlugin
(
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