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
abeb415e
Commit
abeb415e
authored
Sep 03, 2020
by
justin
Committed by
GitHub
Sep 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #851 from sdlu1992/task/task_v1.12.13_support_hotfixes
Task/task v1.12.13 support hotfixes
parents
d90dc99b
7fcd70a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
13 deletions
+57
-13
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
.../main/java/com/idlefish/flutterboost/XPlatformPlugin.java
+54
-13
lib/container/boost_container.dart
lib/container/boost_container.dart
+3
-0
No files found.
android/src/main/java/com/idlefish/flutterboost/XPlatformPlugin.java
View file @
abeb415e
...
...
@@ -118,14 +118,20 @@ public class XPlatformPlugin {
}
private
void
playSystemSound
(
PlatformChannel
.
SoundType
soundType
)
{
if
(
getActivity
()
==
null
)
{
return
;
}
if
(
soundType
==
PlatformChannel
.
SoundType
.
CLICK
)
{
View
view
=
activity
.
getWindow
().
getDecorView
();
View
view
=
getActivity
()
.
getWindow
().
getDecorView
();
view
.
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
}
}
private
void
vibrateHapticFeedback
(
PlatformChannel
.
HapticFeedbackType
feedbackType
)
{
View
view
=
activity
.
getWindow
().
getDecorView
();
if
(
getActivity
()
==
null
)
{
return
;
}
View
view
=
getActivity
().
getWindow
().
getDecorView
();
switch
(
feedbackType
)
{
case
STANDARD:
view
.
performHapticFeedback
(
HapticFeedbackConstants
.
LONG_PRESS
);
...
...
@@ -147,11 +153,17 @@ public class XPlatformPlugin {
}
private
void
setSystemChromePreferredOrientations
(
int
androidOrientation
)
{
activity
.
setRequestedOrientation
(
androidOrientation
);
if
(
getActivity
()
==
null
)
{
return
;
}
getActivity
().
setRequestedOrientation
(
androidOrientation
);
}
@SuppressWarnings
(
"deprecation"
)
private
void
setSystemChromeApplicationSwitcherDescription
(
PlatformChannel
.
AppSwitcherDescription
description
)
{
if
(
getActivity
()
==
null
)
{
return
;
}
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
;
}
...
...
@@ -159,11 +171,12 @@ public class XPlatformPlugin {
// Linter refuses to believe we're only executing this code in API 28 unless we use distinct if blocks and
// hardcode the API 28 constant.
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
P
&&
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
setTaskDescription
(
new
ActivityManager
.
TaskDescription
(
description
.
label
,
/*icon=*/
null
,
description
.
color
));
getActivity
().
setTaskDescription
(
new
ActivityManager
.
TaskDescription
(
description
.
label
,
/*icon=*/
null
,
description
.
color
));
}
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
{
ActivityManager
.
TaskDescription
taskDescription
=
new
ActivityManager
.
TaskDescription
(
description
.
label
,
0
,
description
.
color
);
activity
.
setTaskDescription
(
taskDescription
);
getActivity
()
.
setTaskDescription
(
taskDescription
);
}
}
...
...
@@ -205,7 +218,10 @@ public class XPlatformPlugin {
* {@code PlatformPlugin}.
*/
public
void
updateSystemUiOverlays
(){
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
mEnabledOverlays
);
if
(
getActivity
()
==
null
)
{
return
;
}
getActivity
().
getWindow
().
getDecorView
().
setSystemUiVisibility
(
mEnabledOverlays
);
if
(
currentTheme
!=
null
)
{
setSystemChromeSystemUIOverlayStyle
(
currentTheme
);
}
...
...
@@ -216,7 +232,10 @@ public class XPlatformPlugin {
}
private
void
setSystemChromeSystemUIOverlayStyle
(
PlatformChannel
.
SystemChromeStyle
systemChromeStyle
)
{
Window
window
=
activity
.
getWindow
();
if
(
getActivity
()
==
null
)
{
return
;
}
Window
window
=
getActivity
().
getWindow
();
View
view
=
window
.
getDecorView
();
int
flags
=
view
.
getSystemUiVisibility
();
// You can change the navigation bar color (including translucent colors)
...
...
@@ -265,32 +284,44 @@ public class XPlatformPlugin {
}
private
void
popSystemNavigator
()
{
activity
.
finish
();
if
(
getActivity
()
==
null
)
{
return
;
}
getActivity
().
finish
();
}
private
CharSequence
getClipboardData
(
PlatformChannel
.
ClipboardContentFormat
format
)
{
ClipboardManager
clipboard
=
(
ClipboardManager
)
activity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
if
(
getActivity
()
==
null
)
{
return
null
;
}
ClipboardManager
clipboard
=
(
ClipboardManager
)
getActivity
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
ClipData
clip
=
clipboard
.
getPrimaryClip
();
if
(
clip
==
null
)
return
null
;
if
(
format
==
null
||
format
==
PlatformChannel
.
ClipboardContentFormat
.
PLAIN_TEXT
)
{
return
clip
.
getItemAt
(
0
).
coerceToText
(
activity
);
return
clip
.
getItemAt
(
0
).
coerceToText
(
getActivity
()
);
}
return
null
;
}
private
void
setClipboardData
(
String
text
)
{
ClipboardManager
clipboard
=
(
ClipboardManager
)
activity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
if
(
getActivity
()
==
null
)
{
return
;
}
ClipboardManager
clipboard
=
(
ClipboardManager
)
getActivity
().
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
ClipData
clip
=
ClipData
.
newPlainText
(
"text label?"
,
text
);
clipboard
.
setPrimaryClip
(
clip
);
}
private
List
<
Rect
>
getSystemGestureExclusionRects
()
{
if
(
getActivity
()
==
null
)
{
return
null
;
}
if
(
Build
.
VERSION
.
SDK_INT
>=
29
)
{
Window
window
=
activity
.
getWindow
();
Window
window
=
getActivity
()
.
getWindow
();
View
view
=
window
.
getDecorView
();
return
view
.
getSystemGestureExclusionRects
();
}
...
...
@@ -299,13 +330,23 @@ public class XPlatformPlugin {
}
private
void
setSystemGestureExclusionRects
(
ArrayList
<
Rect
>
rects
)
{
if
(
getActivity
()
==
null
)
{
return
;
}
if
(
Build
.
VERSION
.
SDK_INT
<
29
)
{
return
;
}
Window
window
=
activity
.
getWindow
();
Window
window
=
getActivity
()
.
getWindow
();
View
view
=
window
.
getDecorView
();
view
.
setSystemGestureExclusionRects
(
rects
);
}
@Nullable
private
Activity
getActivity
()
{
if
(
activity
!=
null
)
{
return
activity
;
}
return
FlutterBoost
.
instance
().
currentActivity
();
}
}
lib/container/boost_container.dart
View file @
abeb415e
...
...
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'container_manager.dart'
;
import
'../flutter_boost.dart'
;
import
'boost_page_route.dart'
;
...
...
@@ -222,6 +223,8 @@ class BoostContainerState extends NavigatorState {
routerHistory
.
add
(
route
);
// 复用XPlatformPlugin后,每次进入页面时都需要在这里反复通知Native更新Theme
SystemChrome
.
restoreSystemUIOverlays
();
if
(
FlutterBoost
.
containerManager
.
postPushRoute
!=
null
)
{
FlutterBoost
.
containerManager
.
postPushRoute
(
name
,
uniqueId
,
params
,
newRoute
??
route
,
future
);
...
...
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