From 7e9ef58ff53eb255e1e754f9ad2f49ea7f3294ca Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 14:37:09 +0800 Subject: [PATCH 01/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/Home.ets | 10 ++++++++++ .../phone/src/main/ets/entryability/EntryAbility.ets | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index fbbd5ec..4691ba1 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -26,7 +26,9 @@ export struct Home { @State isSearching: boolean = false; @StorageLink('scrollHeight') scrollHeight: number = 0; @StorageLink('currentTopIndex') currentTopIndex: number = 0; + // [Start tabs_position] @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + // [StartExclude property] private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); private scroller: Scroller = new Scroller(); private sideScroller: Scroller = new Scroller(); @@ -54,10 +56,12 @@ export struct Home { .justifyContent(FlexAlign.Center) } + // [EndExclude property] build() { Tabs({ barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End }) { + // [StartExclude tab_content] TabContent() { if (this.currentTopIndex === 2) { // The immersive design of the home page is displayed when the top tab is switched to 2. @@ -127,7 +131,9 @@ export struct Home { Column() } .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) + // [EndExclude tab_content] } + // [StartExclude bar_property] // Change the position and size of the tab at the bottom. .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : CommonConstants.FULL_PERCENT) @@ -136,7 +142,9 @@ export struct Home { $r('app.float.tab_size'))) .barMode(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) + // [EndExclude bar_property] .vertical(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) + // [StartExclude bar_property_method] .barOverlap(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? true : false) .barBackgroundBlurStyle(BlurStyle.NONE) @@ -150,5 +158,7 @@ export struct Home { .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) + // [EndExclude bar_property_method] } + // [End tabs_position] } \ No newline at end of file diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index 53ac660..2568678 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -19,6 +19,7 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; import { WindowUtil } from '@ohos/commons'; export default class EntryAbility extends UIAbility { + // [Start window_size_change] private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { @@ -27,6 +28,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', windowSize.width); }; + // [StartExclude life_cycle] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -34,10 +36,13 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } + // [EndExclude life_cycle] onWindowStageCreate(windowStage: window.WindowStage) { + // [StartExclude code_annotation] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + // [EndExclude code_annotation] this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { @@ -46,8 +51,9 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateHeightBp(); AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); - }) + }); + // [StartExclude load_content] windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -55,7 +61,9 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); + // [EndExclude load_content] } + // [End window_size_change] onWindowStageDestroy() { // Main window is destroyed, release UI related resources -- Gitee From 2baca30e84155082a1ab11850c2180cd8931f1f6 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 16:16:38 +0800 Subject: [PATCH 02/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../phone/src/main/ets/entryability/EntryAbility.ets | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index 2568678..4682918 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -1,3 +1,5 @@ +// [Start window_size_change] +// [StartExclude Annotations_introductions] /* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,9 +19,9 @@ import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { WindowUtil } from '@ohos/commons'; +// [EndExclude Annotations_introductions] export default class EntryAbility extends UIAbility { - // [Start window_size_change] private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { @@ -63,8 +65,8 @@ export default class EntryAbility extends UIAbility { }); // [EndExclude load_content] } - // [End window_size_change] + // [StartExclude cycle_method] onWindowStageDestroy() { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); @@ -79,4 +81,6 @@ export default class EntryAbility extends UIAbility { // Ability has back to background hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } -} \ No newline at end of file + // [EndExclude cycle_method] +} +// [End window_size_change] \ No newline at end of file -- Gitee From c0ef6aa7285ebf71b7324376077cd8de694c940f Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 16:20:41 +0800 Subject: [PATCH 03/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../phone/src/main/ets/entryability/EntryAbility.ets | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index 4682918..f4f07cf 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -19,8 +19,8 @@ import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { WindowUtil } from '@ohos/commons'; -// [EndExclude Annotations_introductions] +// [EndExclude Annotations_introductions] export default class EntryAbility extends UIAbility { private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); @@ -29,8 +29,8 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; - // [StartExclude life_cycle] + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -38,14 +38,13 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - // [EndExclude life_cycle] + // [EndExclude life_cycle] onWindowStageCreate(windowStage: window.WindowStage) { // [StartExclude code_annotation] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); // [EndExclude code_annotation] - this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { this.windowObj = data; @@ -54,7 +53,6 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); }); - // [StartExclude load_content] windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { @@ -65,8 +63,8 @@ export default class EntryAbility extends UIAbility { }); // [EndExclude load_content] } - // [StartExclude cycle_method] + onWindowStageDestroy() { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); -- Gitee From fcd03e33d89971c67dbf18dde0ba33a212d9d726 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 16:32:01 +0800 Subject: [PATCH 04/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/Home.ets | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index 4691ba1..1bbc51e 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -1,3 +1,5 @@ +// [Start tabs_position] +// [StartExclude Annotations_introductions] /* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +28,7 @@ export struct Home { @State isSearching: boolean = false; @StorageLink('scrollHeight') scrollHeight: number = 0; @StorageLink('currentTopIndex') currentTopIndex: number = 0; - // [Start tabs_position] + // [EndExclude Annotations_introductions] @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; // [StartExclude property] private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); @@ -56,8 +58,8 @@ export struct Home { .justifyContent(FlexAlign.Center) } - // [EndExclude property] build() { + // [EndExclude property] Tabs({ barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End }) { @@ -135,11 +137,10 @@ export struct Home { } // [StartExclude bar_property] // Change the position and size of the tab at the bottom. - .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : - CommonConstants.FULL_PERCENT) + .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.bottom_tab_bar_width_lg') : CommonConstants.FULL_PERCENT) .barHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : - (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.tab_size_lg') : - $r('app.float.tab_size'))) + (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.tab_size_lg') : $r('app.float.tab_size'))) .barMode(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) // [EndExclude bar_property] @@ -158,7 +159,7 @@ export struct Home { .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) - // [EndExclude bar_property_method] } - // [End tabs_position] -} \ No newline at end of file +} +// [EndExclude bar_property_method] +// [End tabs_position] \ No newline at end of file -- Gitee From 59b8125f398872ea4ba261e9d1b3f4c1ef9af7c1 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:18:29 +0800 Subject: [PATCH 05/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/entryability/EntryAbility.ets | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index f4f07cf..4c9a9a8 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -1,5 +1,3 @@ -// [Start window_size_change] -// [StartExclude Annotations_introductions] /* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,8 +18,8 @@ import { window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { WindowUtil } from '@ohos/commons'; -// [EndExclude Annotations_introductions] export default class EntryAbility extends UIAbility { + // [Start 1] private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { @@ -29,8 +27,7 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; - // [StartExclude life_cycle] - + // [StartExclude 2] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -38,13 +35,12 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - - // [EndExclude life_cycle] + // [EndExclude 2] onWindowStageCreate(windowStage: window.WindowStage) { - // [StartExclude code_annotation] + // [StartExclude 3] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - // [EndExclude code_annotation] + // [EndExclude 3] this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { this.windowObj = data; @@ -53,7 +49,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); }); - // [StartExclude load_content] + // [StartExclude 4] windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -61,9 +57,9 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); - // [EndExclude load_content] + // [EndExclude 4] } - // [StartExclude cycle_method] + // [End 1] onWindowStageDestroy() { // Main window is destroyed, release UI related resources @@ -79,6 +75,4 @@ export default class EntryAbility extends UIAbility { // Ability has back to background hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } - // [EndExclude cycle_method] -} -// [End window_size_change] \ No newline at end of file +} \ No newline at end of file -- Gitee From b93e87188c5b529993ab3bb64cbd7b6fcaadac46 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:23:28 +0800 Subject: [PATCH 06/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../phone/src/main/ets/entryability/EntryAbility.ets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index 4c9a9a8..d89e5b6 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -27,7 +27,7 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; - // [StartExclude 2] + // [StartExclude 1] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -35,12 +35,12 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - // [EndExclude 2] + // [EndExclude 1] onWindowStageCreate(windowStage: window.WindowStage) { - // [StartExclude 3] + // [StartExclude 1] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - // [EndExclude 3] + // [EndExclude 1] this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { this.windowObj = data; @@ -49,7 +49,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); }); - // [StartExclude 4] + // [StartExclude 1] windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -57,7 +57,7 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); - // [EndExclude 4] + // [EndExclude 1] } // [End 1] -- Gitee From d3b197c4d955222d6d0d00a7fee8df091e11177f Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:28:10 +0800 Subject: [PATCH 07/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/Home.ets | 30 ++++++++++-------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index 1bbc51e..0cfc347 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -1,5 +1,3 @@ -// [Start tabs_position] -// [StartExclude Annotations_introductions] /* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,9 +26,9 @@ export struct Home { @State isSearching: boolean = false; @StorageLink('scrollHeight') scrollHeight: number = 0; @StorageLink('currentTopIndex') currentTopIndex: number = 0; - // [EndExclude Annotations_introductions] + // [Start 1] @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; - // [StartExclude property] + // [StartExclude 1] private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); private scroller: Scroller = new Scroller(); private sideScroller: Scroller = new Scroller(); @@ -57,13 +55,12 @@ export struct Home { .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) } - + // [EndExclude 1] build() { - // [EndExclude property] Tabs({ barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End }) { - // [StartExclude tab_content] + // [StartExclude 1] TabContent() { if (this.currentTopIndex === 2) { // The immersive design of the home page is displayed when the top tab is switched to 2. @@ -133,19 +130,20 @@ export struct Home { Column() } .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) - // [EndExclude tab_content] + // [EndExclude 1] } - // [StartExclude bar_property] + // [StartExclude 1] // Change the position and size of the tab at the bottom. - .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.bottom_tab_bar_width_lg') : CommonConstants.FULL_PERCENT) + .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : + CommonConstants.FULL_PERCENT) .barHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : - (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.tab_size_lg') : $r('app.float.tab_size'))) + (deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.tab_size_lg') : + $r('app.float.tab_size'))) .barMode(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) - // [EndExclude bar_property] + // [EndExclude 1] .vertical(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) - // [StartExclude bar_property_method] + // [End 1] .barOverlap(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? true : false) .barBackgroundBlurStyle(BlurStyle.NONE) @@ -160,6 +158,4 @@ export struct Home { .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) } -} -// [EndExclude bar_property_method] -// [End tabs_position] \ No newline at end of file +} \ No newline at end of file -- Gitee From 9982812a71e427f8a1f84189a10442525e1c9ef3 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:30:27 +0800 Subject: [PATCH 08/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/Home.ets | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index 0cfc347..9ae0fac 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -26,9 +26,9 @@ export struct Home { @State isSearching: boolean = false; @StorageLink('scrollHeight') scrollHeight: number = 0; @StorageLink('currentTopIndex') currentTopIndex: number = 0; - // [Start 1] + // [Start Home] @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; - // [StartExclude 1] + // [StartExclude Home] private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); private scroller: Scroller = new Scroller(); private sideScroller: Scroller = new Scroller(); @@ -55,12 +55,12 @@ export struct Home { .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) } - // [EndExclude 1] + // [EndExclude Home] build() { Tabs({ barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End }) { - // [StartExclude 1] + // [StartExclude Home] TabContent() { if (this.currentTopIndex === 2) { // The immersive design of the home page is displayed when the top tab is switched to 2. @@ -130,9 +130,9 @@ export struct Home { Column() } .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) - // [EndExclude 1] + // [EndExclude Home] } - // [StartExclude 1] + // [StartExclude Home] // Change the position and size of the tab at the bottom. .barWidth(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_tab_bar_width_lg') : CommonConstants.FULL_PERCENT) @@ -141,9 +141,9 @@ export struct Home { $r('app.float.tab_size'))) .barMode(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarMode.Scrollable : BarMode.Fixed, { nonScrollableLayoutStyle: LayoutStyle.ALWAYS_CENTER }) - // [EndExclude 1] + // [EndExclude Home] .vertical(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) - // [End 1] + // [End Home] .barOverlap(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? true : false) .barBackgroundBlurStyle(BlurStyle.NONE) -- Gitee From 4d3c3859677ad25edf619c4e137c1089ef09cb77 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:32:28 +0800 Subject: [PATCH 09/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/entryability/EntryAbility.ets | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index d89e5b6..3cfea51 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -19,7 +19,7 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; import { WindowUtil } from '@ohos/commons'; export default class EntryAbility extends UIAbility { - // [Start 1] + // [Start EntryAbility] private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { @@ -27,7 +27,7 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; - // [StartExclude 1] + // [StartExclude EntryAbility] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -35,12 +35,12 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - // [EndExclude 1] + // [EndExclude EntryAbility] onWindowStageCreate(windowStage: window.WindowStage) { - // [StartExclude 1] + // [StartExclude EntryAbility] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - // [EndExclude 1] + // [EndExclude EntryAbility] this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { this.windowObj = data; @@ -49,7 +49,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); }); - // [StartExclude 1] + // [StartExclude EntryAbility] windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -57,9 +57,9 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); - // [EndExclude 1] + // [EndExclude EntryAbility] } - // [End 1] + // [End EntryAbility] onWindowStageDestroy() { // Main window is destroyed, release UI related resources -- Gitee From 74019db234a3d27481033dda44a22bdd21a74bc0 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 17:45:56 +0800 Subject: [PATCH 10/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/view/VideoDetail.ets | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/features/videoDetail/src/main/ets/view/VideoDetail.ets b/features/videoDetail/src/main/ets/view/VideoDetail.ets index 4ad557a..a5db64f 100644 --- a/features/videoDetail/src/main/ets/view/VideoDetail.ets +++ b/features/videoDetail/src/main/ets/view/VideoDetail.ets @@ -147,8 +147,11 @@ export struct VideoDetail { lg: BreakpointConstants.GRID_COLUMN_SPANS[0] } }) { + // [Start VideoDetail] SideBarContainer() { Column() { + // Sidebar area. + // [StartExclude VideoDetail] Scroll() { AllComments({ commentImgHeight: $commentImgHeight, commentImgWidth: $commentImgWidth }) .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : @@ -163,13 +166,18 @@ export struct VideoDetail { SelfComment() .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + // [EndExclude VideoDetail] } + // [StartExclude VideoDetail] .justifyContent(FlexAlign.Start) .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor(Color.White) + // [EndExclude VideoDetail] .onAreaChange((newValue: Area) => { if (newValue.width !== 0) { + // Handling when the width of the sidebar changes. + // [StartExclude VideoDetail] let height: number = DetailConstants.COMMENT_IMAGE_MIN_HEIGHT_NUMBER + (Number(newValue.width) - DetailConstants.SIDE_BAR_MIN_WIDTH_NUMBER) / (px2vp(this.windowWidth) * DetailConstants.COMMENTS_AREA_PERCENT - @@ -182,10 +190,13 @@ export struct VideoDetail { DetailConstants.COMMENT_IMAGE_MIN_WIDTH_NUMBER); this.commentImgHeight = JSON.stringify(height); this.commentImgWidth = JSON.stringify(width); + // [EndExclude VideoDetail] } }) Column() { + // Content area. + // [StartExclude VideoDetail] VideoDetailView({ screenHeight: this.screenHeight, relatedVideoHeight: this.relatedVideoHeight, @@ -195,18 +206,24 @@ export struct VideoDetail { SelfComment() .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG || this.isFullScreen ? Visibility.None : Visibility.Visible) + // [EndExclude VideoDetail] } + // [StartExclude VideoDetail] .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) + // [EndExclude VideoDetail] } .showSideBar(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && !this.isFullScreen ? true : false) + // [StartExclude VideoDetail] .showControlButton(false) .autoHide(false) .sideBarPosition(SideBarPosition.End) + // [EndExclude VideoDetail] .sideBarWidth($r('app.float.side_bar_min_width')) .minSideBarWidth($r('app.float.side_bar_min_width')) .maxSideBarWidth(px2vp(this.windowWidth * DetailConstants.COMMENTS_AREA_PERCENT)) + // [End VideoDetail] } .height(CommonConstants.FULL_PERCENT) } -- Gitee From 88dc39d1882f739c107b02d91141765d12c0d6b6 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 18:10:01 +0800 Subject: [PATCH 11/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/HomeHeader.ets | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/features/home/src/main/ets/view/HomeHeader.ets b/features/home/src/main/ets/view/HomeHeader.ets index e5a6bd5..09e731a 100644 --- a/features/home/src/main/ets/view/HomeHeader.ets +++ b/features/home/src/main/ets/view/HomeHeader.ets @@ -29,6 +29,7 @@ export struct HomeHeader { build() { Column() { + // [Start HomeHeader] GridRow({ columns: { sm: BreakpointConstants.GRID_ROW_COLUMNS[2], @@ -45,10 +46,13 @@ export struct HomeHeader { }) { this.TopTabBar() } - .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : - $r('app.float.search_top_padding_top') }) + // [StartExclude HomeHeader] + .padding({ + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : $r('app.float.search_top_padding_top') + }) .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.search_top_height') : - $r('app.float.search_top_height_more')) + $r('app.float.search_top_height_more')) + // [EndExclude HomeHeader] GridCol({ span: { @@ -59,11 +63,14 @@ export struct HomeHeader { }) { this.searchBar() } + // [StartExclude HomeHeader] .padding({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : $r('app.float.search_top_padding_top') }) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM || deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.search_top_height') : $r('app.float.search_top_height_more')) + // [EndExclude HomeHeader] } + // [End HomeHeader] // The background color of the top tab bar is changed during the slide-down process. .backgroundColor(this.scrollHeight >= new BreakpointType(HomeConstants.BACKGROUND_CHANGE_HEIGHT[0], HomeConstants.BACKGROUND_CHANGE_HEIGHT[1], HomeConstants.BACKGROUND_CHANGE_HEIGHT[2]) -- Gitee From c6c164569c568d9fb1d658e7b40bda8b352cd52a Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 19:17:06 +0800 Subject: [PATCH 12/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/RecommendedVideo.ets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/features/home/src/main/ets/view/RecommendedVideo.ets b/features/home/src/main/ets/view/RecommendedVideo.ets index 5c6b3f1..21a9b65 100644 --- a/features/home/src/main/ets/view/RecommendedVideo.ets +++ b/features/home/src/main/ets/view/RecommendedVideo.ets @@ -36,11 +36,13 @@ export struct RecommendedVideo { build() { // Video grid layout. + // [Start RecommendedVideo] Grid() { ForEach(this.videoImgList, (item: VideoImage, index: number) => { GridItem() { Column() { Stack({ alignContent: Alignment.Center }) { + // [Start RecommendedVideo] Image(item.getImgSrc()) .focusable(true) .groupDefaultFocus(index === 0 ? true : false) @@ -57,11 +59,15 @@ export struct RecommendedVideo { .height(CommonConstants.FULL_PERCENT) .alignItems(HorizontalAlign.End) .justifyContent(FlexAlign.End) + // [EndExclude RecommendedVideo] } + // [Start RecommendedVideo] .focusable(true) .width(CommonConstants.FULL_PERCENT) + // [EndExclude RecommendedVideo] // The width and height vary with the container assembly and the aspect ratio remains unchanged. .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) + // [Start RecommendedVideo] .hoverEffect(HoverEffect.Scale) .gesture( LongPressGesture({ repeat: false }) @@ -123,16 +129,20 @@ export struct RecommendedVideo { VideoTitle({ title: item.getTitle() }) VideoContent({ content: item.getContent() }) + // [EndExclude RecommendedVideo] } .alignItems(HorizontalAlign.Start) } }, (item: VideoImage, index: number) => index + JSON.stringify(item)) } + // [StartExclude RecommendedVideo] .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[4])) .editMode(false) + // [EndExclude RecommendedVideo] // Sets the number of grid layout columns and evenly divides the width. .columnsTemplate(this.videoGridColumn) .rowsTemplate(CommonConstants.VIDEO_GRID_COLUMNS[0]) + // [End RecommendedVideo] .width(CommonConstants.FULL_PERCENT) .rowsGap($r('app.float.video_grid_gap')) .columnsGap($r('app.float.video_grid_gap')) -- Gitee From f4796589982f320df2cb7dd864d77af6bed92b04 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 7 May 2025 19:21:11 +0800 Subject: [PATCH 13/13] =?UTF-8?q?PAD=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5-?= =?UTF-8?q?=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5-=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/home/src/main/ets/view/RecommendedVideo.ets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/home/src/main/ets/view/RecommendedVideo.ets b/features/home/src/main/ets/view/RecommendedVideo.ets index 21a9b65..bca7aa4 100644 --- a/features/home/src/main/ets/view/RecommendedVideo.ets +++ b/features/home/src/main/ets/view/RecommendedVideo.ets @@ -42,7 +42,7 @@ export struct RecommendedVideo { GridItem() { Column() { Stack({ alignContent: Alignment.Center }) { - // [Start RecommendedVideo] + // [StartExclude RecommendedVideo] Image(item.getImgSrc()) .focusable(true) .groupDefaultFocus(index === 0 ? true : false) @@ -61,13 +61,13 @@ export struct RecommendedVideo { .justifyContent(FlexAlign.End) // [EndExclude RecommendedVideo] } - // [Start RecommendedVideo] + // [StartExclude RecommendedVideo] .focusable(true) .width(CommonConstants.FULL_PERCENT) // [EndExclude RecommendedVideo] // The width and height vary with the container assembly and the aspect ratio remains unchanged. .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) - // [Start RecommendedVideo] + // [StartExclude RecommendedVideo] .hoverEffect(HoverEffect.Scale) .gesture( LongPressGesture({ repeat: false }) -- Gitee