Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
57f53b98
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
57f53b98
编写于
5月 07, 2018
作者:
J
Jonah Williams
提交者:
GitHub
5月 07, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Re-land Enables system chrome customization on Android O/N and greater (#5171)
上级
1ef62820
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
9 deletion
+65
-9
shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java
...rm/android/io/flutter/plugin/platform/PlatformPlugin.java
+61
-6
shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
...form/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
+4
-3
未找到文件。
shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java
浏览文件 @
57f53b98
...
...
@@ -15,6 +15,8 @@ import android.os.Build;
import
android.view.HapticFeedbackConstants
;
import
android.view.SoundEffectConstants
;
import
android.view.View
;
import
android.view.Window
;
import
android.util.Log
;
import
io.flutter.plugin.common.ActivityLifecycleListener
;
import
io.flutter.plugin.common.MethodChannel.MethodCallHandler
;
...
...
@@ -30,6 +32,7 @@ import org.json.JSONObject;
*/
public
class
PlatformPlugin
implements
MethodCallHandler
,
ActivityLifecycleListener
{
private
final
Activity
mActivity
;
private
JSONObject
mCurrentTheme
;
public
static
final
int
DEFAULT_SYSTEM_UI
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
;
private
static
final
String
kTextPlainFormat
=
"text/plain"
;
...
...
@@ -60,7 +63,7 @@ public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListe
setSystemChromeEnabledSystemUIOverlays
((
JSONArray
)
arguments
);
result
.
success
(
null
);
}
else
if
(
method
.
equals
(
"SystemChrome.setSystemUIOverlayStyle"
))
{
setSystemChromeSystemUIOverlayStyle
((
String
)
arguments
);
setSystemChromeSystemUIOverlayStyle
((
JSONObject
)
arguments
);
result
.
success
(
null
);
}
else
if
(
method
.
equals
(
"SystemNavigator.pop"
))
{
popSystemNavigator
();
...
...
@@ -218,14 +221,66 @@ public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListe
updateSystemUiOverlays
();
}
private
void
updateSystemUiOverlays
()
{
private
void
updateSystemUiOverlays
(){
mActivity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
mEnabledOverlays
);
if
(
mCurrentTheme
!=
null
)
{
setSystemChromeSystemUIOverlayStyle
(
mCurrentTheme
);
}
}
private
void
setSystemChromeSystemUIOverlayStyle
(
String
style
)
{
// You can change the navigation bar color (including translucent colors)
// in Android, but you can't change the color of the navigation buttons,
// so LIGHT vs DARK effectively isn't supported in Android.
private
void
setSystemChromeSystemUIOverlayStyle
(
JSONObject
message
)
{
Window
window
=
mActivity
.
getWindow
();
View
view
=
window
.
getDecorView
();
int
flags
=
view
.
getSystemUiVisibility
();
try
{
// You can change the navigation bar color (including translucent colors)
// in Android, but you can't change the color of the navigation buttons until Android O.
// LIGHT vs DARK effectively isn't supported until then.
// Build.VERSION_CODES.O
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
if
(!
message
.
isNull
(
"systemNavigationBarIconBrightness"
))
{
String
systemNavigationBarIconBrightness
=
message
.
getString
(
"systemNavigationBarIconBrightness"
);
switch
(
systemNavigationBarIconBrightness
)
{
case
"Brightness.dark"
:
//View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
flags
|=
0x10
;
break
;
case
"Brightness.light"
:
flags
&=
~
0x10
;
break
;
}
}
if
(!
message
.
isNull
(
"systemNavigationBarColor"
))
{
window
.
setNavigationBarColor
(
message
.
getInt
(
"systemNavigationBarColor"
));
}
}
// Build.VERSION_CODES.M
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
if
(!
message
.
isNull
(
"statusBarIconBrightness"
))
{
String
statusBarIconBrightness
=
message
.
getString
(
"statusBarIconBrightness"
);
switch
(
statusBarIconBrightness
)
{
case
"Brightness.dark"
:
// View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
flags
|=
0x2000
;
break
;
case
"Brightness.light"
:
flags
&=
~
0x2000
;
break
;
}
}
if
(!
message
.
isNull
(
"statusBarColor"
))
{
window
.
setStatusBarColor
(
message
.
getInt
(
"statusBarColor"
));
}
}
if
(!
message
.
isNull
(
"systemNavigationBarDividerColor"
))
{
// Not availible until Android P.
// window.setNavigationBarDividerColor(systemNavigationBarDividerColor);
}
view
.
setSystemUiVisibility
(
flags
);
mCurrentTheme
=
message
;
}
catch
(
JSONException
err
)
{
Log
.
i
(
"PlatformPlugin"
,
err
.
toString
());
}
}
private
void
popSystemNavigator
()
{
...
...
shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
浏览文件 @
57f53b98
...
...
@@ -137,11 +137,12 @@ using namespace shell;
!
[
overlays
containsObject
:
@"SystemUiOverlay.top"
];
}
-
(
void
)
setSystemChromeSystemUIOverlayStyle
:(
NSString
*
)
style
{
-
(
void
)
setSystemChromeSystemUIOverlayStyle
:(
NSDictionary
*
)
message
{
NSString
*
style
=
message
[
@"statusBarBrightness"
];
UIStatusBarStyle
statusBarStyle
;
if
([
style
isEqualToString
:
@"
SystemUiOverlayStyle
.light"
])
if
([
style
isEqualToString
:
@"
Brightness
.light"
])
statusBarStyle
=
UIStatusBarStyleLightContent
;
else
if
([
style
isEqualToString
:
@"
SystemUiOverlayStyle
.dark"
])
else
if
([
style
isEqualToString
:
@"
Brightness
.dark"
])
statusBarStyle
=
UIStatusBarStyleDefault
;
else
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录