未验证 提交 6a2dd89c 编写于 作者: O openharmony_ci 提交者: Gitee

!8475 适配多设备

Merge pull request !8475 from jerry/master
......@@ -18,10 +18,12 @@ import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:SupportFunction:MainAbility:";
var listPush1 = "Fa_SupportFunction_MainAbility_";
var lifeList = [];
var lifeListActive = [];
export default {
onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
lifeListActive.push('onCreate');
ability_featureAbility.getWant().then((data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
......@@ -31,6 +33,7 @@ export default {
ability_featureAbility.getContext().setWakeUpScreen(true).then((data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
lifeList.push('wakeUpScreen');
lifeListActive.push('wakeUpScreen');
let options = {
parameters: {
lifeList: lifeList
......@@ -51,6 +54,7 @@ export default {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error));
lifeList.push('wakeUpScreen');
lifeListActive.push('wakeUpScreen');
let options = {
parameters: {
lifeList: lifeList
......@@ -66,6 +70,7 @@ export default {
ability_featureAbility.getContext().setWakeUpScreen(false).then((data) => {
console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data));
lifeList.push('wakeUpScreen');
lifeListActive.push('wakeUpScreen');
let options = {
parameters: {
lifeList: lifeList
......@@ -90,11 +95,11 @@ export default {
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
lifeListActive.push('onActive');
let options = {
parameters: {
lifeList: lifeList
lifeList: lifeListActive
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
......
......@@ -18,10 +18,12 @@ import commonEvent from '@ohos.commonEvent';
var TAG1 = "Fa:SupportFunction:MainAbility2:";
var listPush1 = "Fa_SupportFunction_MainAbility2_";
var lifeList = [];
var lifeListActive = [];
export default {
async onCreate() {
console.log(TAG1 + 'onCreate');
lifeList.push('onCreate');
lifeListActive.push('onCreate');
ability_featureAbility.getWant().then(async (data) => {
console.log(TAG1 + "getWant data = " + JSON.stringify(data));
......@@ -43,6 +45,7 @@ export default {
}
await sleep(300);
lifeList.push('wakeUpScreen');
lifeListActive.push('wakeUpScreen');
let options = {
parameters: {
lifeList: lifeList
......@@ -60,11 +63,11 @@ export default {
},
onActive() {
console.log(TAG1 + 'onActive');
lifeList.push('onActive');
lifeListActive.push('onActive');
let options = {
parameters: {
lifeList: lifeList
lifeList: lifeListActive
}
}
commonEvent.publish(listPush1 + "onActive", options, (err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册