Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
51775c77
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
51775c77
编写于
8月 23, 2017
作者:
X
xster
提交者:
GitHub
8月 23, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add animation to Android too (#3981)
上级
4b96f409
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
23 deletion
+33
-23
shell/platform/android/io/flutter/app/FlutterActivityDelegate.java
...tform/android/io/flutter/app/FlutterActivityDelegate.java
+33
-23
未找到文件。
shell/platform/android/io/flutter/app/FlutterActivityDelegate.java
浏览文件 @
51775c77
...
...
@@ -4,6 +4,8 @@
package
io.flutter.app
;
import
android.animation.Animator
;
import
android.animation.AnimatorListenerAdapter
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -19,6 +21,7 @@ import android.os.Bundle;
import
android.util.Log
;
import
android.util.TypedValue
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager.LayoutParams
;
...
...
@@ -154,8 +157,11 @@ public final class FlutterActivityDelegate
if
(
flutterView
==
null
)
{
flutterView
=
new
FlutterView
(
activity
);
flutterView
.
setLayoutParams
(
matchParent
);
activity
.
setContentView
(
flutterView
);
launchView
=
createLaunchView
();
setContentView
();
if
(
launchView
!=
null
)
{
addLaunchView
();
}
}
if
(
loadIntent
(
activity
.
getIntent
()))
{
...
...
@@ -310,7 +316,7 @@ public final class FlutterActivityDelegate
/**
* Extracts a {@link Drawable} from the parent activity's {@code windowBackground}.
*
* {@code android:windowBackground} is specifically reused instead of a
custom defined meta-data
* {@code android:windowBackground} is specifically reused instead of a
other attributes
* because the Android framework can display it fast enough when launching the app as opposed
* to anything defined in the Activity subclass.
*
...
...
@@ -336,6 +342,10 @@ public final class FlutterActivityDelegate
}
}
/**
* Let the user specify whether the activity's {@code windowBackground} is a launch screen
* and should be shown until the first frame via a <meta-data> tag in the activity.
*/
private
Boolean
showSplashScreenUntilFirstFrame
()
{
try
{
ActivityInfo
activityInfo
=
activity
.
getPackageManager
().
getActivityInfo
(
...
...
@@ -349,41 +359,41 @@ public final class FlutterActivityDelegate
}
/**
* S
ets the root content view of the activity
.
* S
how and then automatically animate out the launch view
.
*
* If no launch screens are defined in the user application's AndroidManifest.xml as the
* activity's {@code windowBackground}, then set the {@link FlutterView} as the root.
* If a launch screen is defined in the user application's AndroidManifest.xml as the
* activity's {@code windowBackground}, display it on top of the {@link FlutterView} and
* remove the activity's {@code windowBackground}.
*
* Otherwise, extract the {@code windowBackground}'s {@link Drawable} onto a new launch View to
* put in front of the {@link FlutterView}, remove the activity's {@code windowBackground},
* and finally remove the launch view when the {@link FlutterView} renders its first frame.
* Fade it out and remove it when the {@link FlutterView} renders its first frame.
*/
private
void
setContentView
()
{
// No transient launch screen. Set the FlutterView as root.
private
void
addLaunchView
()
{
if
(
launchView
==
null
)
{
activity
.
setContentView
(
flutterView
);
return
;
}
final
FrameLayout
layout
=
new
FrameLayout
(
activity
);
layout
.
setLayoutParams
(
matchParent
);
layout
.
addView
(
flutterView
);
layout
.
addView
(
launchView
);
activity
.
addContentView
(
launchView
,
matchParent
);
flutterView
.
addFirstFrameListener
(
new
FlutterView
.
FirstFrameListener
()
{
@Override
public
void
onFirstFrame
()
{
// Views need to be unparented before adding directly to activity.
layout
.
removeAllViews
();
FlutterActivityDelegate
.
this
.
activity
.
setContentView
(
FlutterActivityDelegate
.
this
.
flutterView
);
FlutterActivityDelegate
.
this
.
launchView
=
null
;
FlutterActivityDelegate
.
this
.
launchView
.
animate
()
.
alpha
(
0
f
)
// Use Android's default animation duration.
.
setListener
(
new
AnimatorListenerAdapter
()
{
@Override
public
void
onAnimationEnd
(
Animator
animation
)
{
// Views added to an Activity's addContentView is always added to its
// root FrameLayout.
((
ViewGroup
)
FlutterActivityDelegate
.
this
.
launchView
.
getParent
())
.
removeView
(
FlutterActivityDelegate
.
this
.
launchView
);
FlutterActivityDelegate
.
this
.
launchView
=
null
;
}
});
FlutterActivityDelegate
.
this
.
flutterView
.
removeFirstFrameListener
(
this
);
}
});
activity
.
setContentView
(
layout
);
// Resets the activity theme from the one containing the launch screen in the window
// background to a blank one since the launch screen is now in a view in front of the
// FlutterView.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录