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

!8475 适配多设备

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