From 42b4107d13b2bf40c22e18ed9315106dd8b5d2a7 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 02:18:10 +0000 Subject: [PATCH 01/10] update ArkUI/entry/src/main/ets/entryability/EntryAbilityFullScreenStatus.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../ets/entryability/EntryAbilityFullScreenStatus.ets | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityFullScreenStatus.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityFullScreenStatus.ets index 7ce58b5..3ad811d 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityFullScreenStatus.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityFullScreenStatus.ets @@ -27,12 +27,11 @@ export default class EntryAbility extends UIAbility { // [Start entry_ability_full_screen_status] // EntryAbility.ets - onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - + // Handle window content loading error windowStage.loadContent('pages/GridImage', (err) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -40,12 +39,11 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); - - let windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 - // 1. 设置窗口全屏 + let windowClass: window.Window = windowStage.getMainWindowSync(); // Get the main application window + // 1. Set the window to fullscreen let isLayoutFullScreen = true; windowClass.setWindowLayoutFullScreen(isLayoutFullScreen); - // 2. 缓存window窗口对象 + // 2. Cache the window object AppStorage.setOrCreate('windowClass', windowClass); }); } -- Gitee From 4d83f9a33afed3c1ed9d00cc7dde36ddfb9f5d15 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 02:22:01 +0000 Subject: [PATCH 02/10] update ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../src/main/ets/entryability/EntryAbilityImmersivePages.ets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets index 95beab0..a4204ee 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets @@ -22,11 +22,10 @@ import { UIAbility } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; - export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { // 1.Get the main window of the application. - let windowClass: window.Window | undefined = undefined; + let mainWindow: window.Window | undefined = undefined; windowStage.getMainWindow().then(windowClass => { console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(windowClass)); // 2.Set the window to full screen to achieve immersive effects. -- Gitee From 1507beca91bb21cc11a1211c4126f2d889b25654 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 02:22:58 +0000 Subject: [PATCH 03/10] update ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets b/ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets index be88e02..0378017 100644 --- a/ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets +++ b/ArkUI/entry/src/main/ets/pages/ImplementImmersivePages.ets @@ -33,7 +33,6 @@ struct Example { // Set the top drawing to extend to the status bar .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) - Row() { Text('ROW2') .fontSize(40) @@ -41,7 +40,6 @@ struct Example { .backgroundColor(Color.Orange) .padding(20) - Row() { Text('ROW3') .fontSize(40) @@ -49,7 +47,6 @@ struct Example { .backgroundColor(Color.Orange) .padding(20) - Row() { Text('ROW4') .fontSize(40) @@ -57,7 +54,6 @@ struct Example { .backgroundColor(Color.Orange) .padding(20) - Row() { Text('ROW5') .fontSize(40) @@ -65,7 +61,6 @@ struct Example { .backgroundColor(Color.Orange) .padding(20) - Row() { Text('Bottom Row') .fontSize(40) -- Gitee From ded09b4fbfbcd2fe67ab36aa22d1961345e2dfc2 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 02:26:10 +0000 Subject: [PATCH 04/10] update ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../main/ets/entryability/EntryAbilityImmersivePages.ets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets index a4204ee..45410fe 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersivePages.ets @@ -25,8 +25,12 @@ import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { // 1.Get the main window of the application. - let mainWindow: window.Window | undefined = undefined; windowStage.getMainWindow().then(windowClass => { + if (!windowClass) { + console.error('Window is undefined'); + return; + } + console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(windowClass)); // 2.Set the window to full screen to achieve immersive effects. windowClass.setWindowLayoutFullScreen(true).then(() => { -- Gitee From 3a0467de07a7f4f8053ce9d098d9b186960785ac Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 02:51:33 +0000 Subject: [PATCH 05/10] update ArkUI/entry/src/main/ets/pages/MockOnclick.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- ArkUI/entry/src/main/ets/pages/MockOnclick.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/pages/MockOnclick.ets b/ArkUI/entry/src/main/ets/pages/MockOnclick.ets index 3a95587..14f9a6d 100644 --- a/ArkUI/entry/src/main/ets/pages/MockOnclick.ets +++ b/ArkUI/entry/src/main/ets/pages/MockOnclick.ets @@ -59,6 +59,7 @@ class MyNodeController extends NodeController { // Coordinate Conversion Example postTouchEvent(event: TouchEvent, uiContext: UIContext): boolean { + if (changedTouchLen === 0) return false; if (this.rootNode == null) { return false; } @@ -70,7 +71,7 @@ class MyNodeController extends NodeController { let offsetY: number | null | undefined = node?.getPositionToParent().y; let changedTouchLen = event.changedTouches.length; for (let i = 0; i < changedTouchLen; i++) { - if (offsetX != null && offsetY != null && offsetX != undefined && offsetY != undefined) { + if (offsetX != null && offsetY != null) { event.changedTouches[i].x = uiContext.vp2px(offsetX + event.changedTouches[i].x); event.changedTouches[i].y = uiContext.vp2px(offsetY + event.changedTouches[i].y); } -- Gitee From fdb6c3054102009fa0111a7c9aee0be36ffb4a9e Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 03:00:12 +0000 Subject: [PATCH 06/10] update ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets b/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets index 039d4a3..4c366bc 100644 --- a/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets +++ b/ArkUI/entry/src/main/ets/pages/DisappearanceAnimationOffsetFlicker.ets @@ -37,7 +37,7 @@ struct DisappearanceAnimationOffsetFlicker { .width('100%') .height('100%') .onClick(() => { - this.isShow = !this.isShow + this.isShow = !this.isShow; }) } } -- Gitee From 7460dfcba0828111a8ae1d3ac22d63e9c912f819 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 03:19:17 +0000 Subject: [PATCH 07/10] update ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 b/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 index b70d539..d749a15 100644 --- a/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 +++ b/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 @@ -20,7 +20,7 @@ // [Start json5] "module": { "name": "feature_splash", - "type": "feature", + "type": "shared", // type类型需要为: "har"或者"shared" // [End json5] "description": "$string:module_desc", -- Gitee From ee87b23fd71841143da7d213397740795693af6a Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 03:33:15 +0000 Subject: [PATCH 08/10] update ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../entry/src/main/ets/viewmodel/DrawViewModel.ets | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets b/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets index 9c993e6..02c78e7 100644 --- a/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets +++ b/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets @@ -49,7 +49,7 @@ export class DrawViewModel { private drawPath = new Path2D(); constructor() { - this.pattern = this.context.createPattern(this.drawModel.img, 'repeat'); + this.pattern = this.context.createPattern(this.drawModel.img, 'repeat') ?? null; } moveStart(x: number, y: number) { @@ -59,10 +59,12 @@ export class DrawViewModel { } moveUpdate(x: number, y: number) { - let lastPoint = this.points[this.points.length - 1]; - this.points.push({ x: x, y: y }); - this.drawPath.quadraticCurveTo((x + lastPoint.x) / 2, (y + lastPoint.y) / 2, x, y); - this.drawCurrentPathModel(); + if (this.points.length !== 0) { + let lastPoint = this.points[this.points.length - 1]; + this.points.push({ x: x, y: y }); + this.drawPath.quadraticCurveTo((x + lastPoint.x) / 2, (y + lastPoint.y) / 2, x, y); + this.drawCurrentPathModel(); + } } moveEnd() { @@ -95,4 +97,5 @@ export class DrawViewModel { this.context.stroke(this.drawPath); } } + // [End draw_view_model] \ No newline at end of file -- Gitee From fdf70c863bfc3ae7b4a0eff86847649fdcb46693 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 08:44:44 +0000 Subject: [PATCH 09/10] update ArkUI/entry/src/main/ets/pages/SetTabsMarginDemo.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../src/main/ets/pages/SetTabsMarginDemo.ets | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ArkUI/entry/src/main/ets/pages/SetTabsMarginDemo.ets b/ArkUI/entry/src/main/ets/pages/SetTabsMarginDemo.ets index e494daf..d9e4b96 100644 --- a/ArkUI/entry/src/main/ets/pages/SetTabsMarginDemo.ets +++ b/ArkUI/entry/src/main/ets/pages/SetTabsMarginDemo.ets @@ -25,10 +25,11 @@ struct SetTabsMarginDemo { @State currentIndex: number = 0; @Builder - TabBarBuilder(title: string, targetIndex: number) { - Column(){ + tabBarBuilder(title: string, targetIndex: number) { + Column() { Text(title) - .fontWeight(targetIndex === this.currentIndex ? FontWeight.Bold : FontWeight.Normal).margin({ left: 10, right: 10 }) + .fontWeight(targetIndex === this.currentIndex ? FontWeight.Bold : FontWeight.Normal) + .margin({ left: 10, right: 10 }) .fontColor(targetIndex === this.currentIndex ? Color.Orange : Color.Gray) .onClick(() => { this.tabsController.changeIndex(targetIndex) @@ -40,44 +41,44 @@ struct SetTabsMarginDemo { Row() { Column() { Flex({ direction: FlexDirection.Row }) { - this.TabBarBuilder('页签1', 0) - this.TabBarBuilder('页签2', 1) - this.TabBarBuilder('页签3', 2) + this.tabBarBuilder('tab1', 0) + this.tabBarBuilder('tab2', 1) + this.tabBarBuilder('tab3', 2) } Tabs({ barPosition: BarPosition.Start, controller: this.tabsController }) { TabContent() { Column() { - Text("页签1页面") + Text("tab1_page") } .height('100%') .width('100%') .backgroundColor(Color.Yellow) } // The place where the margins are correctly set. - .margin({left : 10, right :10}) + .margin({ left: 10, right: 10 }) TabContent() { Column() { - Text("页签2页面") + Text("tab2_page") } .height('100%') .width('100%') .backgroundColor(Color.Green) } // The place where the margins are correctly set. - .margin({left : 10, right :10}) + .margin({ left: 10, right: 10 }) TabContent() { Column() { - Text("页签3页面") + Text("tab3_page") } .height('100%') .width('100%') .backgroundColor(Color.Pink) } // The place where the margins are correctly set. - .margin({left : 10, right :10}) + .margin({ left: 10, right: 10 }) } // The parameter for adjusting the margins should not be added here, as it may affect the user experience. // .margin({left : 10, right :10}) @@ -88,4 +89,5 @@ struct SetTabsMarginDemo { } } } + // [End SetTabsMarginDemo] \ No newline at end of file -- Gitee From a137c19b6a4a2e8afa8223c1c4bd5c55c50d1843 Mon Sep 17 00:00:00 2001 From: MJZDMJ <1798658427@qq.com> Date: Sat, 20 Sep 2025 08:54:09 +0000 Subject: [PATCH 10/10] update ArkUI/entry/src/main/ets/pages/ComponentAttributeCompatibilityJudgment.ets. Signed-off-by: MJZDMJ <1798658427@qq.com> --- .../main/ets/pages/ComponentAttributeCompatibilityJudgment.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/pages/ComponentAttributeCompatibilityJudgment.ets b/ArkUI/entry/src/main/ets/pages/ComponentAttributeCompatibilityJudgment.ets index 1f80c19..0826563 100644 --- a/ArkUI/entry/src/main/ets/pages/ComponentAttributeCompatibilityJudgment.ets +++ b/ArkUI/entry/src/main/ets/pages/ComponentAttributeCompatibilityJudgment.ets @@ -38,7 +38,7 @@ struct ComponentAttributeCompatibilityJudgment { class MyListModifier implements AttributeModifier { applyNormalAttribute(instance: ListAttribute): void { // 通过deviceInfo的api版本信息进行判断 - if (deviceInfo.sdkApiVersion > 14) { + if (deviceInfo?.sdkApiVersion > 14) { // 要适配的是List组件的backToTop属性 // instance为List的属性对象,可以通过instance对象对属性进行修改 instance.backToTop(true); -- Gitee