From e380ba403a81d9687b3452663a40fd007131f86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E5=8D=93=E4=BC=A6?= <2658469835@qq.com> Date: Fri, 30 May 2025 11:37:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:feat=20(=E6=A0=87=E8=AF=86):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20MultiWindowPractice=20=E4=BB=93=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Question1Correct.ets | 12 ++++++------ .../src/main/ets/pages/Question2Incorrect.ets | 19 ++++++++++--------- .../src/main/ets/pages/Question6Incorrect.ets | 4 ++-- entry/src/main/module.json5 | 12 ++++++++++-- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/entry/src/main/ets/pages/Question1Correct.ets b/entry/src/main/ets/pages/Question1Correct.ets index dd8a97a..5f305af 100644 --- a/entry/src/main/ets/pages/Question1Correct.ets +++ b/entry/src/main/ets/pages/Question1Correct.ets @@ -17,7 +17,7 @@ export function Question1CorrectBuilder() { Question1Correct() } -// [Start Question1_correct ] +// [Start Question1_correct] @Component export struct Question1Correct { build() { @@ -39,20 +39,20 @@ export struct Question1Correct { .backgroundColor(Color.Orange) } } - // [StartExclude Question1_correct ] + // [StartExclude Question1_correct] .padding({ left: 16, right: 16 }) - // [EndExclude Question1_correct ] + // [EndExclude Question1_correct] } - // [StartExclude Question1_correct ] + // [StartExclude Question1_correct] .hideTitleBar(true) .padding({ top: AppStorage.get('statusBarHeight') ?? 0, bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16 }) - // [EndExclude Question1_correct ] + // [EndExclude Question1_correct] } } -// [End Question1_correct ] \ No newline at end of file +// [End Question1_correct] \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question2Incorrect.ets b/entry/src/main/ets/pages/Question2Incorrect.ets index a31ad73..5dd37c6 100644 --- a/entry/src/main/ets/pages/Question2Incorrect.ets +++ b/entry/src/main/ets/pages/Question2Incorrect.ets @@ -20,35 +20,36 @@ import { AVPlayerUtil } from '../common/AVPlayerUtil'; export function Question2IncorrectBuilder() { Question2Incorrect() } -// [Start Question2_incorrect] +// [Start Question2Incorrect] @Component export struct Question2Incorrect { @State aspect: number = 9 / 16; // default video height/width ratio value - @State xComponentWidth: number = this.getUIContext().px2vp(display.getDefaultDisplaySync().width); - @State xComponentHeight: number = this.getUIContext().px2vp(display.getDefaultDisplaySync().width * this.aspect); + @State xComponentWidth: number = px2vp(display.getDefaultDisplaySync().width); + @State xComponentHeight: number = px2vp(display.getDefaultDisplaySync().width * this.aspect); + // [StartExclude Question2Incorrect] private xComponentController: XComponentController = new XComponentController(); private player?: AVPlayerUtil; aboutToDisappear(): void { this.player?.stopPlay(); } - // [EndExclude Question2_incorrect] + // [EndExclude Question2Incorrect] build() { NavDestination() { Stack() { XComponent({ id: 'video_player_id', type: XComponentType.SURFACE, controller: this.xComponentController }) - // [StartExclude Question2_incorrect] + // [StartExclude Question2Incorrect] .onLoad(() => { this.player = new AVPlayerUtil(); this.player.setSurfaceId(this.xComponentController.getXComponentSurfaceId()); this.player.initPlayer('testVideo2.mp4', (aspect: number) => { this.aspect = aspect; - this.xComponentHeight = this.getUIContext().px2vp(display.getDefaultDisplaySync().height); - this.xComponentWidth = this.getUIContext().px2vp(display.getDefaultDisplaySync().height * aspect); + this.xComponentHeight = px2vp(display.getDefaultDisplaySync().height); + this.xComponentWidth = px2vp(display.getDefaultDisplaySync().height * aspect); }); }) - // [EndExclude Question2_incorrect] + // [EndExclude Question2Incorrect] .width(this.xComponentWidth) .height(this.xComponentHeight) } @@ -59,4 +60,4 @@ export struct Question2Incorrect { .hideTitleBar(true) } } -// [End Question2_incorrect] \ No newline at end of file +// [End Question2Incorrect] \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question6Incorrect.ets b/entry/src/main/ets/pages/Question6Incorrect.ets index 5a92ba1..97c1e67 100644 --- a/entry/src/main/ets/pages/Question6Incorrect.ets +++ b/entry/src/main/ets/pages/Question6Incorrect.ets @@ -67,7 +67,7 @@ struct CustomDialogComp1 { }) } .constraintSize({ - maxHeight: '90%' + maxHeight: '80%' }) // [StartExclude Custom_dialog_comp1] .height(400) @@ -81,6 +81,7 @@ struct CustomDialogComp1 { // [EndExclude Custom_dialog_comp1] } } +// [End Custom_dialog_comp1] @Component export struct Question6Incorrect { @@ -113,4 +114,3 @@ export struct Question6Incorrect { }) } } -// [End Custom_dialog_comp1] \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 6f79f46..13112d4 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -1,5 +1,7 @@ +// [Start module_json_one] { "module": { + // [StartExclude module_json_one] "name": "entry", "type": "entry", "description": "$string:module_desc", @@ -11,9 +13,11 @@ "installationFree": false, "pages": "$profile:main_pages", "routerMap": "$profile:route_map", + // [EndExclude module_json_one] "abilities": [ { "name": "EntryAbility", + // [StartExclude module_json_one] "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:layered_image", @@ -31,9 +35,11 @@ ] } ], + // [EndExclude module_json_one] "preferMultiWindowOrientation": "landscape_auto" } ], + // [StartExclude module_json_one] "extensionAbilities": [ { "name": "EntryBackupAbility", @@ -47,6 +53,8 @@ } ] } - ] + ], + // [EndExclude module_json_one] } -} \ No newline at end of file +} +// [End module_json_one] \ No newline at end of file -- Gitee