From 462ab7422d9604bdcf8cc226ddea20f15e978075 Mon Sep 17 00:00:00 2001 From: "DESKTOP-9FJNTIC\\gyb" <121287102@qq.com> Date: Wed, 23 Jul 2025 10:22:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B8=B8=E9=87=8F=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/constants/CommonConstants.ets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/windowpiplibrary/src/main/ets/constants/CommonConstants.ets b/windowpiplibrary/src/main/ets/constants/CommonConstants.ets index 9569d46..69ddcca 100644 --- a/windowpiplibrary/src/main/ets/constants/CommonConstants.ets +++ b/windowpiplibrary/src/main/ets/constants/CommonConstants.ets @@ -152,10 +152,10 @@ export class CommonConstants { * AppStorage key prefix. */ public static readonly KEY_PREFIX: string = 'WindowPip'; - public static readonly KEY_PREFIX_BREAKPOINT: string = CommonConstants.KEY_PREFIX + 'WindowPipCurrentBreakpoint'; - public static readonly KEY_PREFIX_NAVIGATOR_BAR_HEIGHT: string = CommonConstants.KEY_PREFIX + 'WindowPipNavigatorBarHeight'; - public static readonly KEY_PREFIX_STATUS_BAR_HEIGHT: string = CommonConstants.KEY_PREFIX + 'WindowPipStatusBarHeight'; - public static readonly KEY_PREFIX_SYSTEM_COLOR_MODE: string = CommonConstants.KEY_PREFIX + 'WindowPipSystemColorMode'; - public static readonly KEY_PREFIX_SYSTEM_UICONTEXT: string = CommonConstants.KEY_PREFIX + 'WindowPipUIContext'; - public static readonly KEY_PREFIX_SYSTEM_PAGE_INFO: string = CommonConstants.KEY_PREFIX + 'WindowPipPageInfos'; + public static readonly KEY_PREFIX_BREAKPOINT: string = CommonConstants.KEY_PREFIX + 'CurrentBreakpoint'; + public static readonly KEY_PREFIX_NAVIGATOR_BAR_HEIGHT: string = CommonConstants.KEY_PREFIX + 'NavigatorBarHeight'; + public static readonly KEY_PREFIX_STATUS_BAR_HEIGHT: string = CommonConstants.KEY_PREFIX + 'StatusBarHeight'; + public static readonly KEY_PREFIX_SYSTEM_COLOR_MODE: string = CommonConstants.KEY_PREFIX + 'SystemColorMode'; + public static readonly KEY_PREFIX_SYSTEM_UICONTEXT: string = CommonConstants.KEY_PREFIX + 'UIContext'; + public static readonly KEY_PREFIX_SYSTEM_PAGE_INFO: string = CommonConstants.KEY_PREFIX + 'PageInfos'; } -- Gitee From 5c288edc086746f4807945f3636f76f466385312 Mon Sep 17 00:00:00 2001 From: "DESKTOP-9FJNTIC\\gyb" <121287102@qq.com> Date: Wed, 23 Jul 2025 16:30:45 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B1=87=E5=90=88,?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windowpiplibrary/src/main/ets/utils/BreakpointSystem.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windowpiplibrary/src/main/ets/utils/BreakpointSystem.ets b/windowpiplibrary/src/main/ets/utils/BreakpointSystem.ets index fc714de..f04e2f9 100644 --- a/windowpiplibrary/src/main/ets/utils/BreakpointSystem.ets +++ b/windowpiplibrary/src/main/ets/utils/BreakpointSystem.ets @@ -72,7 +72,7 @@ export class BreakpointType { export class BreakpointSystem { private static instance: BreakpointSystem; private currentBreakpoint: BreakpointTypeEnum = BreakpointTypeEnum.MD; - private uiContext: UIContext = AppStorage.get(CommonConstants.KEY_PREFIX_BREAKPOINT) as UIContext; + private uiContext: UIContext = AppStorage.get(CommonConstants.KEY_PREFIX_SYSTEM_UICONTEXT) as UIContext; private constructor() { } -- Gitee From 2f7e8c9dbdc4bb8ff658b008750c49d57d1f9e85 Mon Sep 17 00:00:00 2001 From: "DESKTOP-9FJNTIC\\gyb" <121287102@qq.com> Date: Thu, 24 Jul 2025 19:54:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E6=95=88?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2,=E4=BF=AE=E6=94=B9=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windowpiplibrary/Index.ets | 2 +- .../main/ets/component/WindowPipComponent.ets | 98 ------------------- windowpipsample/src/main/ets/pages/Index.ets | 5 +- 3 files changed, 3 insertions(+), 102 deletions(-) delete mode 100644 windowpiplibrary/src/main/ets/component/WindowPipComponent.ets diff --git a/windowpiplibrary/Index.ets b/windowpiplibrary/Index.ets index 128520f..5560b17 100644 --- a/windowpiplibrary/Index.ets +++ b/windowpiplibrary/Index.ets @@ -1,3 +1,3 @@ -export { WindowPipComponent } from './src/main/ets/component/WindowPipComponent'; +export { VideoPlayComponent } from './src/main/ets/component/VideoPlayComponent'; export { WindowPipController } from './src/main/ets/WindowPipController'; diff --git a/windowpiplibrary/src/main/ets/component/WindowPipComponent.ets b/windowpiplibrary/src/main/ets/component/WindowPipComponent.ets deleted file mode 100644 index 227704e..0000000 --- a/windowpiplibrary/src/main/ets/component/WindowPipComponent.ets +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { VideoPlayComponent } from './VideoPlayComponent'; -import { ImageWidthTitle } from './ImageWidthTitle'; -import { CommonConstants } from '../constants/CommonConstants'; -import { BreakpointTypeEnum } from '../utils/BreakpointSystem'; - -@Component -export struct WindowPipComponent { - @StorageLink(CommonConstants.KEY_PREFIX_BREAKPOINT) curBp: string = BreakpointTypeEnum.SM; - @Provide(CommonConstants.KEY_PREFIX_SYSTEM_PAGE_INFO) pageInfos: NavPathStack = new NavPathStack(); - private navigationId: string = 'navId'; - private videoList: Array = [ - $r('app.string.video1'), $r('app.string.video2'), $r('app.string.video3'), - $r('app.string.video4'), $r('app.string.video5'), $r('app.string.video6'), - $r('app.string.video7'), $r('app.string.video8'), $r('app.string.video9'), - $r('app.string.video10'), $r('app.string.video11'), $r('app.string.video12'), - $r('app.string.video13'), $r('app.string.video14'), $r('app.string.video15') - ]; - - @Builder - PageMap(name: string) { - if (name === CommonConstants.NAV_DESTINATION_NAME) { - VideoPlayComponent({ navigationId: this.navigationId }) - } - } - - aboutToAppear(): void { - this.getUIContext().getHostContext()!.eventHub.emit('onStateChange', true); - this.pageInfos?.pushPath({ name: CommonConstants.NAV_DESTINATION_NAME }, { launchMode: 3, animated: false }); - } - - build() { - Navigation(this.pageInfos) { - Column() { - Row() { - Text($r('app.string.pip_effect')) - .fontSize($r('sys.float.Title_L')) - .fontWeight(FontWeight.Bold) - .fontColor($r('sys.color.font_primary')) - } - .width('100%') - .height(40) - .margin({ - top: 84, - bottom: $r('sys.float.padding_level12') - }) - - Grid() { - ForEach(this.videoList, (item: Resource, index: number) => { - GridItem() { - ImageWidthTitle({ titleResource: item, pageInfos: this.pageInfos }) - } - .padding({ - bottom: this.videoList.length - 1 === index ? $r('sys.float.padding_level8') : - $r('sys.float.padding_level0') - }) - }, (item: Resource) => item.id.toString()) - } - .width(CommonConstants.FULL_PERCENT) - .layoutWeight(1) - .columnsTemplate(this.curBp === 'sm' ? CommonConstants.COLUMNS_TEMPLATE_SM : - this.curBp === 'md' ? CommonConstants.COLUMNS_TEMPLATE_MD : CommonConstants.COLUMNS_TEMPLATE_LG) - .columnsGap(this.curBp === 'lg' ? $r('sys.float.padding_level8') : $r('sys.float.padding_level6')) - .rowsGap(this.curBp === 'lg' ? $r('sys.float.padding_level8') : $r('sys.float.padding_level6')) - .scrollBar(BarState.Off) - } - .width(CommonConstants.FULL_PERCENT) - .padding({ - top: this.curBp === 'lg' ? $r('sys.float.padding_level8') : $r('sys.float.padding_level6'), - right: this.curBp === 'lg' ? $r('sys.float.padding_level8') : $r('sys.float.padding_level6'), - left: this.curBp === 'lg' ? $r('sys.float.padding_level8') : $r('sys.float.padding_level6') - }) - } - .title($r('app.string.pip_effect')) - .titleMode(NavigationTitleMode.Full) - .hideTitleBar(true) - .navDestination(this.PageMap) - .mode(NavigationMode.Stack) - .hideBackButton(true) - .backgroundColor($r('sys.color.background_secondary')) - .size({ width: CommonConstants.NAV_DESTINATION_WIDTH, height: CommonConstants.NAV_DESTINATION_HEIGHT }) - .id(this.navigationId) - } -} \ No newline at end of file diff --git a/windowpipsample/src/main/ets/pages/Index.ets b/windowpipsample/src/main/ets/pages/Index.ets index 04dab49..03d2286 100644 --- a/windowpipsample/src/main/ets/pages/Index.ets +++ b/windowpipsample/src/main/ets/pages/Index.ets @@ -13,15 +13,14 @@ * limitations under the License. */ -import { WindowPipComponent } from '@ohos_sample/windowpiplibrary'; - +import { VideoPlayComponent } from '@ohos_sample/windowpiplibrary'; @Entry @Component struct WindowPip { build() { Stack() { - WindowPipComponent() + VideoPlayComponent() } } } \ No newline at end of file -- Gitee