diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fc1d943824f4dfbaf77ca2340330d407d15ef0a9..bdc3d80245db0b07236bce875c1ef99d8f3f7dce 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -73,6 +73,7 @@ struct Index { // [EndExclude SelectCamera2] // Exit the half folded status page. if (this.isHalfFolded) { + this.isHalfFolded = false; this.cameraUtil.setXComponentRect(this.windowUtil.getWindowSize()); } else { if (foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED || @@ -88,7 +89,6 @@ struct Index { } } // [StartExclude SelectCamera2] - this.isHalfFolded = false; this.oldFoldStatus = foldStatus; // [EndExclude SelectCamera2] } diff --git a/entry/src/main/ets/utils/CameraUtil.ets b/entry/src/main/ets/utils/CameraUtil.ets index 6aa127eda8942d3a160dd12cb3527e0c6b3ae0f8..44673338935b70c4e77b8c693bfde4f4e1949116 100644 --- a/entry/src/main/ets/utils/CameraUtil.ets +++ b/entry/src/main/ets/utils/CameraUtil.ets @@ -286,6 +286,10 @@ export class CameraUtil { this.xComponentController!.setXComponentSurfaceRect(rect); return; } + if (AppStorage.get('isHalfFolded')) { + this.setHalfFoldedRect(windowSize); + return; + } if (displayRotation === 0 || displayRotation === 180) { if (windowSize.height * 3 / 4 > windowSize.width) { rect.surfaceHeight = windowSize.width / 3 * 4; diff --git a/entry/src/main/ets/views/CommonView.ets b/entry/src/main/ets/views/CommonView.ets index d640d0325af58680e7f473b094a07725371c7f69..6c7b49e1b9710b86efbcc1f5061b1c49db9862ce 100644 --- a/entry/src/main/ets/views/CommonView.ets +++ b/entry/src/main/ets/views/CommonView.ets @@ -124,14 +124,14 @@ export struct ShotAreaSm { .animation({ curve: curves.springMotion() }) .onClick(() => { if (this.photoUri !== '') { - this.cameraUtil?.previewPhoto(); + this.cameraUtil.previewPhoto(); } }) Image($r('app.media.icon_shoot')) .width(this.heightBp === HeightBreakpoint.HEIGHT_LG ? 76 : 46) .height(this.heightBp === HeightBreakpoint.HEIGHT_LG ? 76 : 46) .onClick(() => { - this.cameraUtil?.capture(); + this.cameraUtil.capture(); }) Image($r('app.media.icon_flip')) .width(this.heightBp === HeightBreakpoint.HEIGHT_LG ? 44 : 28) @@ -139,11 +139,11 @@ export struct ShotAreaSm { .onClick(() => { let isFront: boolean | undefined = AppStorage.get('isFront'); if (isFront) { - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_BACK); return; } - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); }) } .width(this.heightBp === HeightBreakpoint.HEIGHT_LG ? 256 : 158) @@ -174,17 +174,17 @@ export struct ShotArea { .onClick(() => { let isFront: boolean | undefined = AppStorage.get('isFront'); if (isFront) { - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_BACK); return; } - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); }) Image($r('app.media.icon_shoot')) .width(76) .height(76) .onClick(() => { - this.cameraUtil?.capture(); + this.cameraUtil.capture(); }) Image(this.photoUri) .width(44) @@ -195,7 +195,7 @@ export struct ShotArea { .animation({ curve: curves.springMotion() }) .onClick(() => { if (this.photoUri !== '') { - this.cameraUtil?.previewPhoto(); + this.cameraUtil.previewPhoto(); } }) } @@ -251,16 +251,16 @@ export struct ShotAreaHalfFolded { .onClick(() => { let isFront: boolean | undefined = AppStorage.get('isFront'); if (isFront) { - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_BACK); + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_BACK); return; } - this.cameraUtil?.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); + this.cameraUtil.cameraShooting(this.surfaceId, this.context!, camera.CameraPosition.CAMERA_POSITION_FRONT); }) Image($r('app.media.icon_shoot')) .width(76) .height(76) .onClick(() => { - this.cameraUtil?.capture(); + this.cameraUtil.capture(); }) Image(this.photoUri) .width(44) @@ -271,7 +271,7 @@ export struct ShotAreaHalfFolded { .animation({ curve: curves.springMotion() }) .onClick(() => { if (this.photoUri !== '') { - this.cameraUtil?.previewPhoto(); + this.cameraUtil.previewPhoto(); } }) }