diff --git a/features/home/src/main/ets/constants/HomeConstants.ets b/features/home/src/main/ets/constants/HomeConstants.ets index 44ae6863fff64eb8a2e8686362f51d177773aba4..2d3745307d6e405dca71f31f63cc8f77f9d365ed 100644 --- a/features/home/src/main/ets/constants/HomeConstants.ets +++ b/features/home/src/main/ets/constants/HomeConstants.ets @@ -173,7 +173,8 @@ export class HomeConstants { /** * Video dialog option list. */ - static readonly VIDEO_DIALOG_OPTIONS: ResourceStr[] = [$r('app.string.binge_watch'), $r('app.string.Collect'), $r('app.string.like')]; + static readonly VIDEO_DIALOG_OPTIONS: ResourceStr[] = + [$r('app.string.binge_watch'), $r('app.string.Collect'), $r('app.string.like')]; /** * Side bar icon list height. */ diff --git a/features/home/src/main/ets/view/BannerView.ets b/features/home/src/main/ets/view/BannerView.ets index 036227b69ce38b74ee1108f59e47996d7dec948b..ad81528499517f832715d262266f95eccee8fd6d 100644 --- a/features/home/src/main/ets/view/BannerView.ets +++ b/features/home/src/main/ets/view/BannerView.ets @@ -69,8 +69,9 @@ export struct BannerView { Stack() { // [StartExclude swiper1_lazyforeach] // [EndExclude jh_lazy_for_each] - Image(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? item.getBannerImg().getImgSrcSm() : - item.getBannerImg().getImgSrc()) + Image(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + item.getBannerImg().getImgSrcSm() : + item.getBannerImg().getImgSrc()) .objectFit(ImageFit.Fill) .borderRadius($r('app.float.banner_img_border_radius')) .height('100%') @@ -81,7 +82,7 @@ export struct BannerView { Column() { Text(item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? `${item.getDescription().getDescription()[0]}${item.getDescription().getDescription()[1]}` : - item.getDescription().getDescription()[0]) + item.getDescription().getDescription()[0]) .fontSize(item.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) .fontWeight(item.getDescription().getFontWeight()[0]) .lineHeight(item.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) @@ -112,17 +113,18 @@ export struct BannerView { } .padding({ left: !item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? - item.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', + item.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', top: !item.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? - item.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' + item.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' }) .alignItems(item.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? - HorizontalAlign.Center : HorizontalAlign.Start) + HorizontalAlign.Center : HorizontalAlign.Start) .justifyContent(!item.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? - FlexAlign.Start : FlexAlign.Center) + FlexAlign.Start : FlexAlign.Center) .height('100%') .width('100%') .zIndex(2) + // [EndExclude swiper1_lazyforeach] } .height(item.getBannerImg().getHeight().getValue(this.currentWidthBreakpoint)) @@ -138,6 +140,7 @@ export struct BannerView { left: this.currentWidthBreakpoint === 'sm' ? $r('app.float.banner_padding_sm') : 0, right: this.currentWidthBreakpoint === 'sm' ? $r('app.float.banner_padding_sm') : 0 }) + // [EndExclude jh_lazy_for_each] }, (item: Banner, index: number) => index + JSON.stringify(item)) } @@ -171,6 +174,7 @@ export struct BannerView { .index(2) // [EndExclude jh_lazy_for_each] .tabIndex(getTabIndex('Banner')) + // [End jh_lazy_for_each] // Switch the tab to switch the banner display effect. @@ -215,6 +219,7 @@ export struct BannerView { left: $r('app.float.banner_padding_sm'), right: $r('app.float.banner_padding_sm') }) + // [End home_constants] } .width('100%') @@ -304,10 +309,10 @@ export struct BannerView { // Obtain the window width and subtract the blank parts on both sides. let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(32, 48, 64).getValue(this.currentWidthBreakpoint) - - 96; + 96; // Calculate the width of a single image based on the percent. result = (result - 12 * 2) * 4 / - 11; + 11; // Calculate the total height of the grid layout. return result / 1.5 + 'vp'; } @@ -322,7 +327,7 @@ struct BannerText { build() { Stack() { Image(((this.index === 0) || (this.index === 1)) ? this.banner.getBannerImg().getImgSrcSm() : - this.banner.getBannerImg().getImgSrc()) + this.banner.getBannerImg().getImgSrc()) .width('100%') .height('100%') .objectFit(ImageFit.Fill) @@ -332,7 +337,7 @@ struct BannerText { Column() { Text(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? `${this.banner.getDescription().getDescription()[0]}${this.banner.getDescription().getDescription()[1]}` : - this.banner.getDescription().getDescription()[0]) + this.banner.getDescription().getDescription()[0]) .fontSize(this.banner.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[0]) .fontWeight(this.banner.getDescription().getFontWeight()[0]) .lineHeight(this.banner.getDescription().getLineHeight().getValue(this.currentWidthBreakpoint)[0]) @@ -347,7 +352,7 @@ struct BannerText { .letterSpacing('1vp') .maxLines(1) .visibility(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? - Visibility.None : Visibility.Visible) + Visibility.None : Visibility.Visible) Text(this.banner.getDescription().getDescription()[2]) .fontSize(this.banner.getDescription().getFontSize().getValue(this.currentWidthBreakpoint)[1]) @@ -360,14 +365,14 @@ struct BannerText { } .padding({ left: !this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? - this.banner.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', + this.banner.getDescription().getLeftPosition().getValue(this.currentWidthBreakpoint)[0] : '0', top: !this.banner.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? - this.banner.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' + this.banner.getDescription().getTopPosition().getValue(this.currentWidthBreakpoint)[0] : '0' }) .alignItems(this.banner.getDescription().getIsLeftCenter().getValue(this.currentWidthBreakpoint) ? - HorizontalAlign.Center : HorizontalAlign.Start) + HorizontalAlign.Center : HorizontalAlign.Start) .justifyContent(!this.banner.getDescription().getIsTopCenter().getValue(this.currentWidthBreakpoint) ? - FlexAlign.Start : FlexAlign.Center) + FlexAlign.Start : FlexAlign.Center) .width('100%') .height('100%') } diff --git a/features/home/src/main/ets/view/CommonView.ets b/features/home/src/main/ets/view/CommonView.ets index 1e490b6a9addd04505b8a47aa48ce99c9d83e945..7dd69a8ee7063682cf2aba6b17e186b29bb9b021 100644 --- a/features/home/src/main/ets/view/CommonView.ets +++ b/features/home/src/main/ets/view/CommonView.ets @@ -96,7 +96,8 @@ export struct SubtitleComponent { left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), - $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint)}) + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint) + }) } } @@ -125,9 +126,9 @@ export struct VideoImgPlay { Column() { Image($r('app.media.new_video_play')) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.video_img_size_lg') : - $r('app.float.video_img_size')) + $r('app.float.video_img_size')) .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.video_img_size_lg') : - $r('app.float.video_img_size')) + $r('app.float.video_img_size')) } .width(CommonConstants.FULL_PERCENT) .height(CommonConstants.FULL_PERCENT) diff --git a/features/home/src/main/ets/view/DailyVideo.ets b/features/home/src/main/ets/view/DailyVideo.ets index 76ad521661bbcdae925a16c67044afb1a8ff96a9..32ac07271ab06abc2db0af56f1685edd23497e1f 100644 --- a/features/home/src/main/ets/view/DailyVideo.ets +++ b/features/home/src/main/ets/view/DailyVideo.ets @@ -67,39 +67,41 @@ export struct DailyVideo { Row() { Text(this.mainDailyVideoImg.getTitle()) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_title_font_lg') : $r('app.float.main_daily_title_font')) + $r('app.float.main_daily_title_font_lg') : $r('app.float.main_daily_title_font')) .fontColor(Color.White) .fontWeight(CommonConstants.FONT_WEIGHT_700) - .margin({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_margin_lg') : $r('app.float.main_daily_margin') }) + .margin({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_margin_lg') : $r('app.float.main_daily_margin') + }) .layoutWeight(1) .maxLines(1) Text(this.mainDailyVideoImg.getRating()) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_rating_font_lg') : $r('app.float.main_daily_rating_font')) + $r('app.float.main_daily_rating_font_lg') : $r('app.float.main_daily_rating_font')) .fontWeight(FontWeight.Normal) .fontColor(Color.White) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_rating_height_lg') : $r('app.float.main_daily_rating_height')) + $r('app.float.main_daily_rating_height_lg') : $r('app.float.main_daily_rating_height')) .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_rating_width_lg') : $r('app.float.main_daily_rating_width')) + $r('app.float.main_daily_rating_width_lg') : $r('app.float.main_daily_rating_width')) .margin({ - right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG? - $r('app.float.main_daily_rating_right_lg') : $r('app.float.main_daily_rating_right'), + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.main_daily_rating_right_lg') : $r('app.float.main_daily_rating_right'), top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_rating_top_lg') : $r('app.float.main_daily_rating_top') + $r('app.float.main_daily_rating_top_lg') : $r('app.float.main_daily_rating_top') }) .backgroundColor($r('app.color.main_daily_rating_background')) .borderRadius(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_rating_radius_lg') : $r('app.float.main_daily_rating_radius')) + $r('app.float.main_daily_rating_radius_lg') : $r('app.float.main_daily_rating_radius')) .textAlign(TextAlign.Center) } .alignItems(VerticalAlign.Top) .justifyContent(FlexAlign.Start) .width(CommonConstants.FULL_PERCENT) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_row_height_lg') : $r('app.float.main_daily_row_height')) + $r('app.float.main_daily_row_height_lg') : $r('app.float.main_daily_row_height')) } .width(CommonConstants.FULL_PERCENT) .layoutWeight(5) @@ -120,46 +122,47 @@ export struct DailyVideo { // [Start dd_main_daily_video_img] Text(this.mainDailyVideoImg.getOtherInfo()) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_other_font_lg') : $r('app.float.main_daily_other_font')) - // [End dd_main_daily_video_img] + $r('app.float.main_daily_other_font_lg') : $r('app.float.main_daily_other_font')) + // [End dd_main_daily_video_img] .fontWeight(FontWeight.Normal) .maxLines(1) Text(this.mainDailyVideoImg.getContent()) .opacity(CommonConstants.TEXT_OPACITY[0]) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_content_font_lg') : $r('app.float.main_daily_content_font')) + $r('app.float.main_daily_content_font_lg') : $r('app.float.main_daily_content_font')) .fontWeight(FontWeight.Normal) .maxLines(1) } .margin({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.small_daily_column_margin_lg'): $r('app.float.small_daily_column_margin'), + $r('app.float.small_daily_column_margin_lg') : $r('app.float.small_daily_column_margin'), right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.small_daily_column_margin_lg'): $r('app.float.small_daily_column_margin') + $r('app.float.small_daily_column_margin_lg') : $r('app.float.small_daily_column_margin') }) .alignItems(HorizontalAlign.Start) .layoutWeight(1) Button(HomeConstants.HOME_BUTTON_TEXT[0]) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_button_font_lg'): $r('app.float.main_daily_button_font')) + $r('app.float.main_daily_button_font_lg') : $r('app.float.main_daily_button_font')) .fontColor($r('app.color.tab_sel_color')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_button_height_lg') : $r('app.float.main_daily_button_height_lg')) + $r('app.float.main_daily_button_height_lg') : $r('app.float.main_daily_button_height_lg')) .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.main_daily_button_width_lg') : $r('app.float.main_daily_button_width_lg')) + $r('app.float.main_daily_button_width_lg') : $r('app.float.main_daily_button_width_lg')) .borderRadius($r('app.float.main_daily_button_radius')) .backgroundColor($r('app.color.button_background')) } .alignItems(VerticalAlign.Center) .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding'), + $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding'), right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding') + $r('app.float.small_daily_row_padding_lg') : $r('app.float.small_daily_row_padding') }) .layoutWeight(2) + // [EndExclude sub_title_component] } .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[6])) @@ -172,11 +175,11 @@ export struct DailyVideo { .padding({ top: $r('app.float.sub_title_row_margin'), bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.sub_title_row_margin') : 0, + $r('app.float.sub_title_row_margin') : 0, left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.home_content_padding_sm') : 0 + $r('app.float.home_content_padding_sm') : 0 }) // Sub video section. @@ -199,13 +202,14 @@ export struct DailyVideo { .width(CommonConstants.FULL_PERCENT) // The width and height vary with the container assembly and the aspect ratio remains unchanged. .aspectRatio(HomeConstants.VIDEO_DIALOG_ASPECT_RATIO) + // [StartExclude sub_title_component] Text(item.getTitle()) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.daily_title_font_lg') : $r('app.float.daily_title_font')) + $r('app.float.daily_title_font_lg') : $r('app.float.daily_title_font')) .fontWeight(FontWeight.Normal) .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.video_title_line_lg') : $r('app.float.video_title_line')) + $r('app.float.video_title_line_lg') : $r('app.float.video_title_line')) .margin({ top: $r('app.float.daily_title_margin') }) .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) @@ -217,7 +221,7 @@ export struct DailyVideo { .opacity(CommonConstants.TEXT_OPACITY[0]) .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? Visibility.Visible : - Visibility.None) + Visibility.None) // [EndExclude sub_title_component] } .alignItems(HorizontalAlign.Start) @@ -235,20 +239,23 @@ export struct DailyVideo { .columnsGap($r('app.float.daily_grid_gap')) .padding({ top: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), + $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), + $r('app.float.sub_title_row_margin') : $r('app.float.focus_more_size'), left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.home_content_padding_sm') : $r('app.float.focus_more_size'), + $r('app.float.home_content_padding_sm') : $r('app.float.focus_more_size'), right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint) }) } } } - .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? - $r('app.float.side_bar_width') : 0 }) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 + }) .margin({ top: $r('app.float.main_daily_margin') }) + // [End sub_title_component] } @@ -256,7 +263,7 @@ export struct DailyVideo { // Obtain the window width and subtract the blank parts on both sides. let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) - - HomeConstants.VIDEO_GRID_ITEM_SPACE; + HomeConstants.VIDEO_GRID_ITEM_SPACE; // Calculate the width of a single image based on the number of grid columns. if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) { result = (result - HomeConstants.LG_SIDEBAR_WIDTH) / HomeConstants.TWO; diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index 0e98c3dbaf453fe9c6c72aa9d93c3611cce19188..25f7497ccabe82b780b02b2f5bad26efd2ffd215 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -50,10 +50,12 @@ export struct Home { .margin({ top: $r('app.float.tab_top_margin') }) .opacity(index === this.currentBottomIndex ? CommonConstants.TEXT_OPACITY[3] : CommonConstants.TEXT_OPACITY[0]) } - .padding({ bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG && deviceInfo.deviceType !== - CommonConstants.DEVICE_TYPE ? $r('app.float.bottom_navigation') : 0 }) + .padding({ + bottom: this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG && deviceInfo.deviceType !== + CommonConstants.DEVICE_TYPE ? $r('app.float.bottom_navigation') : 0 + }) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.tab_height_lg') : - CommonConstants.FULL_PERCENT) + CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) } @@ -61,7 +63,8 @@ export struct Home { build() { // [Start tabs_barposition] Tabs({ - barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : BarPosition.End + barPosition: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? BarPosition.Start : + BarPosition.End }) { // [StartExclude tabs_barposition] // [Start tab_content] @@ -89,8 +92,10 @@ export struct Home { HomeHeader({ isSearching: $isSearching }) .visibility(!this.isSearching ? Visibility.Visible : Visibility.None) - .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.side_bar_width') : 0 }) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.side_bar_width') : 0 + }) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) @@ -119,6 +124,7 @@ export struct Home { } } .tabBar(this.BottomTabBuilder(this.tabList[0], 0)) + // [End tab_content] TabContent() { @@ -135,11 +141,13 @@ export struct Home { Column() } .tabBar(this.BottomTabBuilder(this.tabList[3], 3)) + // [EndExclude tabs_barposition] } // 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'))) diff --git a/features/home/src/main/ets/view/HomeContent.ets b/features/home/src/main/ets/view/HomeContent.ets index d338b0f256610bc4f41d70b7ba90a1c4924d67ee..bb797efbe714d54c6c0a0d5299e3ffa10cefb9d3 100644 --- a/features/home/src/main/ets/view/HomeContent.ets +++ b/features/home/src/main/ets/view/HomeContent.ets @@ -18,7 +18,7 @@ import { BreakpointConstants, BreakpointType, CommonConstants } from '@ohos/comm import { WindowUtil } from '@ohos/commons'; import { BannerView } from './BannerView'; import { IconView } from './IconView'; -import { RecommendedVideo} from './RecommendedVideo'; +import { RecommendedVideo } from './RecommendedVideo'; import { NewVideoRelease } from './NewVideoRelease'; import { DailyVideo } from './DailyVideo'; import { PreviousVideo } from './PreviousVideo'; @@ -55,15 +55,20 @@ export struct HomeContent { $r('app.media.immersive_background_sm'), $r('app.media.immersive_background_md'), $r('app.media.immersive_background_lg')).getValue(this.currentWidthBreakpoint) : $r('app.media.white_background')) // Set the size of the background image. - .backgroundImageSize({ width: CommonConstants.FULL_PERCENT, height: new BreakpointType( - $r('app.float.immersive_background_height_sm'), $r('app.float.immersive_background_height_md'), - $r('app.float.immersive_background_height_lg')).getValue(this.currentWidthBreakpoint) }) + .backgroundImageSize({ + width: CommonConstants.FULL_PERCENT, height: new BreakpointType( + $r('app.float.immersive_background_height_sm'), $r('app.float.immersive_background_height_md'), + $r('app.float.immersive_background_height_lg')).getValue(this.currentWidthBreakpoint) + }) // Set the uniform background color. - .backgroundColor(this.currentTopIndex === 2 && !this.isSearching ? (this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_MD ? + .backgroundColor(this.currentTopIndex === 2 && !this.isSearching ? + (this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_MD ? $r('app.color.home_content_background') : $r('app.color.home_content_background_md')) : Color.White) .width(CommonConstants.FULL_PERCENT) // [End banner_view] - .padding({ bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPE && this.currentWidthBreakpoint === - BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_navigation') : 0 }) + .padding({ + bottom: deviceInfo.deviceType !== CommonConstants.DEVICE_TYPE && this.currentWidthBreakpoint === + BreakpointConstants.BREAKPOINT_LG ? $r('app.float.bottom_navigation') : 0 + }) } } \ No newline at end of file diff --git a/features/home/src/main/ets/view/HomeHeader.ets b/features/home/src/main/ets/view/HomeHeader.ets index 56965126e55b8b218d5e5411e2d8b0032551b4b3..cbeda20c2aef8ac4270e583f1623b1e123290220 100644 --- a/features/home/src/main/ets/view/HomeHeader.ets +++ b/features/home/src/main/ets/view/HomeHeader.ets @@ -28,7 +28,7 @@ export struct HomeHeader { @State isShowingBorder: boolean = false; @Link isSearching: boolean; @StorageLink('scrollHeight') scrollHeight: number = 0; - @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = 'lg'; + @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = 'lg'; @StorageLink('currentTopIndex') currentTopIndex: number = 0; // [Start Home_Header] @@ -66,8 +66,10 @@ export struct HomeHeader { }) { this.searchBar() } - .padding({ top: this.currentWidthBreakpoint === 'sm' || deviceInfo.deviceType === - '2in1' ? 0 : $r('app.float.search_top_padding_top') }) + .padding({ + top: this.currentWidthBreakpoint === 'sm' || deviceInfo.deviceType === + '2in1' ? 0 : $r('app.float.search_top_padding_top') + }) .height(this.currentWidthBreakpoint === 'sm' || deviceInfo.deviceType === '2in1' ? $r('app.float.search_top_height') : $r('app.float.search_top_height_more')) } @@ -75,10 +77,11 @@ export struct HomeHeader { .backgroundColor(this.scrollHeight >= new BreakpointType(HomeConstants.BACKGROUND_CHANGE_HEIGHT[0], HomeConstants.BACKGROUND_CHANGE_HEIGHT[1], HomeConstants.BACKGROUND_CHANGE_HEIGHT[2]) .getValue(this.currentWidthBreakpoint) && this.currentTopIndex === 2 ? $r('app.color.home_content_background') : - Color.Transparent) + Color.Transparent) } .width('100%') } + // [End build_column] // [End Home_Header] @@ -93,15 +96,15 @@ export struct HomeHeader { ListItem() { Text(item) .fontSize(this.currentTopIndex === index ? $r('app.float.search_tab_font_selected') : - $r('app.float.search_tab_font')) + $r('app.float.search_tab_font')) .fontWeight(this.currentTopIndex === index ? 700 : 500) .width(this.currentTopIndex === index ? $r('app.float.top_text_width_selected') : - $r('app.float.top_text_width')) + $r('app.float.top_text_width')) .textAlign(TextAlign.Center) .fontColor(this.currentTopIndex === 2 ? Color.White : $r('app.color.normal_font_color')) .lineHeight(index === this.currentTopIndex ? $r('app.float.top_tab_list_height_selected') : - $r('app.float.top_tab_list_height')) + $r('app.float.top_tab_list_height')) .focusable(true) .groupDefaultFocus(index === 0 ? true : false) .borderRadius($r('app.float.text_focus_radius')) @@ -109,9 +112,9 @@ export struct HomeHeader { .align(Alignment.Center) .margin({ top: this.currentTopIndex === index ? $r('app.float.top_tab_list_top_selected') : - $r('app.float.top_tab_list_top'), + $r('app.float.top_tab_list_top'), bottom: this.currentTopIndex === index ? $r('app.float.top_tab_list_bottom_selected') : - $r('app.float.top_tab_list_bottom') + $r('app.float.top_tab_list_bottom') }) .padding({ left: new BreakpointType(8, 12, 18).getValue(this.currentWidthBreakpoint), @@ -131,6 +134,7 @@ export struct HomeHeader { } .alignItems(HorizontalAlign.Center) .layoutWeight(1) + // [StartExclude top_tab_bar] Image($r('app.media.ic_public_more')) .width($r('app.float.top_tab_img_size')) @@ -146,6 +150,7 @@ export struct HomeHeader { .height($r('app.float.top_bar_height')) .width('100%') } + // [End top_tab_bar] // [Start search_bar] @@ -182,7 +187,7 @@ export struct HomeHeader { // Search image. Image(this.currentTopIndex === 2 ? $r("app.media.ic_public_search_white") : - $r('app.media.ic_public_search')) + $r('app.media.ic_public_search')) .width($r('app.float.search_img_size')) .height($r('app.float.search_img_size')) .margin({ left: $r('app.float.search_img_left') }) @@ -191,6 +196,7 @@ export struct HomeHeader { // .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[1])) .alignSelf(ItemAlign.Center) .layoutWeight(1) + // [StartExclude search_bar] // History image. Image(this.currentTopIndex === 2 ? $r('app.media.ic_public_history_white') : $r('app.media.ic_public_history')) @@ -213,5 +219,6 @@ export struct HomeHeader { .width('100%') .height('100%') } + // [End search_bar] } \ No newline at end of file diff --git a/features/home/src/main/ets/view/IconView.ets b/features/home/src/main/ets/view/IconView.ets index c65aac5ca80ced868d022d35dbf39ddf8f6b8765..8774b7dc3d110bacc33d1598a247dd0baae09a86 100644 --- a/features/home/src/main/ets/view/IconView.ets +++ b/features/home/src/main/ets/view/IconView.ets @@ -51,7 +51,8 @@ export struct IconView { .height($r('app.float.icon_list_height')) } .padding({ - right: index === this.iconList.length - 1 ? this.getSpace(this.windowWidth, this.currentWidthBreakpoint) / 2 : 0 + right: index === this.iconList.length - 1 ? + this.getSpace(this.windowWidth, this.currentWidthBreakpoint) / 2 : 0 }) }, (item: VideoIcon) => JSON.stringify(item)) } @@ -70,24 +71,26 @@ export struct IconView { }) .margin({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.icon_list_column_margin_lg') : 0 + $r('app.float.icon_list_column_margin_lg') : 0 }) .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? - Visibility.None : Visibility.Visible) + Visibility.None : Visibility.Visible) } getSpace(windowWidth: number, currentWidthBreakpoint: string): number { // Obtain the window width and subtract the blank parts on both sides. - let result: number = this.getUIContext().px2vp(windowWidth) - (new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], - HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) / - HomeConstants.TWO) - this.getUIContext().getHostContext()!.resourceManager.getNumber($r('app.float.icon_img_size').id) / 2; + let result: number = + this.getUIContext().px2vp(windowWidth) - (new BreakpointType(HomeConstants.VIDEO_GRID_MARGIN[0], + HomeConstants.VIDEO_GRID_MARGIN[1], HomeConstants.VIDEO_GRID_MARGIN[2]).getValue(this.currentWidthBreakpoint) / + HomeConstants.TWO) - + this.getUIContext().getHostContext()!.resourceManager.getNumber($r('app.float.icon_img_size').id) / 2; if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM) { result = (result - HomeConstants.ICONVIEW_ITEM_WIDTH[0] * CommonConstants.FOUR) / CommonConstants.FOUR; } else if (currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD) { result = (result - HomeConstants.ICONVIEW_ITEM_WIDTH[1] * HomeConstants.SIX) / HomeConstants.SIX; } else { result = (result - HomeConstants.LG_SIDEBAR_WIDTH - HomeConstants.ICONVIEW_ITEM_WIDTH[2] * HomeConstants.EIGHT) / - HomeConstants.EIGHT; + HomeConstants.EIGHT; } return result; } diff --git a/features/home/src/main/ets/view/NewVideoRelease.ets b/features/home/src/main/ets/view/NewVideoRelease.ets index a7b19ff5e0d9943d0479082b886abad9bebadebe..44cba959d7f0d0fe78520f31286fc2e7800891e7 100644 --- a/features/home/src/main/ets/view/NewVideoRelease.ets +++ b/features/home/src/main/ets/view/NewVideoRelease.ets @@ -17,8 +17,15 @@ import { BreakpointConstants, CommonConstants } from '@ohos/commons'; import { BreakpointType } from '@ohos/commons'; import { HomeConstants } from '../constants/HomeConstants'; import { VideoImage, VideoImgViewModel } from '../viewmodel/VideoImgViewModel'; -import { getTabIndex,SubtitleComponent,VideoContent,VideoImgComponent, VideoImgPlay, VideoImgRating, VideoTitle } from - './CommonView'; +import { + getTabIndex, + SubtitleComponent, + VideoContent, + VideoImgComponent, + VideoImgPlay, + VideoImgRating, + VideoTitle +} from './CommonView'; @Component export struct NewVideoRelease { @@ -38,7 +45,7 @@ export struct NewVideoRelease { GridItem() { Column() { Stack({ alignContent: Alignment.Bottom }) { - VideoImgComponent({ imgSrc:item.getImgSrc(), index: index }) + VideoImgComponent({ imgSrc: item.getImgSrc(), index: index }) VideoImgPlay() VideoImgRating({ rating: item.getRating() }) } @@ -70,8 +77,10 @@ export struct NewVideoRelease { .columnsGap($r('app.float.new_video_columns_gap')) .height(this.getNewVideoHeight(this.currentWidthBreakpoint, this.windowWidth)) } - .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? - $r('app.float.side_bar_width') : 0 }) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 + }) } getNewVideoHeight(currentWidthBreakpoint: string, windowWidth: number): string { @@ -86,6 +95,6 @@ export struct NewVideoRelease { result = (result - HomeConstants.VIDEO_GRID_ITEM_SPACE * HomeConstants.TWO) / CommonConstants.THREE; } return (result / HomeConstants.NEW_VIDEO_ASPECT_RATIO + HomeConstants.NEW_VIDEO_DESCRIPTION_HEIGHT + - HomeConstants.HEIGHT_UNIT); + HomeConstants.HEIGHT_UNIT); } } \ No newline at end of file diff --git a/features/home/src/main/ets/view/PreviousVideo.ets b/features/home/src/main/ets/view/PreviousVideo.ets index b05b84f149ddceea15b2f69bea090949ffb2e098..d879e7665f7cf0ba274a2771886161a14722a023 100644 --- a/features/home/src/main/ets/view/PreviousVideo.ets +++ b/features/home/src/main/ets/view/PreviousVideo.ets @@ -24,7 +24,8 @@ import { getTabIndex, SubtitleComponent } from './CommonView'; export struct PreviousVideo { @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('currentTopIndex') currentTopIndex: number = 0; - @State previousVideoImgListTwo: VideoImage[] = new VideoImgViewModel().getPreviousVideoTwo(this.currentWidthBreakpoint); + @State previousVideoImgListTwo: VideoImage[] = + new VideoImgViewModel().getPreviousVideoTwo(this.currentWidthBreakpoint); @Consume('pageInfo') pageInfo: VideoNavPathStack; private previousVideoImgListOne: VideoImage[] = new VideoImgViewModel().getPreviousVideoOne(); @@ -51,8 +52,10 @@ export struct PreviousVideo { Row() { Image(item.getImgSrc()) .objectFit(ImageFit.Fill) - .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') }) + .margin({ + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') + }) .layoutWeight(CommonConstants.THREE) .height(CommonConstants.FULL_PERCENT) .borderRadius($r('app.float.banner_img_border_radius')) @@ -170,8 +173,10 @@ export struct PreviousVideo { .fontWeight(FontWeight.Normal) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.previous_two_content_font_lg') : $r('app.float.previous_two_content_font')) - .margin({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.previous_two_content_margin_lg') : $r('app.float.previous_two_content_margin') }) + .margin({ + top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.previous_two_content_margin_lg') : $r('app.float.previous_two_content_margin') + }) .opacity(CommonConstants.TEXT_OPACITY[0]) .maxLines(1) .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? @@ -192,8 +197,10 @@ export struct PreviousVideo { $r('app.float.previous_two_column_padding_lg') : $r('app.float.previous_two_column_padding') }) } - .translate({ y: (((index === 2) || (index === 3)) && (this.currentWidthBreakpoint === - BreakpointConstants.BREAKPOINT_MD)) ? HomeConstants.PREVIOUS_TWO_TRANSLATE_MD : '0' }) + .translate({ + y: (((index === 2) || (index === 3)) && (this.currentWidthBreakpoint === + BreakpointConstants.BREAKPOINT_MD)) ? HomeConstants.PREVIOUS_TWO_TRANSLATE_MD : '0' + }) .backgroundColor($r('app.color.home_component_background')) .borderRadius($r('app.float.previous_two_radius')) } @@ -206,11 +213,14 @@ export struct PreviousVideo { left: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), - $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint)}) + $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint) + }) .margin({ top: $r('app.float.main_daily_margin') }) } .tabIndex(getTabIndex(HomeConstants.DIRECTION_LIST[8])) - .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? - $r('app.float.side_bar_width') : 0 }) + .padding({ + left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? + $r('app.float.side_bar_width') : 0 + }) } } \ No newline at end of file diff --git a/features/home/src/main/ets/view/RecommendedVideo.ets b/features/home/src/main/ets/view/RecommendedVideo.ets index a0bfa1cb4b90f1165c4280718dd2884d603e56f3..7dababa61dad90eeac9e2b33b02fdc04b015f0dd 100644 --- a/features/home/src/main/ets/view/RecommendedVideo.ets +++ b/features/home/src/main/ets/view/RecommendedVideo.ets @@ -59,7 +59,7 @@ export struct RecommendedVideo { .width('100%') .height('100%') .hoverEffect(HoverEffect.Scale) - // [End jh_get_img_src] + // [End jh_get_img_src] .focusable(true) .groupDefaultFocus(index === 0 ? true : false) .draggable(false) @@ -72,6 +72,7 @@ export struct RecommendedVideo { .height('100%') .alignItems(HorizontalAlign.End) .justifyContent(FlexAlign.End) + // [EndExclude build_grid] // [EndExclude aligncontent] } @@ -141,6 +142,7 @@ export struct RecommendedVideo { this.videoDialogController.open(); })) .bindContextMenu(RightClickMenu(this.currentWidthBreakpoint), ResponseType.RightClick) + // [End aligncontent] VideoTitle({ title: item.getTitle() }) VideoContent({ content: item.getContent() }) @@ -165,9 +167,9 @@ export struct RecommendedVideo { .height(this.getGridHeight(this.videoGridColumn, this.currentWidthBreakpoint, this.windowWidth)) .padding({ left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && this.currentTopIndex === 2 ? - new BreakpointType($r('app.float.home_recommended_padding_sm'), $r('app.float.home_recommended_padding_md'), + new BreakpointType($r('app.float.home_recommended_padding_sm'), $r('app.float.home_recommended_padding_md'), $r('app.float.home_recommended_padding_lg')).getValue(this.currentWidthBreakpoint) : - new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), + new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), right: new BreakpointType($r('app.float.home_content_padding_sm'), $r('app.float.home_content_padding_md'), $r('app.float.home_content_padding_lg')).getValue(this.currentWidthBreakpoint), @@ -212,6 +214,7 @@ export struct RecommendedVideo { Logger.info(`Two-finger operation is not supported`); } })) + // [End jh_tabindex_gettabindex] // [End grid_foreach] } @@ -235,7 +238,8 @@ export struct RecommendedVideo { } // Calculate the height of a single image, title, and content, and calculate the total height of the grid layout. return result / HomeConstants.VIDEO_DIALOG_ASPECT_RATIO * HomeConstants.TWO + - HomeConstants.VIDEO_GRID_DESCRIPTION_HEIGHT + HomeConstants.HEIGHT_UNIT; + HomeConstants.VIDEO_GRID_DESCRIPTION_HEIGHT + HomeConstants.HEIGHT_UNIT; } + // [End build_grid] } \ No newline at end of file diff --git a/features/home/src/main/ets/view/VideoDaily.ets b/features/home/src/main/ets/view/VideoDaily.ets index 64f0271b885ff576f8fa2a7e7c91179cb1a6fb16..0687a13b172d2cf51e306a823d8651d092b87131 100644 --- a/features/home/src/main/ets/view/VideoDaily.ets +++ b/features/home/src/main/ets/view/VideoDaily.ets @@ -24,7 +24,7 @@ import { KeyCode } from '@kit.InputKit'; @Component export struct DailyVideo { - @State scrollHeight: number =0; + @State scrollHeight: number = 0; @StorageLink('currentWidthBreakpoint') currentWidthBreakpoint: string = 'lg'; @StorageLink('currentHeightBreakpoint') currentHeightBreakpoint: string = 'lg'; @StorageLink('windowWidth') windowWidth: number = 0; @@ -83,8 +83,9 @@ export struct DailyVideo { } // [End dd_isfullscreen] } + build() { - Column(){ + Column() { // [Start dd_break_point_type_getValue] Text('Test') .fontSize(new BreakpointType('14fp', '16fp', '18fp').getValue(this.currentWidthBreakpoint)) @@ -113,6 +114,7 @@ export struct DailyVideo { .height(56) } .width('100%') + // [End dd_movable_layout] // [Start dd_carousel_layout] @@ -135,6 +137,7 @@ export struct DailyVideo { left: this.currentWidthBreakpoint === 'sm' ? 12 : 0, right: this.currentWidthBreakpoint === 'sm' ? 12 : 0 }) + // [End dd_carousel_layout] // [Start dd_palace_grid_layout] @@ -146,6 +149,7 @@ export struct DailyVideo { .height(this.currentWidthBreakpoint === 'sm' ? 164 : 78) .columnsGap(12) .rowsGap(12) + // [End dd_palace_grid_layout] // [Start jh_xcomponent] @@ -222,6 +226,7 @@ export struct DailyVideo { } .alignItems(HorizontalAlign.Center) .layoutWeight(1) + Image($r('app.media.ic_public_more')) .width($r('app.float.top_tab_img_size')) .height($r('app.float.top_tab_img_size')) @@ -282,6 +287,7 @@ export struct DailyVideo { } .alignItems(HorizontalAlign.Center) .layoutWeight(1) + Image($r('app.media.ic_public_more')) .width($r('app.float.top_tab_img_size')) .height($r('app.float.top_tab_img_size')) diff --git a/features/home/src/main/ets/view/VideoDialog.ets b/features/home/src/main/ets/view/VideoDialog.ets index d15f85365711996ee9d304a1aaaeef383eb4f2f1..3a94a5a70c11be40264b4f12de0a1022fbe43494 100644 --- a/features/home/src/main/ets/view/VideoDialog.ets +++ b/features/home/src/main/ets/view/VideoDialog.ets @@ -21,7 +21,8 @@ import { BreakpointConstants, CommonConstants } from '@ohos/commons'; import { BreakpointType, Logger } from '@ohos/commons'; import { HomeConstants } from '../constants/HomeConstants'; -@Builder function MenuItemFunction(img: Resource, text: ResourceStr) { +@Builder +function MenuItemFunction(img: Resource, text: ResourceStr) { Row() { Image(img) .width($r('app.float.dialog_icon_size')) @@ -35,7 +36,8 @@ import { HomeConstants } from '../constants/HomeConstants'; .height($r('app.float.dialog_menu_row_height')) } -@Builder export function RightClickMenu(currentWidthBreakpoint: string) { +@Builder +export function RightClickMenu(currentWidthBreakpoint: string) { Column() { MenuItemFunction($r('app.media.ic_public_view_list'), HomeConstants.VIDEO_DIALOG_OPTIONS[0]) MenuItemFunction($r('app.media.ic_public_highlights'), HomeConstants.VIDEO_DIALOG_OPTIONS[1]) @@ -44,7 +46,7 @@ import { HomeConstants } from '../constants/HomeConstants'; .borderRadius($r('app.float.dialog_text_radius')) .backgroundColor(Color.White) .width(currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.dialog_text_col_width_lg') : - $r('app.float.dialog_text_col_width')) + $r('app.float.dialog_text_col_width')) .padding({ left: $r('app.float.dialog_text_col_padding'), right: $r('app.float.dialog_text_col_padding') @@ -77,7 +79,7 @@ export struct VideoDialog { Logger.info('AVPlayer state idle called.'); break; case CommonConstants.AV_PLAYER_INITIALIZED_STATE: - // This status is reported after the AVPlayer sets the playback source. + // This status is reported after the AVPlayer sets the playback source. Logger.info('AVPlayer initialized called.'); this.avPlayer.surfaceId = this.surfaceId; this.avPlayer.prepare().then(() => { @@ -88,28 +90,28 @@ export struct VideoDialog { }); break; case CommonConstants.AV_PLAYER_PREPARED_STATE: - // Report the state machine after the prepare interface is successfully invoked. + // Report the state machine after the prepare interface is successfully invoked. this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; Logger.info('AVPlayer state prepared called.'); this.avPlayer.play(); break; case CommonConstants.AV_PLAYER_PLAYING_STATE: - // Trigger the state machine to report after the play interface is successfully invoked. + // Trigger the state machine to report after the play interface is successfully invoked. Logger.info('AVPlayer state playing called.'); this.playState = true; break; case CommonConstants.AV_PLAYER_PAUSED_STATE: - // Trigger the state machine to report after the pause function is successfully invoked. + // Trigger the state machine to report after the pause function is successfully invoked. Logger.info('AVPlayer state paused called.'); this.playState = false; break; case CommonConstants.AV_PLAYER_COMPLETED_STATE: - // Trigger the state machine to report after the playback ends. + // Trigger the state machine to report after the playback ends. Logger.info('AVPlayer state completed called.'); this.avPlayer.stop(); break; case CommonConstants.AV_PLAYER_STOPPED_STATE: - // Trigger the state machine to report after the stop interface is successfully invoked. + // Trigger the state machine to report after the stop interface is successfully invoked. Logger.info('AVPlayer state stopped called.'); break; case CommonConstants.AV_PLAYER_RELEASE_STATE: diff --git a/features/home/src/main/ets/view/exampleTest.ets b/features/home/src/main/ets/view/exampleTest.ets index 644bc584098cbb55e723f307674b50a63a77f837..193addf14bda07e083d5d57a97c0c7bb100e7568 100644 --- a/features/home/src/main/ets/view/exampleTest.ets +++ b/features/home/src/main/ets/view/exampleTest.ets @@ -39,6 +39,7 @@ export struct ExampleTest { } AppStorage.setOrCreate('currentWidthBreakpoint', widthBp); } + // [End example_updateWidthBp] build() { diff --git a/features/home/src/main/ets/viewmodel/BannerViewModel.ets b/features/home/src/main/ets/viewmodel/BannerViewModel.ets index 59cf99e5a7b54b960dfbe4ff92879b3ad08a5cab..5b94ede40e113e93a4bc68816e9a48fff2525861 100644 --- a/features/home/src/main/ets/viewmodel/BannerViewModel.ets +++ b/features/home/src/main/ets/viewmodel/BannerViewModel.ets @@ -117,7 +117,6 @@ export class Banner { * Img of the banner. */ private bannerImg: BannerImg; - /** * Description of the banner. */ @@ -142,46 +141,39 @@ class BannerDescription { * Text description. */ private description: ResourceStr[]; - /** * Font size of text. */ private fontSize: BreakpointType; - /** * Font weight of text. */ private fontWeight: number[]; - /** * Line height of text. */ private lineHeight: BreakpointType; - /** * Top position for text. */ private topPosition: BreakpointType; - /** * Left position for text. */ private leftPosition: BreakpointType; - /** * Whether text is horizontal center. */ private isLeftCenter: BreakpointType; - /** * Whether text is vertical center. */ private isTopCenter: BreakpointType; constructor(description: ResourceStr[], fontSize: BreakpointType, fontWeight: number[], - lineHeight: BreakpointType, leftPosition: BreakpointType, - topPosition: BreakpointType, isLeftCenter: BreakpointType, - isTopCenter: BreakpointType) { + lineHeight: BreakpointType, leftPosition: BreakpointType, + topPosition: BreakpointType, isLeftCenter: BreakpointType, + isTopCenter: BreakpointType) { this.description = description; this.fontSize = fontSize; this.fontWeight = fontWeight; @@ -230,18 +222,16 @@ class BannerImg { * Image src of the banner. */ private imgSrc: Resource; - /** * Image src of the banner for sm. */ private imgSrcSm: Resource; - /** * Height of the banner. */ private height: BreakpointType; - constructor(imgSrc: Resource, imgSrcSm: Resource,height: BreakpointType) { + constructor(imgSrc: Resource, imgSrcSm: Resource, height: BreakpointType) { this.imgSrc = imgSrc; this.imgSrcSm = imgSrcSm; this.height = height; diff --git a/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets b/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets index 80aa9a46faa6515e367851987f94ee6a6770eba8..a3825ef7d69b25eea0117632b35bd4da0b6459a0 100644 --- a/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets +++ b/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets @@ -37,17 +37,14 @@ export class FooterTab { * Name of the tab. */ private name: Resource; - /** * Icon of the tab. */ private icon: Resource; - /** * Icon selected. */ private iconSelected: Resource; - /** * White icon. */ diff --git a/features/home/src/main/ets/viewmodel/IconViewModel.ets b/features/home/src/main/ets/viewmodel/IconViewModel.ets index c2b149a91b3764b423c8b3bc0170a61eb67fc42f..8f546856258ae019b4861d44d6780c02856c88e5 100644 --- a/features/home/src/main/ets/viewmodel/IconViewModel.ets +++ b/features/home/src/main/ets/viewmodel/IconViewModel.ets @@ -40,7 +40,6 @@ export class VideoIcon { * Name of the icon. */ private name: ResourceStr; - /** * Image of the icon. */ diff --git a/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets b/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets index 3ad84f50a49e473eeca57ea9b6c3f5f8ff08c9dd..b3a9062a51e704ca17c2fc0b35f7858ce0338b13 100644 --- a/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets +++ b/features/home/src/main/ets/viewmodel/VideoImgViewModel.ets @@ -133,22 +133,18 @@ export class VideoImage { * Image src of the video. */ private imgSrc: Resource; - /** * Rating of the video. */ private rating: string; - /** * Title of the video. */ private title: ResourceStr; - /** * Content of the video. */ private content: ResourceStr; - /** * Other information of the video. */ diff --git a/features/search/src/main/ets/constants/SearchConstants.ets b/features/search/src/main/ets/constants/SearchConstants.ets index 61f952e807c16eeebc85286d3cd55c711cbe810b..d2ad3760fd2e17553399c52b8554df687782bfca 100644 --- a/features/search/src/main/ets/constants/SearchConstants.ets +++ b/features/search/src/main/ets/constants/SearchConstants.ets @@ -31,12 +31,13 @@ export class SearchConstants { * Search List for hua. */ static readonly HUA_LIST: ResourceStr[] = - [ $r('app.string.tv'), $r('app.string.tv'), $r('app.string.tv'), $r('app.string.conference'), - $r('app.string.tv'), $r('app.string.tv')]; + [$r('app.string.tv'), $r('app.string.tv'), $r('app.string.tv'), $r('app.string.conference'), + $r('app.string.tv'), $r('app.string.tv')]; /** * Search result tab List. */ - static readonly SEARCH_RESULT_TAB_LIST: ResourceStr[] = [$r('app.string.all'), $r('app.string.filmer'), $r('app.string.video'), $r('app.string.user')]; + static readonly SEARCH_RESULT_TAB_LIST: ResourceStr[] = + [$r('app.string.all'), $r('app.string.filmer'), $r('app.string.video'), $r('app.string.user')]; /** * Search video img title list. */ @@ -67,11 +68,13 @@ export class SearchConstants { /** * Search result more info list. */ - static readonly SEARCH_RESULT_MORE: ResourceStr[] = [$r('app.string.plays'), $r('app.string.plays'), $r('app.string.plays')]; + static readonly SEARCH_RESULT_MORE: ResourceStr[] = + [$r('app.string.plays'), $r('app.string.plays'), $r('app.string.plays')]; /** * Search sub title list. */ - static readonly SEARCH_SUB_TITLES: ResourceStr[] = [$r('app.string.history_search'), $r('app.string.content'), $r('app.string.find')]; + static readonly SEARCH_SUB_TITLES: ResourceStr[] = + [$r('app.string.history_search'), $r('app.string.content'), $r('app.string.find')]; /** * Search recommend list lanes. */ diff --git a/features/search/src/main/ets/view/SearchContent.ets b/features/search/src/main/ets/view/SearchContent.ets index 0eec1ded59222d44108dbc0e1642e2df5d328b00..232da347c9696faf44a02c9bba0b014796341e40 100644 --- a/features/search/src/main/ets/view/SearchContent.ets +++ b/features/search/src/main/ets/view/SearchContent.ets @@ -75,9 +75,11 @@ export struct SearchContent { .height($r('app.float.search_history_content_row_height')) .borderRadius($r('app.float.search_history_content_row_radius')) .backgroundColor($r('app.color.result_background')) - .margin({ right: new BreakpointType($r('app.float.search_content_margin_right_sm'), - $r('app.float.search_content_margin_right_md'), $r('app.float.search_content_margin_right_lg')) - .getValue(this.currentWidthBreakpoint) }) + .margin({ + right: new BreakpointType($r('app.float.search_content_margin_right_sm'), + $r('app.float.search_content_margin_right_md'), $r('app.float.search_content_margin_right_lg')) + .getValue(this.currentWidthBreakpoint) + }) } // [Start search_discovery] @@ -99,8 +101,9 @@ export struct SearchContent { .margin({ top: $r('app.float.search_discovery_img_margin') }) List() { - ForEach(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_DISCOVERY_LARGE : - SearchConstants.SEARCH_DISCOVERY_LARGE.slice(0, 6), (item: string, index: number) => { + ForEach(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? + SearchConstants.SEARCH_DISCOVERY_LARGE : + SearchConstants.SEARCH_DISCOVERY_LARGE.slice(0, 6), (item: string, index: number) => { ListItem() { // [StartExclude search_discovery] Column() { @@ -113,21 +116,25 @@ export struct SearchContent { .width(CommonConstants.FULL_PERCENT) .margin({ top: $r('app.float.search_discovery_list_column_margin') }) .alignItems(HorizontalAlign.Start) + // [EndExclude search_discovery] } }, (item: string, index: number) => index + JSON.stringify(item)) } .width(CommonConstants.FULL_PERCENT) .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_LIST_LANES[0] : - SearchConstants.SEARCH_LIST_LANES[1]) + SearchConstants.SEARCH_LIST_LANES[1]) } + // [End search_discovery] @Builder searchHotTrending() { - List({ space: new BreakpointType(SearchConstants.HOT_TRENDING_LIST_SPACES[0], - SearchConstants.HOT_TRENDING_LIST_SPACES[1], SearchConstants.HOT_TRENDING_LIST_SPACES[2]) - .getValue(this.currentWidthBreakpoint) }) { + List({ + space: new BreakpointType(SearchConstants.HOT_TRENDING_LIST_SPACES[0], + SearchConstants.HOT_TRENDING_LIST_SPACES[1], SearchConstants.HOT_TRENDING_LIST_SPACES[2]) + .getValue(this.currentWidthBreakpoint) + }) { ForEach(SearchConstants.SEARCH_TABS, (item: string, index: number) => { ListItem() { Column() { @@ -199,10 +206,12 @@ export struct SearchContent { }, (item: SearchVideoImg, index: number) => index + JSON.stringify(item)) } .width(CommonConstants.FULL_PERCENT) - .height(this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? $r('app.float.hot_video_list_height_sm') : - $r('app.float.hot_video_list_height')) + .height(this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? + $r('app.float.hot_video_list_height_sm') : + $r('app.float.hot_video_list_height')) .lanes(new BreakpointType(SearchConstants.SEARCH_LIST_LANES[2], SearchConstants.SEARCH_LIST_LANES[1], - SearchConstants.SEARCH_LIST_LANES[0]).getValue(this.currentWidthBreakpoint), $r('app.float.hot_video_list_lane_space')) + SearchConstants.SEARCH_LIST_LANES[0]).getValue(this.currentWidthBreakpoint), + $r('app.float.hot_video_list_lane_space')) .padding({ top: $r('app.float.hot_video_list_padding'), bottom: $r('app.float.hot_video_list_padding') diff --git a/features/search/src/main/ets/view/SearchForHua.ets b/features/search/src/main/ets/view/SearchForHua.ets index 7d65b7a56e91b4da2ec04fa6b699ede0f189cbcf..773a36ad81f8967d42aa34c1355b65d41b976397 100644 --- a/features/search/src/main/ets/view/SearchForHua.ets +++ b/features/search/src/main/ets/view/SearchForHua.ets @@ -46,8 +46,10 @@ export struct SearchForHua { .width(CommonConstants.FULL_PERCENT) } .alignItems(HorizontalAlign.Start) - .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && index % - SearchConstants.SEARCH_INDEX[0] === 0 ? $r('app.float.search_hua_column_margin_lg') : 0 }) + .margin({ + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG && index % + SearchConstants.SEARCH_INDEX[0] === 0 ? $r('app.float.search_hua_column_margin_lg') : 0 + }) .height($r('app.float.search_hua_column_height')) .onClick(() => { if (index === SearchConstants.SEARCH_INDEX[1]) { @@ -61,7 +63,8 @@ export struct SearchForHua { // [EndExclude searchForHua] } .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? SearchConstants.SEARCH_LIST_LANES[1] : - SearchConstants.SEARCH_LIST_LANES[2]) + SearchConstants.SEARCH_LIST_LANES[2]) + // [End searchForHua] } .layoutWeight(1) diff --git a/features/search/src/main/ets/view/SearchHeader.ets b/features/search/src/main/ets/view/SearchHeader.ets index 2816c88d8885bfbc94cb1df183d71010ae8d76ec..9bdfa7430daae3fc42f649f31823c12f69107302 100644 --- a/features/search/src/main/ets/view/SearchHeader.ets +++ b/features/search/src/main/ets/view/SearchHeader.ets @@ -62,10 +62,12 @@ export struct SearchHeader { .alignSelf(ItemAlign.Center) .layoutWeight(1) } - .padding({ top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : - $r('app.float.search_header_row_padding') }) + .padding({ + top: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : + $r('app.float.search_header_row_padding') + }) .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.search_header_row_height') : - $r('app.float.search_header_row_height_more')) + $r('app.float.search_header_row_height_more')) .width(CommonConstants.FULL_PERCENT) } } \ No newline at end of file diff --git a/features/search/src/main/ets/view/SearchResult.ets b/features/search/src/main/ets/view/SearchResult.ets index 89dd5005d9cee2044fe63e19928ddfa2549eca17..8d8df4a7a5409f3bc082ea3391b585da94148d3a 100644 --- a/features/search/src/main/ets/view/SearchResult.ets +++ b/features/search/src/main/ets/view/SearchResult.ets @@ -46,14 +46,14 @@ export struct SearchResult { .fontSize($r('app.float.type_tabs_font')) .fontWeight(index === this.resultTabIndex ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) .fontColor(index === this.resultTabIndex ? $r('app.color.type_tabs_font_selected') : - $r('app.color.type_tabs_font')) + $r('app.color.type_tabs_font')) .lineHeight($r('app.float.type_tabs_text_line')) .margin({ top: $r('app.float.type_tabs_text_margin') }) Divider() .strokeWidth(SearchConstants.TYPE_TABS_DIVIDER_STROKE_WIDTH) .width(item.length === SearchConstants.SEARCH_INDEX[0] ? $r('app.float.type_tabs_divider_width_two') : - $r('app.float.type_tabs_divider_width_three')) + $r('app.float.type_tabs_divider_width_three')) .color($r('app.color.type_tabs_font_selected')) .margin({ top: $r('app.float.type_tabs_divider_margin') }) .lineCap(LineCapStyle.Round) @@ -61,8 +61,10 @@ export struct SearchResult { } .width($r('app.float.type_tabs_col_width')) .height(CommonConstants.FULL_PERCENT) - .margin({ right: index !== SearchConstants.SEARCH_RESULT_TAB_LIST.length - 1 ? - $r('app.float.type_tabs_col_margin'): 0 }) + .margin({ + right: index !== SearchConstants.SEARCH_RESULT_TAB_LIST.length - 1 ? + $r('app.float.type_tabs_col_margin') : 0 + }) .onClick(() => { this.resultTabIndex = index; }) @@ -105,7 +107,7 @@ export struct SearchResult { lg: BreakpointConstants.GRID_ROW_COLUMNS[1] }, gutter: $r('app.float.grid_row_gutter') - }){ + }) { ForEach(new SearchVideoImgModel().getSearchResultImgList(), (item: SearchVideoImg, index: number) => { GridCol({ span: { @@ -117,8 +119,10 @@ export struct SearchResult { Row() { Image(item.getImgSrc()) .objectFit(ImageFit.Fill) - .margin({ right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') }) + .margin({ + right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.previous_one_image_margin_sm') : $r('app.float.previous_one_image_margin') + }) .layoutWeight(CommonConstants.THREE) .height(CommonConstants.FULL_PERCENT) @@ -135,7 +139,7 @@ export struct SearchResult { $r('app.float.search_result_content_font_md'), $r('app.float.search_result_content_font_lg')) .getValue(this.currentWidthBreakpoint)) .lineHeight(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.result_card_content_line_lg') : $r('app.float.result_card_content_line')) + $r('app.float.result_card_content_line_lg') : $r('app.float.result_card_content_line')) .opacity(CommonConstants.TEXT_OPACITY[1]) .fontWeight(FontWeight.Normal) .margin({ top: $r('app.float.search_result_content_margin') }) @@ -157,9 +161,9 @@ export struct SearchResult { .fontWeight(CommonConstants.FONT_WEIGHT_500) .borderRadius($r('app.float.search_result_button_radius')) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) + $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) + $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) .fontColor(Color.White) .layoutWeight(1) .onClick(() => { @@ -169,16 +173,16 @@ export struct SearchResult { Blank() .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD ? - $r('app.float.search_result_button_blank_md') : $r('app.float.search_result_button_blank')) + $r('app.float.search_result_button_blank_md') : $r('app.float.search_result_button_blank')) Button(SearchConstants.SEARCH_RESULT_BUTTON_TEXTS[1]) .backgroundColor($r('app.color.button_background_2')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .borderRadius($r('app.float.search_result_button_radius')) .fontSize(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) + $r('app.float.search_result_button_font_lg') : $r('app.float.search_result_button_font')) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) + $r('app.float.search_result_button_height_lg') : $r('app.float.search_result_button_height')) .fontColor($r('app.color.button_background_1')) .layoutWeight(1) } @@ -197,13 +201,13 @@ export struct SearchResult { .width(CommonConstants.FULL_PERCENT) .padding({ top: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), left: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding'), right: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding') + $r('app.float.result_list_row_padding_sm') : $r('app.float.result_list_row_padding') }) .backgroundColor($r('app.color.result_background')) .borderRadius($r('app.float.result_list_row_radius')) diff --git a/features/search/src/main/ets/view/SearchView.ets b/features/search/src/main/ets/view/SearchView.ets index 2eb2de735f727cbfe4752eef127f00a80fea8c6b..7f0298f4147999ca4080b8530403634057e2c9f0 100644 --- a/features/search/src/main/ets/view/SearchView.ets +++ b/features/search/src/main/ets/view/SearchView.ets @@ -50,15 +50,15 @@ export struct SearchView { SearchContent({ searchVideoList: $searchVideoList }) .layoutWeight(1) .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[0] || this.searchInput === - SearchConstants.SEARCH_INPUT_LIST[1] ? Visibility.None : Visibility.Visible) + SearchConstants.SEARCH_INPUT_LIST[1] ? Visibility.None : Visibility.Visible) SearchForHua({ searchInput: $searchInput }) .layoutWeight(1) .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[0] ? Visibility.Visible : - Visibility.None) + Visibility.None) SearchResult() .layoutWeight(1) .visibility(this.searchInput === SearchConstants.SEARCH_INPUT_LIST[1] ? Visibility.Visible : - Visibility.None) + Visibility.None) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) @@ -70,8 +70,10 @@ export struct SearchView { }) } } - .padding({ left: (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && (this.currentTopIndex === 2) ? - $r('app.float.search_view_grid_row_padding') : 0 }) + .padding({ + left: (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && (this.currentTopIndex === 2) ? + $r('app.float.search_view_grid_row_padding') : 0 + }) .onBreakpointChange((breakPoints) => { this.searchVideoList = new SearchVideoImgModel().getTrendSearchList(breakPoints); }) diff --git a/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets b/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets index 7e268f5cd0a012b231b14f8a28a03c896e9cd02c..1021101843c9653a51bafcbd46212e9b7bc916c5 100644 --- a/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets +++ b/features/search/src/main/ets/viewmodel/SearchVideoImgViewModel.ets @@ -76,17 +76,14 @@ export class SearchVideoImg { * Image src of the video. */ private imgSrc: Resource; - /** * Title of the video. */ private title: ResourceStr; - /** * Content of the video. */ private content: ResourceStr; - /** * Other information of the video. */ diff --git a/features/videoDetail/src/main/ets/view/AllComments.ets b/features/videoDetail/src/main/ets/view/AllComments.ets index e5a3c1abd866120b67e831219344d799d9c0943b..33f454aef2fe9c0a7f4794d0c3ad667e7f5d49f1 100644 --- a/features/videoDetail/src/main/ets/view/AllComments.ets +++ b/features/videoDetail/src/main/ets/view/AllComments.ets @@ -56,11 +56,11 @@ export struct AllComments { Text(item.getComment()) .margin({ left: $r('app.float.all_comments_comment_left') }) .opacity(CommonConstants.TEXT_OPACITY[2]) - .fontSize( $r('app.float.all_comments_comment_font')) - .lineHeight( $r('app.float.all_comments_comment_text_line')) + .fontSize($r('app.float.all_comments_comment_font')) + .lineHeight($r('app.float.all_comments_comment_text_line')) .fontWeight(CommonConstants.FONT_WEIGHT_500) } - .margin({ top: $r('app.float.all_comments_comment_row_top') }) + .margin({ top: $r('app.float.all_comments_comment_row_top') }) .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Start) @@ -71,12 +71,12 @@ export struct AllComments { this.commentImgWidth).getValue(this.currentWidthBreakpoint)) .height(new BreakpointType('227vp', '254vp', this.commentImgHeight).getValue(this.currentWidthBreakpoint)) - .borderRadius( $r('app.float.all_comments_img_radius')) + .borderRadius($r('app.float.all_comments_img_radius')) .aspectRatio(1.46) // [End get_comment_image_src] } - .padding({ left: $r('app.float.all_comments_img_row_padding') }) - .margin({ top: $r('app.float.all_comments_img_row_margin') }) + .padding({ left: $r('app.float.all_comments_img_row_padding') }) + .margin({ top: $r('app.float.all_comments_img_row_margin') }) .width(CommonConstants.FULL_PERCENT) .justifyContent(FlexAlign.Start) .visibility(!item.getCommentImageSrc() ? Visibility.None : Visibility.Visible) diff --git a/features/videoDetail/src/main/ets/view/FooterEpisodes.ets b/features/videoDetail/src/main/ets/view/FooterEpisodes.ets index c30be49d8eba1ff9309a4eb0f012c9a5b2ed51a7..4377da20d5ddbd53429f3597d391901a7381f1f6 100644 --- a/features/videoDetail/src/main/ets/view/FooterEpisodes.ets +++ b/features/videoDetail/src/main/ets/view/FooterEpisodes.ets @@ -84,7 +84,7 @@ export struct FooterEpisodes { .layoutWeight(1) .padding({ bottom: $r('app.float.episode_list_bottom') }) .lanes(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD ? DetailConstants.EPISODE_LIST_LANES[0] : - DetailConstants.EPISODE_LIST_LANES[1], $r('app.float.episode_list_lanes_space')) + DetailConstants.EPISODE_LIST_LANES[1], $r('app.float.episode_list_lanes_space')) } .layoutWeight(1) .width(CommonConstants.FULL_PERCENT) @@ -104,7 +104,7 @@ export struct FooterEpisodes { return this.currentWidthBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None; } if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint !== - BreakpointConstants.BREAKPOINT_SM) { + BreakpointConstants.BREAKPOINT_SM) { return Visibility.Visible; } return Visibility.None; diff --git a/features/videoDetail/src/main/ets/view/RelatedList.ets b/features/videoDetail/src/main/ets/view/RelatedList.ets index b83eb5925a8899b610880905fed12922072fb442..6bd7aefd4d86a347d569f0a6ad642a21ad597bef 100644 --- a/features/videoDetail/src/main/ets/view/RelatedList.ets +++ b/features/videoDetail/src/main/ets/view/RelatedList.ets @@ -41,9 +41,9 @@ export struct RelatedList { Column() { this.RelatedVideoComponent() this.VideoIntroduction() - AllComments({commentImgHeight: this.commentImgHeight, commentImgWidth: this.commentImgWidth}) + AllComments({ commentImgHeight: this.commentImgHeight, commentImgWidth: this.commentImgWidth }) .visibility(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.None : - Visibility.Visible) + Visibility.Visible) } .width('100%') .alignItems(HorizontalAlign.Start) @@ -116,7 +116,7 @@ export struct RelatedList { // Percentage of screen height by sliding. let offsetPercent = (Math.abs(offset) * DetailConstants.TEN) / this.screenHeight; this.relatedVideoHeight = (this.relatedVideoHeight + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT) > - DetailConstants.RELATED_LIST_HEIGHT ? DetailConstants.RELATED_LIST_HEIGHT : (this.relatedVideoHeight + + DetailConstants.RELATED_LIST_HEIGHT ? DetailConstants.RELATED_LIST_HEIGHT : (this.relatedVideoHeight + offsetPercent * DetailConstants.RELATED_LIST_HEIGHT); // Returns the actual offset 0. return { offsetRemain: 0 }; @@ -125,6 +125,7 @@ export struct RelatedList { } }) } + // [End build_scroller] @Builder @@ -233,6 +234,7 @@ export struct RelatedList { .height($r('app.float.episodes_list_height')) .width($r('app.float.episodes_list_width')) .borderRadius($r('app.float.episodes_list_radius')) + // [EndExclude video_introduction] } }, (item: string, index: number) => index + JSON.stringify(item)) @@ -273,6 +275,7 @@ export struct RelatedList { right: $r('app.float.sub_title_row_padding') }) .width('100%') + // [EndExclude video_introduction] } .width('100%') @@ -327,6 +330,7 @@ export struct RelatedList { .width('100%') .alignItems(VerticalAlign.Center) } + // [End video_introduction] @Builder diff --git a/features/videoDetail/src/main/ets/view/SelfComment.ets b/features/videoDetail/src/main/ets/view/SelfComment.ets index e5486af0c627210099d01cea19835716d38fabb4..219320d94cd54abced678b5fc65fb9d206f58f35 100644 --- a/features/videoDetail/src/main/ets/view/SelfComment.ets +++ b/features/videoDetail/src/main/ets/view/SelfComment.ets @@ -80,14 +80,14 @@ export struct SelfComment { offsetY: DetailConstants.SHADOW_OFFSET_Y }) .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? $r('app.float.self_comment_row_height') : - $r('app.float.self_comment_row_height_more')) + $r('app.float.self_comment_row_height_more')) .width(CommonConstants.FULL_PERCENT) .alignItems(VerticalAlign.Center) .backgroundColor(Color.White) .padding({ right: $r('app.float.self_comment_row_padding_right'), bottom: deviceInfo.deviceType === CommonConstants.DEVICE_TYPE ? 0 : - $r('app.float.self_comment_row_padding_bottom') + $r('app.float.self_comment_row_padding_bottom') }) } } \ No newline at end of file diff --git a/features/videoDetail/src/main/ets/view/SideEpisodes.ets b/features/videoDetail/src/main/ets/view/SideEpisodes.ets index 96ea6683185332ba29faa73201eacc9799528cd2..72fe2d4e189af0d6f68969446ecd7d9bd24b54c2 100644 --- a/features/videoDetail/src/main/ets/view/SideEpisodes.ets +++ b/features/videoDetail/src/main/ets/view/SideEpisodes.ets @@ -39,8 +39,10 @@ export struct SideEpisodes { Blank() } .width(CommonConstants.FULL_PERCENT) - .margin({ bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? - $r('app.float.side_row_margin_sm') : $r('app.float.side_row_margin') }) + .margin({ + bottom: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_SM ? + $r('app.float.side_row_margin_sm') : $r('app.float.side_row_margin') + }) List({ space: CommonConstants.LIST_SPACE }) { ForEach(DetailConstants.PLAYER_EPISODE, (item: string, index: number) => { @@ -56,9 +58,9 @@ export struct SideEpisodes { .width($r('app.float.playing_size')) .position({ x: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.playing_position_x_side_lg') : $r('app.float.playing_position_x_side'), + $r('app.float.playing_position_x_side_lg') : $r('app.float.playing_position_x_side'), y: this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.playing_position_y_side_lg') : $r('app.float.playing_position_y_side') + $r('app.float.playing_position_y_side_lg') : $r('app.float.playing_position_y_side') }) .visibility(index === 1 ? Visibility.Visible : Visibility.None) } @@ -66,9 +68,9 @@ export struct SideEpisodes { .borderRadius($r('app.float.episode_row_radius')) .backgroundColor($r('app.color.episode_row_background')) .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.episode_row_width_lg') : $r('app.float.episode_row_width_other')) + $r('app.float.episode_row_width_lg') : $r('app.float.episode_row_width_other')) .height(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.episode_row_height_lg') : $r('app.float.episode_row_height_other')) + $r('app.float.episode_row_height_lg') : $r('app.float.episode_row_height_other')) } }, (item: string, index: number) => index + JSON.stringify(item)) } @@ -89,7 +91,7 @@ export struct SideEpisodes { .height(CommonConstants.FULL_PERCENT) .width(this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.side_col_width') : 0) .visibility((this.isShowingSideBar && this.isFullScreen && (this.currentWidthBreakpoint === - BreakpointConstants.BREAKPOINT_LG || (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && + BreakpointConstants.BREAKPOINT_LG || (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === BreakpointConstants.BREAKPOINT_SM))) ? Visibility.Visible : Visibility.None) } } diff --git a/features/videoDetail/src/main/ets/view/VideoDetail.ets b/features/videoDetail/src/main/ets/view/VideoDetail.ets index 34589e6b376546ddf862bc549dd8f4bd90f481eb..f24aea229f6ebd55d9f935a1cf6b3589fc8b27f5 100644 --- a/features/videoDetail/src/main/ets/view/VideoDetail.ets +++ b/features/videoDetail/src/main/ets/view/VideoDetail.ets @@ -98,7 +98,7 @@ export struct VideoDetail { private onFullScreenChange(): void { // Large folding screen (X series) in unfolded state and tablet state, supporting rotation && large folding screen (X series) in hover state requires landscape display and does not support rotation. if (((this.currentWidthBreakpoint === 'md' && this.currentHeightBreakpoint !== - 'sm') || this.currentWidthBreakpoint === 'lg') && + 'sm') || this.currentWidthBreakpoint === 'lg') && !this.isHalfFolded) { this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); } @@ -127,6 +127,7 @@ export struct VideoDetail { } } } + // [End on_full_screen_change] aboutToAppear() { @@ -140,6 +141,7 @@ export struct VideoDetail { this.windowUtil!.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); } } + // [End on_window_size_change] async aboutToDisappear() { @@ -234,6 +236,7 @@ export struct VideoDetail { .sideBarWidth($r('app.float.side_bar_min_width')) .minSideBarWidth($r('app.float.side_bar_min_width')) .maxSideBarWidth(this.getUIContext().px2vp(this.windowWidth * DetailConstants.COMMENTS_AREA_PERCENT)) + // [End side_bar_container] } .height(CommonConstants.FULL_PERCENT) diff --git a/features/videoDetail/src/main/ets/view/VideoDetailChange.ets b/features/videoDetail/src/main/ets/view/VideoDetailChange.ets index 6e9df84ce1191367ff89b205c9210cc9c72dc166..20ab3d8edd88b6243ffdce317e07fa09900a3572 100644 --- a/features/videoDetail/src/main/ets/view/VideoDetailChange.ets +++ b/features/videoDetail/src/main/ets/view/VideoDetailChange.ets @@ -60,8 +60,7 @@ export struct VideoDetail { BreakpointConstants.BREAKPOINT_SM) || this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_LG) && !this.isHalfFolded) { this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); - } - else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === + } else if (this.currentWidthBreakpoint === BreakpointConstants.BREAKPOINT_MD && this.currentHeightBreakpoint === BreakpointConstants.BREAKPOINT_SM) { if (this.isFullScreen) { this.windowUtil?.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE_RESTRICTED); @@ -124,6 +123,7 @@ export struct VideoDetail { } } } + // [End dd_on_full_screen_change] // [End on_full_screen_change] diff --git a/features/videoDetail/src/main/ets/view/VideoDetailView.ets b/features/videoDetail/src/main/ets/view/VideoDetailView.ets index d71d4ad51f9824d3766faf5e16452102ad1e3245..50d137208ae07b4bc0f60b6ff54f27411f579210 100644 --- a/features/videoDetail/src/main/ets/view/VideoDetailView.ets +++ b/features/videoDetail/src/main/ets/view/VideoDetailView.ets @@ -37,7 +37,7 @@ export struct VideoDetailView { private scroller: Scroller = new Scroller(); aboutToAppear(): void { - if(canIUse('SystemCapability.Window.SessionManager')){ + if (canIUse('SystemCapability.Window.SessionManager')) { this.foldStatus = display.getFoldStatus(); } } diff --git a/features/videoDetail/src/main/ets/view/VideoPlayer.ets b/features/videoDetail/src/main/ets/view/VideoPlayer.ets index bab11ddf0980a1fec627851b8f8d507e4371f5b0..115910c49bb8510b5642753d0b269dc82c3e3d88 100644 --- a/features/videoDetail/src/main/ets/view/VideoPlayer.ets +++ b/features/videoDetail/src/main/ets/view/VideoPlayer.ets @@ -100,6 +100,7 @@ export struct VideoPlayer { .justifyContent(FlexAlign.Center) .height(this.isHalfFolded ? this.creaseRegion[0] : (this.isFullScreen ? CommonConstants.FULL_PERCENT : 'auto')) .width(CommonConstants.FULL_PERCENT) + // [StartExclude stack_isfullscreen] } .width(CommonConstants.FULL_PERCENT) @@ -119,6 +120,7 @@ export struct VideoPlayer { } }) ) + // [EndExclude stack_isfullscreen] Column() { // [StartExclude stack_isfullscreen] @@ -192,6 +194,7 @@ export struct VideoPlayer { .height($r('app.float.icon_button_row_height')) .width(CommonConstants.FULL_PERCENT) .visibility(this.isFullScreen ? Visibility.Visible : Visibility.None) + // [EndExclude stack_aligncontent] // [EndExclude stack_isfullscreen] } @@ -208,6 +211,7 @@ export struct VideoPlayer { } }) ) + // [StartExclude stack_isfullscreen] // [StartExclude stack_aligncontent] Row() { @@ -288,6 +292,7 @@ export struct VideoPlayer { .width(CommonConstants.FULL_PERCENT) .backgroundColor(Color.Black) .focusable(false) + // [End stack_isfullscreen] // [End stack_aligncontent] } diff --git a/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets b/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets index 7e24db27dbb17f3ea425892ec053d685a501fbed..950252ebe3f70e7a960bad208679313e5d84e45f 100644 --- a/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets +++ b/features/videoDetail/src/main/ets/viewmodel/RelatedVideoViewModel.ets @@ -60,7 +60,6 @@ export class RelatedVideo { * Name of the related video. */ private name: ResourceStr; - /** * Image src of related video. */ diff --git a/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets b/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets index f75dceb09e11b5de6ae22a4a75b3ec1aaef9a0d0..ce7a5b5ba3649c8c864f36796f8240afdcb9d06f 100644 --- a/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets +++ b/features/videoDetail/src/main/ets/viewmodel/UserViewModel.ets @@ -41,28 +41,25 @@ export class UserInfo { * Name of the user. */ private name: string; - /** * Image src of user. */ private imageSrc: Resource; - /** * Comment of user. */ private comment: ResourceStr; - /** * Image src of the comment. */ private commentImageSrc: Resource | undefined; - /** * Time of the comment. */ private time: ResourceStr; - constructor(name: string, imageSrc: Resource, comment: ResourceStr, commentImageSrc: Resource | undefined, time: ResourceStr) { + constructor(name: string, imageSrc: Resource, comment: ResourceStr, commentImageSrc: Resource | undefined, + time: ResourceStr) { this.name = name; this.imageSrc = imageSrc; this.comment = comment; diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index b208a06c808db4ca4367e6a9cb3fcdb0260a4629..9163b7c5944e7eb8fd943697b25f807e24a71eb9 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -34,6 +34,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('windowWidth', windowSize.width); // [EndExclude EntryAbility] }; + // [StartExclude multi_entryAbility] // [StartExclude EntryAbility] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { @@ -43,6 +44,7 @@ export default class EntryAbility extends UIAbility { onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } + // [EndExclude multi_entryAbility] // [EndExclude EntryAbility] onWindowStageCreate(windowStage: window.WindowStage) { @@ -78,6 +80,7 @@ export default class EntryAbility extends UIAbility { // [EndExclude EntryAbility] // [EndExclude multi_entryAbility] } + // [End EntryAbility] // [StartExclude multi_entryAbility] @@ -126,7 +129,9 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('currentWidthBreakpoint', widthBp); AppStorage.setOrCreate('videoGridColumn', videoGridColumn); } + // [End update_width_bp] // [EndExclude multi_entryAbility] } + // [End multi_entryAbility] diff --git a/products/phone/src/main/ets/entryability/EntryAbilityChange.ets b/products/phone/src/main/ets/entryability/EntryAbilityChange.ets index ef5b61e293eeb625796109b026852ab8fe349eda..27f082f4f4ca3ea613fc31263ee119cfcbc25bf8 100644 --- a/products/phone/src/main/ets/entryability/EntryAbilityChange.ets +++ b/products/phone/src/main/ets/entryability/EntryAbilityChange.ets @@ -13,6 +13,7 @@ export default class EntryAbility extends UIAbility { this.windowUtil!.updateWidthBp(); AppStorage.setOrCreate('windowWidth', windowSize.width); }; + onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); @@ -29,5 +30,6 @@ export default class EntryAbility extends UIAbility { }) } } + // [End dd_entryability_default] // [End dd_entryability_uicontext] \ No newline at end of file diff --git a/products/phone/src/main/ets/entryability/EntryAbilityNew.ets b/products/phone/src/main/ets/entryability/EntryAbilityNew.ets index 032d56f45e32c80cff63cbd353fcbfc68638564e..f107f731d13c45b4611cf867a9eafc1e35836b4a 100644 --- a/products/phone/src/main/ets/entryability/EntryAbilityNew.ets +++ b/products/phone/src/main/ets/entryability/EntryAbilityNew.ets @@ -32,6 +32,7 @@ export default class EntryAbility extends UIAbility { let heightBp: HeightBreakpoint = this.uiContext!.getWindowHeightBreakpoint(); AppStorage.setOrCreate('currentHeightBreakpoint', heightBp); }; + onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); @@ -57,4 +58,5 @@ export default class EntryAbility extends UIAbility { }); } } + // [End dd_entryability]