Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3862e1f5
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3862e1f5
编写于
5月 19, 2023
作者:
Y
yanghf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add description info and content for demo.
Signed-off-by:
N
yanghf
<
yanghefei1@huawei.com
>
上级
13200480
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
105 addition
and
5 deletion
+105
-5
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-remotewindow.md
...ev/reference/arkui-ts/ts-basic-components-remotewindow.md
+105
-5
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-remotewindow.md
浏览文件 @
3862e1f5
...
@@ -56,20 +56,120 @@ RemoteWindow(target: WindowAnimationTarget)
...
@@ -56,20 +56,120 @@ RemoteWindow(target: WindowAnimationTarget)
支持
[
通用事件
](
ts-universal-events-click.md
)
。
支持
[
通用事件
](
ts-universal-events-click.md
)
。
## 示例
## 示例
RemoteWindow需要接收由
[
windowAnimationManager
](
../apis/js-apis-windowAnimationManager.md
)
设置的WindowAnimationController对象传入对应窗口WindowAnimationTarget对象,可以创建一个RemoteWindowExample.ets作为示例组件将RemoteWindow组件和传入的WindowAnimationTarget对象关联封装起来。
由于RemoteWindow只能用于系统应用程序Launcher中,可以将RemoteWindowExample组件放置于Launcher的EntryView.ets页面的build函数中,编译Launcher, 然后推送Launcher安装包到设备系统中运行。
```
ts
```
ts
// xxx.ets
// WindowAnimationControllerImpl.ets 文件
import
windowAnimationManager
from
'
@ohos.animation.windowAnimationManager
'
;
export
default
class
WindowAnimationControllerImpl
implements
windowAnimationManager
.
WindowAnimationController
{
onStartAppFromLauncher
(
startingWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onStartAppFromLauncher`
);
finishedCallback
.
onAnimationFinish
();
}
onStartAppFromRecent
(
startingWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onStartAppFromRecent`
);
finishedCallback
.
onAnimationFinish
();
}
onStartAppFromOther
(
startingWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onStartAppFromOther`
);
finishedCallback
.
onAnimationFinish
();
}
onAppTransition
(
fromWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
toWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onAppTransition`
);
finishedCallback
.
onAnimationFinish
();
}
onMinimizeWindow
(
minimizingWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onMinimizeWindow`
);
finishedCallback
.
onAnimationFinish
();
}
onCloseWindow
(
closingWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onCloseWindow`
);
finishedCallback
.
onAnimationFinish
();
}
onScreenUnlock
(
finishedCallback
:
windowAnimationManager
.
WindowAnimationFinishedCallback
):
void
{
console
.
log
(
`remote window animaion onScreenUnlock`
);
finishedCallback
.
onAnimationFinish
();
}
onWindowAnimationTargetsUpdate
(
fullScreenWindowTarget
:
windowAnimationManager
.
WindowAnimationTarget
,
floatingWindowTargets
:
Array
<
windowAnimationManager
.
WindowAnimationTarget
>
):
void
{
console
.
log
(
'
onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is:
'
+
fullScreenWindowTarget
);
console
.
log
(
'
onWindowAnimationTargetsUpdate, the floatingWindowTargets are:
'
+
floatingWindowTargets
);
}
}
```
```
ts
// RemoteWindowExample.ets 文件
import
windowAnimationManager
from
'
@ohos.animation.windowAnimationManager
'
;
import
WindowAnimationControllerImpl
from
'
../animation/remoteanimation/WindowAnimationControllerImpl
'
;
@
Entry
@
Entry
@
Component
@
Component
struct
RemoteWindowExample
{
export
default
struct
RemoteWindowExample
{
@
State
target
:
WindowAnimationTarget
=
undefined
// 通过windowAnimationManager获取
@
State
target
:
WindowAnimationTarget
=
undefined
// 通过windowAnimationManager获取
aboutToAppear
():
void
{
let
controller
=
new
WindowAnimationControllerImpl
();
windowAnimationManager
.
setController
(
controller
);
controller
.
onStartAppFromLauncher
=
(
startingWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onStartAppFromLauncher`
);
this
.
target
=
startingWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
controller
.
onStartAppFromRecent
=
(
startingWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onStartAppFromRecent`
);
this
.
target
=
startingWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
controller
.
onStartAppFromOther
=
(
startingWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onStartAppFromOther`
);
this
.
target
=
startingWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
controller
.
onAppTransition
=
(
fromWindowTarget
,
toWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onAppTransition`
);
this
.
target
=
toWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
controller
.
onMinimizeWindow
=
(
minimizingWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onMinimizeWindow`
);
this
.
target
=
minimizingWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
controller
.
onCloseWindow
=
(
closingWindowTarget
,
finishedCallback
)
=>
{
console
.
log
(
`RemoteWindowExample: remote window animaion onCloseWindow`
);
this
.
target
=
closingWindowTarget
;
finishedCallback
.
onAnimationFinish
();
}
}
build
()
{
build
()
{
Column
()
{
Column
()
{
RemoteWindow
(
this
.
target
)
RemoteWindow
(
this
.
target
)
.
translate
({
x
:
100
,
y
:
200
})
.
scale
({
x
:
0.5
,
y
:
0.5
})
// 仅用于可见效果的演示目的,正常使用须 .scale({ x: 1, y: 1 })
.
scale
({
x
:
0.5
,
y
:
0.5
})
.
opacity
(
0.8
)
.
position
({
x
:
px2vp
(
this
.
target
?.
windowBounds
.
left
),
y
:
px2vp
(
this
.
target
?.
windowBounds
.
top
)
})
.
position
({
x
:
px2vp
(
this
.
target
?.
windowBounds
.
left
),
y
:
px2vp
(
this
.
target
?.
windowBounds
.
top
)
})
.
width
(
px2vp
(
this
.
target
?.
windowBounds
.
width
))
.
width
(
px2vp
(
this
.
target
?.
windowBounds
.
width
))
.
height
(
px2vp
(
this
.
target
?.
windowBounds
.
height
))
.
height
(
px2vp
(
this
.
target
?.
windowBounds
.
height
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录