Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
33c15107
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
33c15107
编写于
8月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4957 元能力新增用例
Merge pull request !4957 from chengxingzhen/master
上级
178aa719
bfe7a535
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
1429 addition
and
1 deletion
+1429
-1
ability/ability_runtime/actssupportfunction/BUILD.gn
ability/ability_runtime/actssupportfunction/BUILD.gn
+2
-0
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json
...ime/actssupportfunction/actssupportfunctiontest/Test.json
+3
-1
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets
...supportfunctiontest/entry/src/main/ets/test/List.test.ets
+2
-0
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
...ntest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
+610
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/BUILD.gn
...ity_runtime/actssupportfunction/faonandoffscreen/BUILD.gn
+37
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json
...pportfunction/faonandoffscreen/entry/src/main/config.json
+70
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets
...n/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets
+70
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/pages/index.ets
...doffscreen/entry/src/main/ets/MainAbility/pages/index.ets
+46
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/color.json
...ffscreen/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/string.json
...fscreen/entry/src/main/resources/base/element/string.json
+16
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/media/icon.png
...andoffscreen/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actssupportfunction/faonandoffscreen/signature/openharmony_sx.p7b
...ortfunction/faonandoffscreen/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/app.json
...actssupportfunction/stageonandoffscreen/AppScope/app.json
+21
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/element/string.json
...nandoffscreen/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/media/app_icon.png
...onandoffscreen/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/BUILD.gn
..._runtime/actssupportfunction/stageonandoffscreen/BUILD.gn
+43
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/Application/MyAbilityStage.ts
...ffscreen/entry/src/main/ets/Application/MyAbilityStage.ts
+22
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts
...ndoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts
+75
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts
...offscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts
+89
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts
...offscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts
+61
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/index.ets
...on/stageonandoffscreen/entry/src/main/ets/pages/index.ets
+46
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/second.ets
...n/stageonandoffscreen/entry/src/main/ets/pages/second.ets
+46
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/third.ets
...on/stageonandoffscreen/entry/src/main/ets/pages/third.ets
+46
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json
...rtfunction/stageonandoffscreen/entry/src/main/module.json
+61
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/color.json
...ffscreen/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/string.json
...fscreen/entry/src/main/resources/base/element/string.json
+32
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/media/icon.png
...andoffscreen/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/profile/main_pages.json
...een/entry/src/main/resources/base/profile/main_pages.json
+7
-0
ability/ability_runtime/actssupportfunction/stageonandoffscreen/signature/openharmony_sx.p7b
...function/stageonandoffscreen/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/actssupportfunction/BUILD.gn
浏览文件 @
33c15107
...
...
@@ -18,8 +18,10 @@ group("actssupportfunction") {
if (is_standard_system) {
deps = [
"actssupportfunctiontest:ActsSupportFunctionTest",
"faonandoffscreen:FaOnAndOffScreen",
"fasupportfunction:fasupportfunction",
"fasupportfunctionthree:fasupportfunctionthree",
"stageonandoffscreen:StageOnAndOffScreen",
"stagesupportfunction:StageSupportFunction",
]
}
...
...
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json
浏览文件 @
33c15107
...
...
@@ -15,7 +15,9 @@
"FaSupportFunction.hap"
,
"FaSupportFunctionTwo.hap"
,
"FaSupportFunctionThree.hap"
,
"StageSupportFunction.hap"
"StageSupportFunction.hap"
,
"FaOnAndOffScreen.hap"
,
"StageOnAndOffScreen.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
...
...
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets
浏览文件 @
33c15107
...
...
@@ -15,9 +15,11 @@
import abilityIsTerminatingTest from './AbilityIsTerminating.test';
import faSetDisplayOrientation from './FaSetDisplayOrientation.test';
import faShowOnLock from './FaShowOnLock.test';
import onAndOffScreenTest from './OnAndOffScreenTest.test';
export default function testsuite() {
abilityIsTerminatingTest();
faSetDisplayOrientation();
faShowOnLock();
onAndOffScreenTest();
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
0 → 100644
浏览文件 @
33c15107
此差异已折叠。
点击以展开。
ability/ability_runtime/actssupportfunction/faonandoffscreen/BUILD.gn
0 → 100644
浏览文件 @
33c15107
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("FaOnAndOffScreen") {
hap_name = "FaOnAndOffScreen"
hap_profile = "./entry/src/main/config.json"
testonly = true
deps = [
":faonandoffscreen_resources",
":faonandoffscreen_ts_assets",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("faonandoffscreen_ts_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("faonandoffscreen_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json
0 → 100644
浏览文件 @
33c15107
{
"app"
:
{
"bundleName"
:
"ohos.acts.aafwk.test.faonandoffscreen"
,
"vendor"
:
"huawei"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
9
,
"target"
:
9
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.aafwk.test.faonandoffscreen"
,
"name"
:
".entry"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"ets"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:FaOnAndOffScreen:MainAbility:";
var listPush1 = "FaOnAndOffScreen_MainAbility_";
var lifeList = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
},
onDestroy() {
console.log(TAG1 + 'onDestroy');
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
commonEvent.publish(listPush1 + "onActive", (err) => {
console.log(TAG1 + listPush1 + "onActive");
});
},
onInactive() {
console.log(TAG1 + 'onInactive');
lifeList.push('onInactive');
},
onShow() {
console.log(TAG1 + 'onShow');
lifeList.push('onShow');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onShow", options, (err) => {
console.log(TAG1 + listPush1 + "onShow");
});
},
onHide() {
console.log(TAG1 + 'onHide');
lifeList.push('onHide');
let options = {
parameters: {
lifeList: lifeList
}
}
commonEvent.publish(listPush1 + "onHide", options, (err) => {
console.log(TAG1 + listPush1 + "onHide");
});
},
onNewWant(want) {
console.log(TAG1 + 'onNewWant');
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World FaOnAndOffScreen 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('FaOnAndOffScreen_MainAbility1')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
33c15107
{
"color"
:
[
{
"name"
:
"white"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
33c15107
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"FaOnAndOffScreen"
}
]
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
33c15107
6.6 KB
ability/ability_runtime/actssupportfunction/faonandoffscreen/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
33c15107
文件已添加
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/app.json
0 → 100644
浏览文件 @
33c15107
{
"app"
:
{
"bundleName"
:
"ohos.acts.aafwk.test.stageonandoffscreen"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"debug"
:
false
,
"description"
:
"$string:app_name"
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:
{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
33c15107
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"actsfstageonandoffscreen"
}
]
}
ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
33c15107
6.6 KB
ability/ability_runtime/actssupportfunction/stageonandoffscreen/BUILD.gn
0 → 100644
浏览文件 @
33c15107
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("StageOnAndOffScreen") {
hap_name = "StageOnAndOffScreen"
hap_profile = "entry/src/main/module.json"
testonly = true
deps = [
":stageonandoffscreen_js_assets",
":stageonandoffscreen_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("stageonandoffscreen_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("stageonandoffscreen_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("stageonandoffscreen_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":stageonandoffscreen_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/Application/MyAbilityStage.ts
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
AbilityStage
from
"
@ohos.application.AbilityStage
"
;
var
TAG0
=
'
StageOnAndOffScreen:AbilityStage:
'
;
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
TAG0
+
"
onCreate
"
)
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
var
TAG1
=
'
StageOnAndOffScreen:MainAbility:
'
;
var
listPush1
=
"
StageOnAndOffScreen_MainAbility_
"
;
var
lifeList
=
[];
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
TAG1
+
'
onCreate
'
);
lifeList
.
push
(
'
onCreate
'
);
}
onDestroy
()
{
console
.
log
(
TAG1
+
'
onDestroy
'
);
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
TAG1
+
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
"
pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
TAG1
+
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
TAG1
+
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
});
}
onWindowStageDestroy
()
{
console
.
log
(
TAG1
+
'
onWindowStageDestroy
'
);
}
onForeground
()
{
console
.
log
(
TAG1
+
'
onForeground
'
);
lifeList
.
push
(
'
onForeground
'
);
let
options
=
{
parameters
:
{
lifeList
:
lifeList
}
}
commonEvent
.
publish
(
listPush1
+
"
onForeground
"
,
options
,
(
err
)
=>
{
console
.
log
(
TAG1
+
listPush1
+
"
onForeground
"
);
});
}
onBackground
()
{
console
.
log
(
TAG1
+
'
onBackground
'
);
lifeList
.
push
(
'
onBackground
'
);
let
options
=
{
parameters
:
{
lifeList
:
lifeList
}
}
commonEvent
.
publish
(
listPush1
+
"
onBackground
"
,
options
,
(
err
)
=>
{
console
.
log
(
TAG1
+
listPush1
+
"
onBackground
"
);
});
}
};
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
var
TAG2
=
'
StageOnAndOffScreen:MainAbility2:
'
;
var
listPush2
=
"
StageOnAndOffScreen_MainAbility2_
"
;
export
default
class
MainAbility2
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
TAG2
+
'
onCreate
'
);
commonEvent
.
publish
(
listPush2
+
"
onCreate
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onCreate
"
);
});
}
onDestroy
()
{
console
.
log
(
TAG2
+
'
onDestroy
'
);
commonEvent
.
publish
(
listPush2
+
"
onDestroy
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onDestroy
"
);
});
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
TAG2
+
'
onWindowStageCreate
'
);
commonEvent
.
publish
(
listPush2
+
"
onWindowStageCreate
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onWindowStageCreate
"
);
});
windowStage
.
loadContent
(
"
pages/second
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
TAG2
+
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
TAG2
+
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
});
}
onWindowStageDestroy
()
{
console
.
log
(
TAG2
+
'
onWindowStageDestroy
'
);
commonEvent
.
publish
(
listPush2
+
"
onWindowStageDestroy
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onWindowStageDestroy
"
);
});
}
onForeground
()
{
console
.
log
(
TAG2
+
'
onForeground
'
);
commonEvent
.
publish
(
listPush2
+
"
onForeground
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onForeground
"
);
});
setTimeout
(
async
()
=>
{
let
wantNum
=
{
bundleName
:
"
ohos.acts.aafwk.test.stageonandoffscreen
"
,
abilityName
:
"
MainAbility3
"
}
this
.
context
.
startAbility
(
wantNum
).
then
((
data
)
=>
{
console
.
log
(
TAG2
+
"
startAbility data =
"
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
TAG2
+
"
startAbility error =
"
+
JSON
.
stringify
(
error
));
})
},
1000
);
}
onBackground
()
{
console
.
log
(
TAG2
+
'
onBackground
'
);
commonEvent
.
publish
(
listPush2
+
"
onBackground
"
,
(
err
)
=>
{
console
.
log
(
TAG2
+
listPush2
+
"
onBackground
"
);
});
}
};
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
var
TAG3
=
'
StageOnAndOffScreen:MainAbility3:
'
;
var
listPush3
=
"
StageOnAndOffScreen_MainAbility3_
"
;
export
default
class
MainAbility3
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
TAG3
+
'
onCreate
'
);
}
onDestroy
()
{
console
.
log
(
TAG3
+
'
onDestroy
'
);
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
TAG3
+
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
"
pages/third
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
log
(
TAG3
+
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
TAG3
+
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
});
}
onWindowStageDestroy
()
{
console
.
log
(
TAG3
+
'
onWindowStageDestroy
'
);
}
onForeground
()
{
console
.
log
(
TAG3
+
'
onForeground
'
);
commonEvent
.
publish
(
listPush3
+
"
onForeground
"
,
(
err
)
=>
{
console
.
log
(
TAG3
+
listPush3
+
"
onForeground
"
);
});
}
onBackground
()
{
console
.
log
(
TAG3
+
'
onBackground
'
);
commonEvent
.
publish
(
listPush3
+
"
onBackground
"
,
(
err
)
=>
{
console
.
log
(
TAG3
+
listPush3
+
"
onBackground
"
);
});
}
};
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/index.ets
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World StageOnAndOffScreen 1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility1')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/second.ets
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Second {
@State message: string = 'Hello World StageOnAndOffScreen 2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility2')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/third.ets
0 → 100644
浏览文件 @
33c15107
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Third {
@State message: string = 'Hello World StageOnAndOffScreen 3'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Row() {
Button() {
Text('StageOnAndOffScreen_MainAbility3')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('30%')
.height('5%')
.onClick(()=>{
})
}
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json
0 → 100644
浏览文件 @
33c15107
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/MyAbilityStage.ts"
,
"description"
:
"$string:entry_desc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"phone"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"uiSyntax"
:
"ets"
,
"abilities"
:
[
{
"name"
:
"MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:MainAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:MainAbility_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"launchType"
:
"singleton"
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
]
},
{
"name"
:
"MainAbility2"
,
"srcEntrance"
:
"./ets/MainAbility2/MainAbility2.ts"
,
"description"
:
"$string:MainAbility2_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:MainAbility2_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"launchType"
:
"singleton"
},
{
"name"
:
"MainAbility3"
,
"srcEntrance"
:
"./ets/MainAbility3/MainAbility3.ts"
,
"description"
:
"$string:MainAbility3_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:MainAbility3_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
33c15107
{
"color"
:
[
{
"name"
:
"white"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
33c15107
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"StageOnAndOffScreen"
},
{
"name"
:
"MainAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility2_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility3_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility3_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
33c15107
6.6 KB
ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
33c15107
{
"src"
:
[
"pages/index"
,
"pages/second"
,
"pages/third"
]
}
ability/ability_runtime/actssupportfunction/stageonandoffscreen/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
33c15107
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录