From b5248c1f1ade323c01b4e78cd28aef37b258ba4c Mon Sep 17 00:00:00 2001 From: wsl <1105069392@qq.com> Date: Thu, 18 Sep 2025 12:04:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?ide=E9=80=82=E9=85=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wsl <1105069392@qq.com> --- .../main/ets/entryability/EntryAbility.ets | 6 +- .../entry/src/main/ets/pages/segment1.ets | 147 ++++++++++++++++ .../entry/src/main/ets/pages/segment2.ets | 166 ++++++++++++++++++ .../main/ets/entryability/EntryAbility.ets | 6 +- .../main/ets/entryability/EntryAbility.ets | 6 +- .../main/ets/entryability/EntryAbility.ets | 6 +- .../main/ets/entryability/EntryAbility.ets | 6 +- 7 files changed, 338 insertions(+), 5 deletions(-) create mode 100644 AppFreeze/entry/src/main/ets/pages/segment1.ets create mode 100644 AppFreeze/entry/src/main/ets/pages/segment2.ets diff --git a/AppFreeze/entry/src/main/ets/entryability/EntryAbility.ets b/AppFreeze/entry/src/main/ets/entryability/EntryAbility.ets index 508880af..a7e8ad07 100644 --- a/AppFreeze/entry/src/main/ets/entryability/EntryAbility.ets +++ b/AppFreeze/entry/src/main/ets/entryability/EntryAbility.ets @@ -6,7 +6,11 @@ const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/AppFreeze/entry/src/main/ets/pages/segment1.ets b/AppFreeze/entry/src/main/ets/pages/segment1.ets new file mode 100644 index 00000000..b85dacaa --- /dev/null +++ b/AppFreeze/entry/src/main/ets/pages/segment1.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2025 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. + */ +// [Start Case1] +// constant declaration +const animationDuration: number = 500; // Move animation duration +const opacityChangeValue: number = 0.1; // The value of each change in opacity +const opacityChangeRange: number = 1; // Range of opacity changes +const translateYChangeValue: number = 180; // The value of translateY each time it changes +const translateYChangeRange: number = 250; // The range in which translateY changes +const scaleXChangeValue: number = 0.6; // The value of scaleX for each change +const scaleXChangeRange: number = 0.8; // The value of scaleX for each change + +// Style Attribute Classes +class UIStyle { + public translateX: number = 0; + public translateY: number = 0; + public scaleX: number = 0.3; + public scaleY: number = 0.3; +} + +@Component +struct ComponentA { + @Link uiStyle: UIStyle; // Properties of uiStyle used by multiple components + + build() { + Column() { + // Components that use state variables + SpecialImage({ specialImageUiStyle: this.uiStyle }) + Column() { + // 需要替换为开发者所需的图像资源文件 + Image($r('app.media.startIcon')) + .height('150vp') + .width('150vp') + .scale({ + x: this.uiStyle.scaleX, + y: this.uiStyle.scaleY + }) + Text('Hello World') + .fontWeight(FontWeight.Bold) + } + .translate({ + x: this.uiStyle.translateX, + y: this.uiStyle.translateY + }) + .width('95%') + .height('200vp') + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + .borderRadius('16vp') + .backgroundColor(Color.White) + // Modify the value of a state variable via a button click callback, causing the corresponding component to refresh. + Column() { + Button('Move') + .width('80%') + .onClick(() => { + this.getUIContext().animateTo({ duration: animationDuration }, () => { + this.uiStyle.translateY = (this.uiStyle.translateY + translateYChangeValue) % translateYChangeRange; + }) + }) + Button('Scale') + .width('80%') + .onClick(() => { + this.uiStyle.scaleX = (this.uiStyle.scaleX + scaleXChangeValue) % scaleXChangeRange; + }) + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + } + .height('35%') + .justifyContent(FlexAlign.End) + .width('100%') + } + } +} + +@Component +struct SpecialImage { + @Link specialImageUiStyle: UIStyle; + private opacityNum: number = 0.5; // Default transparency + + private isRenderSpecialImage(): number { + // Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1. + this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; + return this.opacityNum; + } + + build() { + Column() { + // 需要替换为开发者所需的图像资源文件 + Image($r('app.media.startIcon')) + .size({ width: 78, height: 78 }) + .scale({ + x: this.specialImageUiStyle.scaleX, + y: this.specialImageUiStyle.scaleY + }) + .opacity(this.isRenderSpecialImage()) + Text("SpecialImage") + .fontWeight(FontWeight.Bold) + } + .width('95%') + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + .borderRadius('16vp') + .height('200vp') + .backgroundColor(Color.White) + } +} + + +@Entry +@Component +struct DFXStateBeforeOptimization { + @State uiStyle: UIStyle = new UIStyle(); + + build() { + Column() { + ComponentA({ + uiStyle: this.uiStyle + }) + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + } +} + +// [End Case1] \ No newline at end of file diff --git a/AppFreeze/entry/src/main/ets/pages/segment2.ets b/AppFreeze/entry/src/main/ets/pages/segment2.ets new file mode 100644 index 00000000..f1d9eb57 --- /dev/null +++ b/AppFreeze/entry/src/main/ets/pages/segment2.ets @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2025 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. + */ +// [Start Case2] +// constant declaration +const animationDuration: number = 500; // Move animation duration +const opacityChangeValue: number = 0.1; // The value of each change in opacity +const opacityChangeRange: number = 1; // Range of opacity changes +const translateYChangeValue: number = 180; // The value of translateY each time it changes +const translateYChangeRange: number = 250; // The range in which translateY changes +const scaleXChangeValue: number = 0.6; // The value of scaleX for each change +const scaleXChangeRange: number = 0.8; // The value of scaleX for each change + +// Style property class, nested ScaleStyle, TranslateStyle +@Observed +class UIStyle { + translateStyle: TranslateStyle = new TranslateStyle(); + scaleStyle: ScaleStyle = new ScaleStyle(); +} + +// Zoom Property Class +@Observed +class ScaleStyle { + public scaleX: number = 0.3; + public scaleY: number = 0.3; +} + +// Displacement Attribute Class +@Observed +class TranslateStyle { + public translateX: number = 0; + public translateY: number = 0; +} + +@Component +struct ComponentA { + @ObjectLink scaleStyle: ScaleStyle; + @ObjectLink translateStyle: TranslateStyle; + + build() { + Column() { + SpecialImage({ + specialImageScaleStyle: this.scaleStyle + }) + // Other UI components + Column() { + // 需要替换为开发者所需的图像资源文件 + Image($r('app.media.startIcon')) + .height('150vp') + .width('150vp') + .scale({ + x: this.scaleStyle.scaleX, + y: this.scaleStyle.scaleY + }) + Text('Hello World') + .fontWeight(FontWeight.Bold) + } + + .translate({ + x: this.translateStyle.translateX, + y: this.translateStyle.translateY + }) + .width('95%') + .height('200vp') + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + .borderRadius('16vp') + .backgroundColor(Color.White) + // Modify the value of a state variable via a button click callback, causing the corresponding component to refresh. + Column() { + Button('Move') + .width('80%') + .onClick(() => { + this.getUIContext().animateTo({ duration: animationDuration }, () => { + this.translateStyle.translateY = + (this.translateStyle.translateY + translateYChangeValue) % translateYChangeRange; + }) + }) + Button('Scale') + .width('80%') + .onClick(() => { + this.scaleStyle.scaleX = (this.scaleStyle.scaleX + scaleXChangeValue) % scaleXChangeRange; + }) + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + } + .height('35%') + .justifyContent(FlexAlign.End) + .width('100%') + } + } +} + +@Component +struct SpecialImage { + @Link specialImageScaleStyle: ScaleStyle; + private opacityNum: number = 0.5; // Default transparency + + // isRenderSpecialImage function + private isRenderSpecialImage(): number { + // Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1. + this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; + return this.opacityNum; + } + + build() { + Column() { + // 需要替换为开发者所需的图像资源文件 + Image($r('app.media.startIcon')) + .size({ width: 78, height: 78 }) + .scale({ + x: this.specialImageScaleStyle.scaleX, + y: this.specialImageScaleStyle.scaleY + }) + .opacity(this.isRenderSpecialImage()) + Text("SpecialImage") + .fontWeight(FontWeight.Bold) + } + .width('95%') + .margin({ + top: '10vp', + left: '15vp', + right: '15vp' + }) + .borderRadius('16vp') + .height('200vp') + .backgroundColor(Color.White) + } +} + +@Entry +@Component +struct DFXStateAfterOptimization { + @State uiStyle: UIStyle = new UIStyle(); + + build() { + Stack() { + ComponentA({ + scaleStyle: this.uiStyle.scaleStyle, + translateStyle: this.uiStyle.translateStyle, + }) + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + } +} + +// [End Case2] \ No newline at end of file diff --git a/CppCrash/entry/src/main/ets/entryability/EntryAbility.ets b/CppCrash/entry/src/main/ets/entryability/EntryAbility.ets index 508880af..a7e8ad07 100644 --- a/CppCrash/entry/src/main/ets/entryability/EntryAbility.ets +++ b/CppCrash/entry/src/main/ets/entryability/EntryAbility.ets @@ -6,7 +6,11 @@ const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/MemoryDetection/entry/src/main/ets/entryability/EntryAbility.ets b/MemoryDetection/entry/src/main/ets/entryability/EntryAbility.ets index 1098e966..d460e476 100644 --- a/MemoryDetection/entry/src/main/ets/entryability/EntryAbility.ets +++ b/MemoryDetection/entry/src/main/ets/entryability/EntryAbility.ets @@ -6,7 +6,11 @@ const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/NodeAPIDevelopment/entry/src/main/ets/entryability/EntryAbility.ets b/NodeAPIDevelopment/entry/src/main/ets/entryability/EntryAbility.ets index d3ee54d2..5dc88ee1 100644 --- a/NodeAPIDevelopment/entry/src/main/ets/entryability/EntryAbility.ets +++ b/NodeAPIDevelopment/entry/src/main/ets/entryability/EntryAbility.ets @@ -21,7 +21,11 @@ const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets index 508880af..a7e8ad07 100644 --- a/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets +++ b/PowerAnalysis/LowerPowerSample/entry/src/main/ets/entryability/EntryAbility.ets @@ -6,7 +6,11 @@ const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } -- Gitee From 0c24e594517822089ca40fd6be215c23d8d61326 Mon Sep 17 00:00:00 2001 From: wsl <1105069392@qq.com> Date: Thu, 18 Sep 2025 14:13:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wsl <1105069392@qq.com> --- .../entry/src/main/ets/pages/segment1.ets | 147 ---------------- .../entry/src/main/ets/pages/segment2.ets | 166 ------------------ 2 files changed, 313 deletions(-) delete mode 100644 AppFreeze/entry/src/main/ets/pages/segment1.ets delete mode 100644 AppFreeze/entry/src/main/ets/pages/segment2.ets diff --git a/AppFreeze/entry/src/main/ets/pages/segment1.ets b/AppFreeze/entry/src/main/ets/pages/segment1.ets deleted file mode 100644 index b85dacaa..00000000 --- a/AppFreeze/entry/src/main/ets/pages/segment1.ets +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2025 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. - */ -// [Start Case1] -// constant declaration -const animationDuration: number = 500; // Move animation duration -const opacityChangeValue: number = 0.1; // The value of each change in opacity -const opacityChangeRange: number = 1; // Range of opacity changes -const translateYChangeValue: number = 180; // The value of translateY each time it changes -const translateYChangeRange: number = 250; // The range in which translateY changes -const scaleXChangeValue: number = 0.6; // The value of scaleX for each change -const scaleXChangeRange: number = 0.8; // The value of scaleX for each change - -// Style Attribute Classes -class UIStyle { - public translateX: number = 0; - public translateY: number = 0; - public scaleX: number = 0.3; - public scaleY: number = 0.3; -} - -@Component -struct ComponentA { - @Link uiStyle: UIStyle; // Properties of uiStyle used by multiple components - - build() { - Column() { - // Components that use state variables - SpecialImage({ specialImageUiStyle: this.uiStyle }) - Column() { - // 需要替换为开发者所需的图像资源文件 - Image($r('app.media.startIcon')) - .height('150vp') - .width('150vp') - .scale({ - x: this.uiStyle.scaleX, - y: this.uiStyle.scaleY - }) - Text('Hello World') - .fontWeight(FontWeight.Bold) - } - .translate({ - x: this.uiStyle.translateX, - y: this.uiStyle.translateY - }) - .width('95%') - .height('200vp') - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - .borderRadius('16vp') - .backgroundColor(Color.White) - // Modify the value of a state variable via a button click callback, causing the corresponding component to refresh. - Column() { - Button('Move') - .width('80%') - .onClick(() => { - this.getUIContext().animateTo({ duration: animationDuration }, () => { - this.uiStyle.translateY = (this.uiStyle.translateY + translateYChangeValue) % translateYChangeRange; - }) - }) - Button('Scale') - .width('80%') - .onClick(() => { - this.uiStyle.scaleX = (this.uiStyle.scaleX + scaleXChangeValue) % scaleXChangeRange; - }) - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - } - .height('35%') - .justifyContent(FlexAlign.End) - .width('100%') - } - } -} - -@Component -struct SpecialImage { - @Link specialImageUiStyle: UIStyle; - private opacityNum: number = 0.5; // Default transparency - - private isRenderSpecialImage(): number { - // Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1. - this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; - return this.opacityNum; - } - - build() { - Column() { - // 需要替换为开发者所需的图像资源文件 - Image($r('app.media.startIcon')) - .size({ width: 78, height: 78 }) - .scale({ - x: this.specialImageUiStyle.scaleX, - y: this.specialImageUiStyle.scaleY - }) - .opacity(this.isRenderSpecialImage()) - Text("SpecialImage") - .fontWeight(FontWeight.Bold) - } - .width('95%') - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - .borderRadius('16vp') - .height('200vp') - .backgroundColor(Color.White) - } -} - - -@Entry -@Component -struct DFXStateBeforeOptimization { - @State uiStyle: UIStyle = new UIStyle(); - - build() { - Column() { - ComponentA({ - uiStyle: this.uiStyle - }) - } - .width('100%') - .height('100%') - .backgroundColor(0xDCDCDC) - } -} - -// [End Case1] \ No newline at end of file diff --git a/AppFreeze/entry/src/main/ets/pages/segment2.ets b/AppFreeze/entry/src/main/ets/pages/segment2.ets deleted file mode 100644 index f1d9eb57..00000000 --- a/AppFreeze/entry/src/main/ets/pages/segment2.ets +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2025 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. - */ -// [Start Case2] -// constant declaration -const animationDuration: number = 500; // Move animation duration -const opacityChangeValue: number = 0.1; // The value of each change in opacity -const opacityChangeRange: number = 1; // Range of opacity changes -const translateYChangeValue: number = 180; // The value of translateY each time it changes -const translateYChangeRange: number = 250; // The range in which translateY changes -const scaleXChangeValue: number = 0.6; // The value of scaleX for each change -const scaleXChangeRange: number = 0.8; // The value of scaleX for each change - -// Style property class, nested ScaleStyle, TranslateStyle -@Observed -class UIStyle { - translateStyle: TranslateStyle = new TranslateStyle(); - scaleStyle: ScaleStyle = new ScaleStyle(); -} - -// Zoom Property Class -@Observed -class ScaleStyle { - public scaleX: number = 0.3; - public scaleY: number = 0.3; -} - -// Displacement Attribute Class -@Observed -class TranslateStyle { - public translateX: number = 0; - public translateY: number = 0; -} - -@Component -struct ComponentA { - @ObjectLink scaleStyle: ScaleStyle; - @ObjectLink translateStyle: TranslateStyle; - - build() { - Column() { - SpecialImage({ - specialImageScaleStyle: this.scaleStyle - }) - // Other UI components - Column() { - // 需要替换为开发者所需的图像资源文件 - Image($r('app.media.startIcon')) - .height('150vp') - .width('150vp') - .scale({ - x: this.scaleStyle.scaleX, - y: this.scaleStyle.scaleY - }) - Text('Hello World') - .fontWeight(FontWeight.Bold) - } - - .translate({ - x: this.translateStyle.translateX, - y: this.translateStyle.translateY - }) - .width('95%') - .height('200vp') - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - .borderRadius('16vp') - .backgroundColor(Color.White) - // Modify the value of a state variable via a button click callback, causing the corresponding component to refresh. - Column() { - Button('Move') - .width('80%') - .onClick(() => { - this.getUIContext().animateTo({ duration: animationDuration }, () => { - this.translateStyle.translateY = - (this.translateStyle.translateY + translateYChangeValue) % translateYChangeRange; - }) - }) - Button('Scale') - .width('80%') - .onClick(() => { - this.scaleStyle.scaleX = (this.scaleStyle.scaleX + scaleXChangeValue) % scaleXChangeRange; - }) - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - } - .height('35%') - .justifyContent(FlexAlign.End) - .width('100%') - } - } -} - -@Component -struct SpecialImage { - @Link specialImageScaleStyle: ScaleStyle; - private opacityNum: number = 0.5; // Default transparency - - // isRenderSpecialImage function - private isRenderSpecialImage(): number { - // Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1. - this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; - return this.opacityNum; - } - - build() { - Column() { - // 需要替换为开发者所需的图像资源文件 - Image($r('app.media.startIcon')) - .size({ width: 78, height: 78 }) - .scale({ - x: this.specialImageScaleStyle.scaleX, - y: this.specialImageScaleStyle.scaleY - }) - .opacity(this.isRenderSpecialImage()) - Text("SpecialImage") - .fontWeight(FontWeight.Bold) - } - .width('95%') - .margin({ - top: '10vp', - left: '15vp', - right: '15vp' - }) - .borderRadius('16vp') - .height('200vp') - .backgroundColor(Color.White) - } -} - -@Entry -@Component -struct DFXStateAfterOptimization { - @State uiStyle: UIStyle = new UIStyle(); - - build() { - Stack() { - ComponentA({ - scaleStyle: this.uiStyle.scaleStyle, - translateStyle: this.uiStyle.translateStyle, - }) - } - .width('100%') - .height('100%') - .backgroundColor(0xDCDCDC) - } -} - -// [End Case2] \ No newline at end of file -- Gitee From 72012b0c12e2c8a43d2cded3be59b9955bb3c073 Mon Sep 17 00:00:00 2001 From: wsl <1105069392@qq.com> Date: Thu, 18 Sep 2025 16:51:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A1=A5=E5=85=85readme=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wsl <1105069392@qq.com> --- .../README.md | 47 ++++++++++++++ BptaUseSoftware/README.md | 51 +++++++++++++++ OptimizationAppDelay/README.md | 62 +++++++++++++++++++ TaskPoolPractice/README.md | 53 ++++++++++++++++ 4 files changed, 213 insertions(+) create mode 100644 ArkUI/Component_Redundancy_Refresh_Optimization/README.md create mode 100644 BptaUseSoftware/README.md create mode 100644 OptimizationAppDelay/README.md create mode 100644 TaskPoolPractice/README.md diff --git a/ArkUI/Component_Redundancy_Refresh_Optimization/README.md b/ArkUI/Component_Redundancy_Refresh_Optimization/README.md new file mode 100644 index 00000000..21e31f4b --- /dev/null +++ b/ArkUI/Component_Redundancy_Refresh_Optimization/README.md @@ -0,0 +1,47 @@ +# 组件冗余刷新解决方案样例代码工程 + +### 介绍 + +本示例为组件冗余刷新解决方案样例代码工程,包含组件冗余刷新解决方案正例和反例内容的局部样例代码。工程本身不具备实际功能,开发者请直接阅读具体源码结合文档来理解。 + + +### 效果预览 + +不涉及 + +### 工程目录 +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 +│ ├──pages +│ │ └──Index.ets // 首页 +│ └──segment +│ ├──segment1 // 反例 +│ └──segment2 // 正例 +└──entry/src/main/resources // 应用静态资源目录 +``` + +### 具体实现 + +不涉及。 + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机、华为PC/2in1设备、华为平板。 + +2. HarmonyOS系统:HarmonyOS NEXT 5.0.5 Release及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT 5.0.5 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/BptaUseSoftware/README.md b/BptaUseSoftware/README.md new file mode 100644 index 00000000..5c52ebb6 --- /dev/null +++ b/BptaUseSoftware/README.md @@ -0,0 +1,51 @@ +# 后台软件资源合理使用样例代码工程 + +### 介绍 + +本示例为后台软件资源合理使用样例代码工程,包含最佳实践文档中的后台上传下载合理使用、后台音频播放合理使用、后台定位导航服务合理使用、后台系统资源合理使用等内容的局部样例代码。工程本身不具备实际功能,开发者请直接阅读具体源码结合文档来理解。 + + +### 效果预览 + +不涉及 + +### 工程目录 +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 +│ └──pages +│ ├─Audio.ets // 音频类示例代码 +│ ├─Download.ets // 上传下载示例代码 +│ ├─GpsOne.ets // 定位导航服务示例代码1 +│ ├─GpsTwo.ets // 定位导航服务示例代码2 +│ ├─Index.ets // 首页 +│ ├─LockByApplication.ets // 系统资源示例代码1 +│ ├─LockBySystem.ets // 系统资源示例代码2 +│ └─Upload.ets // 上传下载类示例代码 +└──entry/src/main/resources // 应用静态资源目录 +``` + +### 具体实现 + +不涉及。 + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机、华为PC/2in1设备、华为平板。 + +2. HarmonyOS系统:HarmonyOS NEXT 5.0.5 Release及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT 5.0.5 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/OptimizationAppDelay/README.md b/OptimizationAppDelay/README.md new file mode 100644 index 00000000..12f182b4 --- /dev/null +++ b/OptimizationAppDelay/README.md @@ -0,0 +1,62 @@ +# 应用时延优化样例代码工程 + +### 介绍 + +本示例为应用时延优化样例代码工程,包含最佳实践文档中性能和功耗场景优化等内容的局部样例代码。工程本身不具备实际功能,开发者请直接阅读具体源码结合文档来理解。 + + +### 效果预览 + +不涉及 + +### 工程目录 +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 +│ ├──pages +│ │ ├──CameraOptPage.ets // 应用时延优化示例代码 +│ │ ├──CameraPage.ets // 延迟执行资源释放操作 +│ │ ├──CityListPage.ets // 城市列表示例 +│ │ ├──ConcurrentOptPage.ets // 并发优化示例 +│ │ ├──CustomContent.ets // 自定义组件示例 +│ │ ├──PanGestureDistanceOptPage.ets // 手势优化示例 +│ │ ├──Index.ets // 首页 +│ │ ├──ProfilePage.ets // 资料示例 +│ │ ├──TabsNegativeExample.ets // 选项卡反例 +│ │ ├──TabsPositiveExample.ets // 选项卡正例 +│ │ ├──VisionOptPage.ets // 视觉优化 +│ │ └──PanGestureDistancePage.ets // 手势示例代码 +│ ├──view +│ │ ├──ArticleSkeletonView.ets // 结构示例代码 +│ │ ├──LoadingView.ets // 加载示例代码 +│ │ └──OptChatItemView.ets // 动画场景示例代码 +│ ├──model +│ │ └──ChatModel.ets // 聊天模块示例代码 +│ └──common // 公共模块示例代码 +└──entry/src/main/resources // 应用静态资源目录 +``` + +### 具体实现 + +不涉及。 + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机、华为PC/2in1设备、华为平板。 + +2. HarmonyOS系统:HarmonyOS NEXT 5.0.5 Release及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT 5.0.5 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/TaskPoolPractice/README.md b/TaskPoolPractice/README.md new file mode 100644 index 00000000..ae21cff6 --- /dev/null +++ b/TaskPoolPractice/README.md @@ -0,0 +1,53 @@ +# TaskPool使用规范样例代码工程 + +### 介绍 + +本示例为TaskPool使用规范样例代码工程,包含最佳实践文档中涉及的TaskPool代码示例和常见问题示例代码等内容的局部样例代码。工程本身不具备实际功能,开发者请直接阅读具体源码结合文档来理解TaskPool使用规范等。 + + +### 效果预览 + +不涉及 + +### 工程目录 +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 +│ └──pages +│ ├─sample1 // 示例1 +│ │ ├─correct +│ │ └─wrong +│ ├─sample2 // 示例2 +│ ├─sample3 // 示例3 +│ ├─sample4 // 示例4 +│ ├─sample5 // 示例5 +│ ├─sample6 // 示例6 +│ ├──Index.ets // 首页 +│ └──test.ets // 常见问题示例代码 +└──entry/src/main/resources // 应用静态资源目录 +``` + +### 具体实现 + +不涉及。 + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机、华为PC/2in1设备、华为平板。 + +2. HarmonyOS系统:HarmonyOS NEXT 5.0.5 Release及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT 5.0.5 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT 5.0.5 Release SDK及以上。 \ No newline at end of file -- Gitee From 63d7deb3ec4533a7ecadf4fffe728ae70f483c69 Mon Sep 17 00:00:00 2001 From: wsl <1105069392@qq.com> Date: Thu, 18 Sep 2025 17:08:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=A1=A5=E5=85=85readme=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wsl <1105069392@qq.com> --- .../CrossThreadSerializationDelay/README.md | 44 +++++++++++++++++++ TaskPoolPractice/README.md | 16 +++---- 2 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 PerformanceAnalysis/CrossThreadSerializationDelay/README.md diff --git a/PerformanceAnalysis/CrossThreadSerializationDelay/README.md b/PerformanceAnalysis/CrossThreadSerializationDelay/README.md new file mode 100644 index 00000000..a6d4361e --- /dev/null +++ b/PerformanceAnalysis/CrossThreadSerializationDelay/README.md @@ -0,0 +1,44 @@ +# 跨线程序列化耗时问题分析样例代码工程 + +### 介绍 + +本示例为跨线程序列化耗时问题分析样例代码工程,包含最佳实践文档中示例代码等内容的局部样例代码。工程本身不具备实际功能,开发者请直接阅读具体源码结合文档来理解。 + + +### 效果预览 + +不涉及 + +### 工程目录 +``` +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // 程序入口类 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 +│ └──pages +│ └──Index.ets // 首页 +└──entry/src/main/resources // 应用静态资源目录 +``` + +### 具体实现 + +不涉及。 + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机、华为PC/2in1设备、华为平板。 + +2. HarmonyOS系统:HarmonyOS NEXT 5.0.5 Release及以上。 + +3. DevEco Studio版本:DevEco Studio NEXT 5.0.5 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS NEXT 5.0.5 Release SDK及以上。 \ No newline at end of file diff --git a/TaskPoolPractice/README.md b/TaskPoolPractice/README.md index ae21cff6..2acace59 100644 --- a/TaskPoolPractice/README.md +++ b/TaskPoolPractice/README.md @@ -17,14 +17,14 @@ │ ├──entrybackupability │ │ └──EntryBackupAbility.ets // 应用数据备份恢复类 │ └──pages -│ ├─sample1 // 示例1 -│ │ ├─correct -│ │ └─wrong -│ ├─sample2 // 示例2 -│ ├─sample3 // 示例3 -│ ├─sample4 // 示例4 -│ ├─sample5 // 示例5 -│ ├─sample6 // 示例6 +│ ├──sample1 // 示例1 +│ │ ├──correct +│ │ └──wrong +│ ├──sample2 // 示例2 +│ ├──sample3 // 示例3 +│ ├──sample4 // 示例4 +│ ├──sample5 // 示例5 +│ ├──sample6 // 示例6 │ ├──Index.ets // 首页 │ └──test.ets // 常见问题示例代码 └──entry/src/main/resources // 应用静态资源目录 -- Gitee