Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
438a29cb
E
engine
项目概览
weixin_43355755
/
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,发现更多精彩内容 >>
未验证
提交
438a29cb
编写于
7月 12, 2021
作者:
E
Emmanuel Garcia
提交者:
GitHub
7月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set Flutter View ID to the view ID instead of of the splash screen (#27262)
上级
b68786a4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
79 addition
and
45 deletion
+79
-45
shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
...android/io/flutter/embedding/android/FlutterActivity.java
+7
-5
shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java
...embedding/android/FlutterActivityAndFragmentDelegate.java
+7
-10
shell/platform/android/io/flutter/embedding/android/FlutterFragment.java
...android/io/flutter/embedding/android/FlutterFragment.java
+33
-16
shell/platform/android/io/flutter/util/ViewUtils.java
shell/platform/android/io/flutter/util/ViewUtils.java
+17
-0
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
...dding/android/FlutterActivityAndFragmentDelegateTest.java
+11
-11
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityTest.java
...est/io/flutter/embedding/android/FlutterActivityTest.java
+1
-0
shell/platform/android/test/io/flutter/embedding/android/FlutterAndroidComponentTest.java
...lutter/embedding/android/FlutterAndroidComponentTest.java
+3
-3
未找到文件。
shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
浏览文件 @
438a29cb
...
@@ -47,6 +47,7 @@ import io.flutter.embedding.engine.FlutterShellArgs;
...
@@ -47,6 +47,7 @@ import io.flutter.embedding.engine.FlutterShellArgs;
import
io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
;
import
io.flutter.embedding.engine.plugins.activity.ActivityControlSurface
;
import
io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister
;
import
io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.util.ViewUtils
;
/**
/**
* {@code Activity} which displays a fullscreen Flutter UI.
* {@code Activity} which displays a fullscreen Flutter UI.
...
@@ -215,7 +216,7 @@ public class FlutterActivity extends Activity
...
@@ -215,7 +216,7 @@ public class FlutterActivity extends Activity
* <p>This ID can be used to lookup {@code FlutterView} in the Android view hierarchy. For more,
* <p>This ID can be used to lookup {@code FlutterView} in the Android view hierarchy. For more,
* see {@link android.view.View#findViewById}.
* see {@link android.view.View#findViewById}.
*/
*/
public
static
final
int
FLUTTER_VIEW_ID
=
0xF1F2
;
public
static
final
int
FLUTTER_VIEW_ID
=
ViewUtils
.
generateViewId
(
0xF1F2
)
;
/**
/**
* Creates an {@link Intent} that launches a {@code FlutterActivity}, which creates a {@link
* Creates an {@link Intent} that launches a {@code FlutterActivity}, which creates a {@link
...
@@ -433,9 +434,7 @@ public class FlutterActivity extends Activity
...
@@ -433,9 +434,7 @@ public class FlutterActivity extends Activity
configureWindowForTransparency
();
configureWindowForTransparency
();
View
flutterView
=
createFlutterView
();
setContentView
(
createFlutterView
());
flutterView
.
setId
(
FLUTTER_VIEW_ID
);
setContentView
(
flutterView
);
configureStatusBarForFullscreenFlutterExperience
();
configureStatusBarForFullscreenFlutterExperience
();
}
}
...
@@ -540,7 +539,10 @@ public class FlutterActivity extends Activity
...
@@ -540,7 +539,10 @@ public class FlutterActivity extends Activity
@NonNull
@NonNull
private
View
createFlutterView
()
{
private
View
createFlutterView
()
{
return
delegate
.
onCreateView
(
return
delegate
.
onCreateView
(
null
/* inflater */
,
null
/* container */
,
null
/* savedInstanceState */
);
/* inflater=*/
null
,
/* container=*/
null
,
/* savedInstanceState=*/
null
,
/*flutterViewId=*/
FLUTTER_VIEW_ID
);
}
}
private
void
configureStatusBarForFullscreenFlutterExperience
()
{
private
void
configureStatusBarForFullscreenFlutterExperience
()
{
...
...
shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java
浏览文件 @
438a29cb
...
@@ -11,7 +11,6 @@ import android.app.Activity;
...
@@ -11,7 +11,6 @@ import android.app.Activity;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
...
@@ -28,6 +27,7 @@ import io.flutter.embedding.engine.FlutterShellArgs;
...
@@ -28,6 +27,7 @@ import io.flutter.embedding.engine.FlutterShellArgs;
import
io.flutter.embedding.engine.dart.DartExecutor
;
import
io.flutter.embedding.engine.dart.DartExecutor
;
import
io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
;
import
io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.util.ViewUtils
;
import
java.util.Arrays
;
import
java.util.Arrays
;
/**
/**
...
@@ -266,7 +266,10 @@ import java.util.Arrays;
...
@@ -266,7 +266,10 @@ import java.util.Arrays;
*/
*/
@NonNull
@NonNull
View
onCreateView
(
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
,
int
flutterViewId
)
{
Log
.
v
(
TAG
,
"Creating FlutterView."
);
Log
.
v
(
TAG
,
"Creating FlutterView."
);
ensureAlive
();
ensureAlive
();
...
@@ -296,18 +299,12 @@ import java.util.Arrays;
...
@@ -296,18 +299,12 @@ import java.util.Arrays;
flutterView
.
addOnFirstFrameRenderedListener
(
flutterUiDisplayListener
);
flutterView
.
addOnFirstFrameRenderedListener
(
flutterUiDisplayListener
);
flutterSplashView
=
new
FlutterSplashView
(
host
.
getContext
());
flutterSplashView
=
new
FlutterSplashView
(
host
.
getContext
());
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
flutterSplashView
.
setId
(
ViewUtils
.
generateViewId
(
486947586
));
flutterSplashView
.
setId
(
View
.
generateViewId
());
}
else
{
// TODO(mattcarroll): Find a better solution to this ID. This is a random, static ID.
// It might conflict with other Views, and it means that only a single FlutterSplashView
// can exist in a View hierarchy at one time.
flutterSplashView
.
setId
(
486947586
);
}
flutterSplashView
.
displayFlutterViewWithSplash
(
flutterView
,
host
.
provideSplashScreen
());
flutterSplashView
.
displayFlutterViewWithSplash
(
flutterView
,
host
.
provideSplashScreen
());
Log
.
v
(
TAG
,
"Attaching FlutterEngine to FlutterView."
);
Log
.
v
(
TAG
,
"Attaching FlutterEngine to FlutterView."
);
flutterView
.
attachToFlutterEngine
(
flutterEngine
);
flutterView
.
attachToFlutterEngine
(
flutterEngine
);
flutterView
.
setId
(
flutterViewId
);
return
flutterSplashView
;
return
flutterSplashView
;
}
}
...
...
shell/platform/android/io/flutter/embedding/android/FlutterFragment.java
浏览文件 @
438a29cb
...
@@ -24,6 +24,7 @@ import io.flutter.embedding.engine.FlutterEngine;
...
@@ -24,6 +24,7 @@ import io.flutter.embedding.engine.FlutterEngine;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.FlutterShellArgs
;
import
io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
;
import
io.flutter.embedding.engine.renderer.FlutterUiDisplayListener
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.plugin.platform.PlatformPlugin
;
import
io.flutter.util.ViewUtils
;
/**
/**
* {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space.
* {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space.
...
@@ -88,11 +89,20 @@ import io.flutter.plugin.platform.PlatformPlugin;
...
@@ -88,11 +89,20 @@ import io.flutter.plugin.platform.PlatformPlugin;
* }</pre>
* }</pre>
*
*
* <p>If Flutter is needed in a location that can only use a {@code View}, consider using a {@link
* <p>If Flutter is needed in a location that can only use a {@code View}, consider using a {@link
* FlutterView}. Using a {@link FlutterView} requires forwarding some calls from an {@code
* io.flutter.embedding.android.FlutterView}. Using a {@link
* io.flutter.embedding.android.FlutterView} requires forwarding some calls from an {@code
* Activity}, as well as forwarding lifecycle calls from an {@code Activity} or a {@code Fragment}.
* Activity}, as well as forwarding lifecycle calls from an {@code Activity} or a {@code Fragment}.
*/
*/
public
class
FlutterFragment
extends
Fragment
public
class
FlutterFragment
extends
Fragment
implements
FlutterActivityAndFragmentDelegate
.
Host
,
ComponentCallbacks2
{
implements
FlutterActivityAndFragmentDelegate
.
Host
,
ComponentCallbacks2
{
/**
* The ID of the {@code FlutterView} created by this activity.
*
* <p>This ID can be used to lookup {@code FlutterView} in the Android view hierarchy. For more,
* see {@link android.view.View#findViewById}.
*/
public
static
final
int
FLUTTER_VIEW_ID
=
ViewUtils
.
generateViewId
(
0xF1F2
);
private
static
final
String
TAG
=
"FlutterFragment"
;
private
static
final
String
TAG
=
"FlutterFragment"
;
/** The Dart entrypoint method name that is executed upon initialization. */
/** The Dart entrypoint method name that is executed upon initialization. */
...
@@ -105,10 +115,14 @@ public class FlutterFragment extends Fragment
...
@@ -105,10 +115,14 @@ public class FlutterFragment extends Fragment
protected
static
final
String
ARG_APP_BUNDLE_PATH
=
"app_bundle_path"
;
protected
static
final
String
ARG_APP_BUNDLE_PATH
=
"app_bundle_path"
;
/** Flutter shell arguments. */
/** Flutter shell arguments. */
protected
static
final
String
ARG_FLUTTER_INITIALIZATION_ARGS
=
"initialization_args"
;
protected
static
final
String
ARG_FLUTTER_INITIALIZATION_ARGS
=
"initialization_args"
;
/** {@link RenderMode} to be used for the {@link FlutterView} in this {@code FlutterFragment} */
/**
* {@link RenderMode} to be used for the {@link io.flutter.embedding.android.FlutterView} in this
* {@code FlutterFragment}
*/
protected
static
final
String
ARG_FLUTTERVIEW_RENDER_MODE
=
"flutterview_render_mode"
;
protected
static
final
String
ARG_FLUTTERVIEW_RENDER_MODE
=
"flutterview_render_mode"
;
/**
/**
* {@link TransparencyMode} to be used for the {@link FlutterView} in this {@code FlutterFragment}
* {@link TransparencyMode} to be used for the {@link io.flutter.embedding.android.FlutterView} in
* this {@code FlutterFragment}
*/
*/
protected
static
final
String
ARG_FLUTTERVIEW_TRANSPARENCY_MODE
=
"flutterview_transparency_mode"
;
protected
static
final
String
ARG_FLUTTERVIEW_TRANSPARENCY_MODE
=
"flutterview_transparency_mode"
;
/** See {@link #shouldAttachEngineToActivity()}. */
/** See {@link #shouldAttachEngineToActivity()}. */
...
@@ -290,8 +304,9 @@ public class FlutterFragment extends Fragment
...
@@ -290,8 +304,9 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Support a {@link TransparencyMode#transparent} background within {@link FlutterView}, or
* Support a {@link TransparencyMode#transparent} background within {@link
* force an {@link TransparencyMode#opaque} background.
* io.flutter.embedding.android.FlutterView}, or force an {@link TransparencyMode#opaque}
* background.
*
*
* <p>See {@link TransparencyMode} for implications of this selection.
* <p>See {@link TransparencyMode} for implications of this selection.
*/
*/
...
@@ -517,8 +532,9 @@ public class FlutterFragment extends Fragment
...
@@ -517,8 +532,9 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Support a {@link TransparencyMode#transparent} background within {@link FlutterView}, or
* Support a {@link TransparencyMode#transparent} background within {@link
* force an {@link TransparencyMode#opaque} background.
* io.flutter.embedding.android.FlutterView}, or force an {@link TransparencyMode#opaque}
* background.
*
*
* <p>See {@link TransparencyMode} for implications of this selection.
* <p>See {@link TransparencyMode} for implications of this selection.
*/
*/
...
@@ -710,7 +726,8 @@ public class FlutterFragment extends Fragment
...
@@ -710,7 +726,8 @@ public class FlutterFragment extends Fragment
@Override
@Override
public
View
onCreateView
(
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
return
delegate
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
return
delegate
.
onCreateView
(
inflater
,
container
,
savedInstanceState
,
/*flutterViewId=*/
FLUTTER_VIEW_ID
);
}
}
@Override
@Override
...
@@ -1002,8 +1019,8 @@ public class FlutterFragment extends Fragment
...
@@ -1002,8 +1019,8 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Returns the desired {@link RenderMode} for the {@link
FlutterView} displayed in this {@code
* Returns the desired {@link RenderMode} for the {@link
io.flutter.embedding.android.FlutterView}
* FlutterFragment}.
*
displayed in this {@code
FlutterFragment}.
*
*
* <p>Defaults to {@link RenderMode#surface}.
* <p>Defaults to {@link RenderMode#surface}.
*
*
...
@@ -1018,8 +1035,8 @@ public class FlutterFragment extends Fragment
...
@@ -1018,8 +1035,8 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Returns the desired {@link TransparencyMode} for the {@link
FlutterView} displayed in this
* Returns the desired {@link TransparencyMode} for the {@link
* {@code FlutterFragment}.
*
io.flutter.embedding.android.FlutterView} displayed in this
{@code FlutterFragment}.
*
*
* <p>Defaults to {@link TransparencyMode#transparent}.
* <p>Defaults to {@link TransparencyMode#transparent}.
*
*
...
@@ -1176,8 +1193,8 @@ public class FlutterFragment extends Fragment
...
@@ -1176,8 +1193,8 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Invoked after the {@link
FlutterView} within this {@code FlutterFragment} starts rendering
* Invoked after the {@link
io.flutter.embedding.android.FlutterView} within this {@code
* pixels to the screen.
*
FlutterFragment} starts rendering
pixels to the screen.
*
*
* <p>This method forwards {@code onFlutterUiDisplayed()} to its attached {@code Activity}, if the
* <p>This method forwards {@code onFlutterUiDisplayed()} to its attached {@code Activity}, if the
* attached {@code Activity} implements {@link FlutterUiDisplayListener}.
* attached {@code Activity} implements {@link FlutterUiDisplayListener}.
...
@@ -1195,8 +1212,8 @@ public class FlutterFragment extends Fragment
...
@@ -1195,8 +1212,8 @@ public class FlutterFragment extends Fragment
}
}
/**
/**
* Invoked after the {@link
FlutterView} within this {@code FlutterFragment} stops rendering
* Invoked after the {@link
io.flutter.embedding.android.FlutterView} within this {@code
* pixels to the screen.
*
FlutterFragment} stops rendering
pixels to the screen.
*
*
* <p>This method forwards {@code onFlutterUiNoLongerDisplayed()} to its attached {@code
* <p>This method forwards {@code onFlutterUiNoLongerDisplayed()} to its attached {@code
* Activity}, if the attached {@code Activity} implements {@link FlutterUiDisplayListener}.
* Activity}, if the attached {@code Activity} implements {@link FlutterUiDisplayListener}.
...
...
shell/platform/android/io/flutter/util/ViewUtils.java
浏览文件 @
438a29cb
...
@@ -7,6 +7,8 @@ package io.flutter.util;
...
@@ -7,6 +7,8 @@ package io.flutter.util;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.ContextWrapper
;
import
android.content.ContextWrapper
;
import
android.os.Build
;
import
android.view.View
;
public
final
class
ViewUtils
{
public
final
class
ViewUtils
{
/**
/**
...
@@ -28,4 +30,19 @@ public final class ViewUtils {
...
@@ -28,4 +30,19 @@ public final class ViewUtils {
}
}
return
null
;
return
null
;
}
}
/**
* Generates a view id.
*
* <p>In API level 17 and above, this ID is unique. Below 17, the fallback id is used instead.
*
* @param fallbackId the fallback id.
* @return the view id.
*/
public
static
int
generateViewId
(
int
fallbackId
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
return
View
.
generateViewId
();
}
return
fallbackId
;
}
}
}
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
浏览文件 @
438a29cb
...
@@ -86,7 +86,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -86,7 +86,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// We're testing lifecycle behaviors, which require/expect that certain methods have already
// We're testing lifecycle behaviors, which require/expect that certain methods have already
// been executed by the time they run. Therefore, we run those expected methods first.
// been executed by the time they run. Therefore, we run those expected methods first.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// By the time an Activity/Fragment is started, we don't expect any lifecycle messages
// By the time an Activity/Fragment is started, we don't expect any lifecycle messages
...
@@ -164,7 +164,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -164,7 +164,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// The FlutterEngine is obtained in onAttach().
// The FlutterEngine is obtained in onAttach().
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
...
@@ -220,7 +220,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -220,7 +220,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
// Verify that the host was asked to configure a FlutterSurfaceView.
// Verify that the host was asked to configure a FlutterSurfaceView.
verify
(
mockHost
,
times
(
1
)).
onFlutterSurfaceViewCreated
(
notNull
(
FlutterSurfaceView
.
class
));
verify
(
mockHost
,
times
(
1
)).
onFlutterSurfaceViewCreated
(
notNull
(
FlutterSurfaceView
.
class
));
...
@@ -249,7 +249,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -249,7 +249,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
// Verify that the host was asked to configure a FlutterTextureView.
// Verify that the host was asked to configure a FlutterTextureView.
verify
(
customMockHost
,
times
(
1
)).
onFlutterTextureViewCreated
(
notNull
(
FlutterTextureView
.
class
));
verify
(
customMockHost
,
times
(
1
)).
onFlutterTextureViewCreated
(
notNull
(
FlutterTextureView
.
class
));
...
@@ -282,7 +282,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -282,7 +282,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// The initial route is sent in onStart().
// The initial route is sent in onStart().
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
// Verify that the navigation channel was given our initial route.
// Verify that the navigation channel was given our initial route.
...
@@ -306,7 +306,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -306,7 +306,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Dart is executed in onStart().
// Dart is executed in onStart().
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
// Verify that the host's Dart entrypoint was used.
// Verify that the host's Dart entrypoint was used.
...
@@ -335,7 +335,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -335,7 +335,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Dart is executed in onStart().
// Dart is executed in onStart().
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
// Verify that the host's Dart entrypoint was used.
// Verify that the host's Dart entrypoint was used.
...
@@ -647,7 +647,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -647,7 +647,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Push the delegate through all lifecycle methods all the way to destruction.
// Push the delegate through all lifecycle methods all the way to destruction.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
@@ -671,7 +671,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -671,7 +671,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Push the delegate through all lifecycle methods all the way to destruction.
// Push the delegate through all lifecycle methods all the way to destruction.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
@@ -702,7 +702,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -702,7 +702,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Push the delegate through all lifecycle methods all the way to destruction.
// Push the delegate through all lifecycle methods all the way to destruction.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
@@ -734,7 +734,7 @@ public class FlutterActivityAndFragmentDelegateTest {
...
@@ -734,7 +734,7 @@ public class FlutterActivityAndFragmentDelegateTest {
// --- Execute the behavior under test ---
// --- Execute the behavior under test ---
// Push the delegate through all lifecycle methods all the way to destruction.
// Push the delegate through all lifecycle methods all the way to destruction.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
...
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityTest.java
浏览文件 @
438a29cb
...
@@ -77,6 +77,7 @@ public class FlutterActivityTest {
...
@@ -77,6 +77,7 @@ public class FlutterActivityTest {
activity
.
onCreate
(
null
);
activity
.
onCreate
(
null
);
assertNotNull
(
activity
.
findViewById
(
FlutterActivity
.
FLUTTER_VIEW_ID
));
assertNotNull
(
activity
.
findViewById
(
FlutterActivity
.
FLUTTER_VIEW_ID
));
assertTrue
(
activity
.
findViewById
(
FlutterActivity
.
FLUTTER_VIEW_ID
)
instanceof
FlutterView
);
}
}
@Test
@Test
...
...
shell/platform/android/test/io/flutter/embedding/android/FlutterAndroidComponentTest.java
浏览文件 @
438a29cb
...
@@ -82,7 +82,7 @@ public class FlutterAndroidComponentTest {
...
@@ -82,7 +82,7 @@ public class FlutterAndroidComponentTest {
assertNotNull
(
binding
.
getPlatformViewRegistry
());
assertNotNull
(
binding
.
getPlatformViewRegistry
());
delegate
.
onRestoreInstanceState
(
null
);
delegate
.
onRestoreInstanceState
(
null
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
@@ -156,7 +156,7 @@ public class FlutterAndroidComponentTest {
...
@@ -156,7 +156,7 @@ public class FlutterAndroidComponentTest {
// Verify that after Activity creation, the plugin was allowed to restore state.
// Verify that after Activity creation, the plugin was allowed to restore state.
verify
(
mockSaveStateListener
,
times
(
1
)).
onRestoreInstanceState
(
any
(
Bundle
.
class
));
verify
(
mockSaveStateListener
,
times
(
1
)).
onRestoreInstanceState
(
any
(
Bundle
.
class
));
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
@@ -195,7 +195,7 @@ public class FlutterAndroidComponentTest {
...
@@ -195,7 +195,7 @@ public class FlutterAndroidComponentTest {
// Push the delegate through all lifecycle methods all the way to destruction.
// Push the delegate through all lifecycle methods all the way to destruction.
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
delegate
.
onRestoreInstanceState
(
null
);
delegate
.
onRestoreInstanceState
(
null
);
delegate
.
onCreateView
(
null
,
null
,
null
);
delegate
.
onCreateView
(
null
,
null
,
null
,
0
);
delegate
.
onStart
();
delegate
.
onStart
();
delegate
.
onResume
();
delegate
.
onResume
();
delegate
.
onPause
();
delegate
.
onPause
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录