diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index fbbd5ec191530e86ece777e7e665b442af01f559..9ae0fac3965ef2e1567436f8d80008a20cc5472c 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 Home] @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + // [StartExclude Home] private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); private scroller: Scroller = new Scroller(); private sideScroller: Scroller = new Scroller(); @@ -53,11 +55,12 @@ export struct Home { .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) } - + // [EndExclude Home] build() { Tabs({ barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End }) { + // [StartExclude Home] TabContent() { if (this.currentTopIndex === 2) { // The immersive design of the home page is displayed when the top tab is switched to 2. @@ -127,7 +130,9 @@ export struct Home { Column() } .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) + // [EndExclude Home] } + // [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) @@ -136,7 +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 Home] .vertical(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) + // [End Home] .barOverlap(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? true : false) .barBackgroundBlurStyle(BlurStyle.NONE) diff --git a/features/home/src/main/ets/view/HomeHeader.ets b/features/home/src/main/ets/view/HomeHeader.ets index e5a6bd5f8ffbc9f99b5cae083d7af86d4ad39e1a..09e731a9f7767691ac7db2abbbb3617d63c26178 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]) diff --git a/features/home/src/main/ets/view/RecommendedVideo.ets b/features/home/src/main/ets/view/RecommendedVideo.ets index 5c6b3f152fed9c78bb2a1783501dd05705c20cff..bca7aa4d93b3270b0fe1763348067319ead71d1a 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 }) { + // [StartExclude 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] } + // [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) + // [StartExclude 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')) diff --git a/features/videoDetail/src/main/ets/view/VideoDetail.ets b/features/videoDetail/src/main/ets/view/VideoDetail.ets index 4ad557af5002d5e32923f1192c46faac8bb63ee9..a5db64fed2ee1d9a71b3adeedc05cc6ea7403ac8 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) } diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index 53ac66020cfe2b1b087b5ef3981ffea5bcf21011..3cfea5175347ddc0fc175a732025bad35d188e8c 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 EntryAbility] private windowObj?: window.Window; private windowUtil?: WindowUtil = WindowUtil.getInstance(); private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { @@ -26,7 +27,7 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; - + // [StartExclude EntryAbility] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -34,11 +35,12 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - + // [EndExclude EntryAbility] onWindowStageCreate(windowStage: window.WindowStage) { + // [StartExclude EntryAbility] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - + // [EndExclude EntryAbility] this.windowUtil!.setWindowStage(windowStage); windowStage.getMainWindow().then((data: window.Window) => { this.windowObj = data; @@ -46,8 +48,8 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateHeightBp(); AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', this.onWindowSizeChange); - }) - + }); + // [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) ?? ''); @@ -55,7 +57,9 @@ export default class EntryAbility extends UIAbility { } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); + // [EndExclude EntryAbility] } + // [End EntryAbility] onWindowStageDestroy() { // Main window is destroyed, release UI related resources