From 143eedd8cf16c00f0d59ef9a0c416404a6830124 Mon Sep 17 00:00:00 2001 From: yulei <1002365491@qq.com> Date: Mon, 16 Jun 2025 14:29:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix=EF=BC=9A=E8=A7=84=E8=8C=83=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/entryability/EntryAbility.ets | 2 ++ .../entry/src/main/ets/modules/AsideColum.ets | 1 + .../entry/src/main/ets/modules/Crease.ets | 16 +++++++++++++--- .../entry/src/main/ets/modules/Folder.ets | 2 ++ .../src/main/ets/modules/NavigationComponent.ets | 10 +++++++--- .../entry/src/main/ets/modules/PinchImage.ets | 11 ++++++----- .../src/main/ets/modules/PopupComponent.ets | 6 ++++-- .../entry/src/main/ets/modules/ScrollParent.ets | 3 ++- .../entry/src/main/ets/pages/Index.ets | 6 ++++-- .../entry/src/main/ets/utils/source_add1.ets | 3 ++- .../entry/src/main/ets/utils/source_add2.ets | 3 +++ .../entry/src/main/ets/utils/source_add3.ets | 1 + 12 files changed, 47 insertions(+), 17 deletions(-) diff --git a/FoldableGuilde/entry/src/main/ets/entryability/EntryAbility.ets b/FoldableGuilde/entry/src/main/ets/entryability/EntryAbility.ets index f2798137..e2a3c819 100644 --- a/FoldableGuilde/entry/src/main/ets/entryability/EntryAbility.ets +++ b/FoldableGuilde/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,6 +13,7 @@ export default class EntryAbility extends UIAbility { onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } + onWindowStageCreate(windowStage: window.WindowStage): void { let windowUtil = WindowUtil.getInstance(); if (windowUtil !== undefined) { @@ -45,6 +46,7 @@ export default class EntryAbility extends UIAbility { hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); } + onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); diff --git a/FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets b/FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets index 1b9587e3..d6acb9a7 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets @@ -14,6 +14,7 @@ export struct AsideColumn { }) .height('100%') .width(this.l_width) + Column() { Text('1') }.backgroundColor(Color.Gray) diff --git a/FoldableGuilde/entry/src/main/ets/modules/Crease.ets b/FoldableGuilde/entry/src/main/ets/modules/Crease.ets index fec47eb8..31cd68bc 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/Crease.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/Crease.ets @@ -1,6 +1,7 @@ // [Start crease] import display from '@ohos.display'; import { Callback } from '@ohos.base'; + @Entry @Component export struct Crease { @@ -11,8 +12,10 @@ export struct Crease { let callback: Callback = (data: display.FoldStatus) => { console.info('Listening enabled. Data: ' + JSON.stringify(data)); // Get the folding crease area, the left and top attributes are the left and upper boundaries of the rectangular area, and the width and height attributes are the width and height of the rectangular area。 - this.status = data.toString() + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].left + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].top - + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].width + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].height; + this.status = data.toString() + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].left + " " + + display.getCurrentFoldCreaseRegion().creaseRects[0].top + + " " + display.getCurrentFoldCreaseRegion().creaseRects[0].width + " " + + display.getCurrentFoldCreaseRegion().creaseRects[0].height; }; try { display.on('foldStatusChange', callback); @@ -20,9 +23,15 @@ export struct Crease { console.error('Failed to register callback. Code: ' + JSON.stringify(exception)); } } + build() { Column() { - Text(this.status).height(50).width("100%").textAlign(TextAlign.Center).fontSize(25).backgroundColor(Color.Red) + Text(this.status) + .height(50) + .width("100%") + .textAlign(TextAlign.Center) + .fontSize(25) + .backgroundColor(Color.Red) } .height("100%") .width("100%") @@ -31,4 +40,5 @@ export struct Crease { .justifyContent(FlexAlign.Start) } } + // [End crease] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/modules/Folder.ets b/FoldableGuilde/entry/src/main/ets/modules/Folder.ets index e92c284c..3e7e9b2a 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/Folder.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/Folder.ets @@ -4,6 +4,7 @@ export struct Folder { @State len_wid: number = 480 @State w: string = "40%" + build() { Column() { // UpperItems puts the required id hovering to the upper half of the screen into upperItems, and the other components will be stacked in the lower half of the screen @@ -62,4 +63,5 @@ export struct Folder { .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } } + // [End Folder] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets b/FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets index 0639dbde..d56e0265 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets @@ -2,7 +2,10 @@ @Entry @Component export struct NavigationComponent { - @State TooTmp: ToolbarItem = {'value': "func", 'action': ()=> {}} + @State TooTmp: ToolbarItem = { + 'value': "func", 'action': () => { + } + } private arr: number[] = [1, 2, 3]; build() { @@ -10,7 +13,7 @@ export struct NavigationComponent { // Root view container for routing navigation Navigation() { List({ space: 12 }) { - ForEach(this.arr, (item:string) => { + ForEach(this.arr, (item: string) => { ListItem() { // Navigation component, which provides click response processing by default, does not require developers to customize click event logic。 Navigation() { @@ -29,7 +32,7 @@ export struct NavigationComponent { .title("NavDestinationTitle" + item) } } - }, (item:string):string => item) + }, (item: string): string => item) } .width("90%") .margin({ top: 12 }) @@ -42,4 +45,5 @@ export struct NavigationComponent { .backgroundColor('#F1F3F5') } } + // [End NavigationComponent] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets b/FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets index 1740b683..3e14723a 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets @@ -2,12 +2,12 @@ @Entry @Component export struct PinchImage { - list: string[] = ['image1','image2','image3','image4','image5','image6'] + list: string[] = ['image1', 'image2', 'image3', 'image4', 'image5', 'image6'] @State GridColumn: string = '1fr 1fr 1fr' @State GridRow: string = '1fr 1fr' build() { - Column(){ + Column() { Grid() { ForEach(this.list, (item: string) => { GridItem() { @@ -21,8 +21,8 @@ export struct PinchImage { .columnsGap(12) } // Change the layout of the Grid when two-finger scaling is triggered - .gesture(PinchGesture({fingers:2}).onActionUpdate((event:GestureEvent)=>{ - if (event.scale>1) { + .gesture(PinchGesture({ fingers: 2 }).onActionUpdate((event: GestureEvent) => { + if (event.scale > 1) { // Increase animation effect this.getUIContext().animateTo({ duration: 500 @@ -30,7 +30,7 @@ export struct PinchImage { // When the two-finger scaling ratio is > 1, the number of Grid columns becomes 2 this.GridColumn = '1fr 1fr'; }) - }else { + } else { this.getUIContext().animateTo({ duration: 500 }, () => { @@ -41,4 +41,5 @@ export struct PinchImage { })) } } + // [End PinchImage] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/modules/PopupComponent.ets b/FoldableGuilde/entry/src/main/ets/modules/PopupComponent.ets index cafecb89..4bca3b06 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/PopupComponent.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/PopupComponent.ets @@ -4,10 +4,11 @@ export struct PopupExample { @State customPopup1: boolean = false @State customPopup2: boolean = false + build() { Row() { Button("popup1") - .onClick(()=>{ + .onClick(() => { this.customPopup1 = !this.customPopup1 }) // Bind the Popup window to the component and align it near the edge @@ -17,7 +18,7 @@ export struct PopupExample { }) Blank() Button("popup2") - .onClick(()=>{ + .onClick(() => { this.customPopup2 = !this.customPopup2 }) // Bind the Popup window to the component and align it near the edge @@ -30,4 +31,5 @@ export struct PopupExample { .height('100%') } } + // [End PopupExample] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/modules/ScrollParent.ets b/FoldableGuilde/entry/src/main/ets/modules/ScrollParent.ets index 636aa914..922a9440 100644 --- a/FoldableGuilde/entry/src/main/ets/modules/ScrollParent.ets +++ b/FoldableGuilde/entry/src/main/ets/modules/ScrollParent.ets @@ -9,7 +9,8 @@ export struct NestedScroll { @State ScrollDirection: ScrollDirection = ScrollDirection.Vertical title = '2023落下帷幕,一起迎接2024年*****************************************' review = '评论' - context = '一起迎接2024年,************************,************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************' + context = + '一起迎接2024年,************************,************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************' list = [0, 0, 0, 0] build() { diff --git a/FoldableGuilde/entry/src/main/ets/pages/Index.ets b/FoldableGuilde/entry/src/main/ets/pages/Index.ets index e85cfc24..b7b8842b 100644 --- a/FoldableGuilde/entry/src/main/ets/pages/Index.ets +++ b/FoldableGuilde/entry/src/main/ets/pages/Index.ets @@ -37,9 +37,11 @@ struct Index { judgeDevice() { // [Start judgeDevice] // 1. The device type is phone, and it supports folding - if (deviceInfo.deviceType === 'phone' && display.isFoldable()) {} + if (deviceInfo.deviceType === 'phone' && display.isFoldable()) { + } // 2. Judging whether the current folding state is an expanded state/folded state/semi-folded state - if (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED) {} + if (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED) { + } // [End judgeDevice] } diff --git a/FoldableGuilde/entry/src/main/ets/utils/source_add1.ets b/FoldableGuilde/entry/src/main/ets/utils/source_add1.ets index 5f0cbd9d..4d602487 100644 --- a/FoldableGuilde/entry/src/main/ets/utils/source_add1.ets +++ b/FoldableGuilde/entry/src/main/ets/utils/source_add1.ets @@ -1,6 +1,6 @@ @Entry @Component -// [Start ScrollTest] + // [Start ScrollTest] export struct ScrollTest { // Height of fixed area @State barHeight: number = 56; @@ -50,4 +50,5 @@ export struct ScrollTest { }) } } + // [End ScrollTest] \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/utils/source_add2.ets b/FoldableGuilde/entry/src/main/ets/utils/source_add2.ets index b8118c42..957933d1 100644 --- a/FoldableGuilde/entry/src/main/ets/utils/source_add2.ets +++ b/FoldableGuilde/entry/src/main/ets/utils/source_add2.ets @@ -1,5 +1,6 @@ import { window, display } from '@kit.ArkUI' import { BusinessError } from '@kit.BasicServicesKit'; + export class Breakpoint { // [Start source_add2] // Update horizontal breakpoints according to window width @@ -26,6 +27,7 @@ export class Breakpoint { console.error(`Failed to obtain the top window. Cause code: ${err.code}, message: ${err.message}`); }); } + // Update the vertical breakpoint according to the window width-height ratio updateHeightBreakpoint(): void { const uiContext: UIContext | undefined = AppStorage.get('uiContext'); @@ -48,5 +50,6 @@ export class Breakpoint { console.error(`Failed to obtain the top window. Cause code: ${err.code}, message: ${err.message}`); }); } + // [End source_add2] } \ No newline at end of file diff --git a/FoldableGuilde/entry/src/main/ets/utils/source_add3.ets b/FoldableGuilde/entry/src/main/ets/utils/source_add3.ets index 598188a8..396030b5 100644 --- a/FoldableGuilde/entry/src/main/ets/utils/source_add3.ets +++ b/FoldableGuilde/entry/src/main/ets/utils/source_add3.ets @@ -1,5 +1,6 @@ import { window } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; + export class BreakpointHeight { updateHeightBreakpoint(): void { const uiContext: UIContext | undefined = AppStorage.get('uiContext'); -- Gitee From c33080fa9049a1a3d46cc0b648b7f651ae1e1d8b Mon Sep 17 00:00:00 2001 From: yulei <1002365491@qq.com> Date: Mon, 16 Jun 2025 15:39:21 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E8=A7=84=E8=8C=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/js/MainAbility/cryptoFramework/cryptoFramework.js | 4 ++++ LiteWearable/entry/src/main/js/MainAbility/detail/detail.hml | 1 + .../entry/src/main/js/MainAbility/details/details.hml | 1 + LiteWearable/entry/src/main/js/MainAbility/event/event.hml | 3 ++- LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml | 1 + .../entry/src/main/js/MainAbility/pages/index/index.hml | 1 + .../entry/src/main/js/MainAbility/screenLock/screenLock.js | 3 +++ LiteWearable/entry/src/main/js/MainAbility/security/DES.js | 4 ++++ .../entry/src/main/js/MainAbility/security/DesCBC64.js | 3 +++ LiteWearable/entry/src/main/js/MainAbility/security/HMAC.js | 3 +++ .../entry/src/main/js/MainAbility/security/KeyAlias.js | 2 ++ LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml | 2 ++ LiteWearable/entry/src/main/js/MainAbility/style2/style2.hml | 2 ++ LiteWearable/entry/src/main/js/MainAbility/style3/style3.css | 2 ++ LiteWearable/entry/src/main/js/MainAbility/style3/style3.hml | 2 ++ LiteWearable/entry/src/main/js/MainAbility/style4/style4.hml | 3 ++- 16 files changed, 35 insertions(+), 2 deletions(-) diff --git a/LiteWearable/entry/src/main/js/MainAbility/cryptoFramework/cryptoFramework.js b/LiteWearable/entry/src/main/js/MainAbility/cryptoFramework/cryptoFramework.js index a15bc859..7023409f 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/cryptoFramework/cryptoFramework.js +++ b/LiteWearable/entry/src/main/js/MainAbility/cryptoFramework/cryptoFramework.js @@ -1,5 +1,6 @@ // [Start do_md] import cryptoFramework from '@ohos.security.cryptoFramework'; + // [StartExclude do_md] export default { data: { @@ -9,6 +10,7 @@ export default { this.title = "Hello World"; } }; + // [EndExclude do_md] function stringToUint8Array(str) { let arr = []; @@ -52,6 +54,7 @@ function doMd() { } console.info(`md len: ${mdLen}`); } + // [End do_md] // [Start do_rand] function doRand() { @@ -89,4 +92,5 @@ function doRand() { return 'doRand error'; } } + // [End do_rand] \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/detail/detail.hml b/LiteWearable/entry/src/main/js/MainAbility/detail/detail.hml index f3a9eb9f..416d749b 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/detail/detail.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/detail/detail.hml @@ -6,4 +6,5 @@ + \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/details/details.hml b/LiteWearable/entry/src/main/js/MainAbility/details/details.hml index 43daa6f9..99fd9532 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/details/details.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/details/details.hml @@ -6,4 +6,5 @@ + \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/event/event.hml b/LiteWearable/entry/src/main/js/MainAbility/event/event.hml index 2d1641b0..907b4611 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/event/event.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/event/event.hml @@ -1,9 +1,10 @@
- + Hello World
+ \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml index 9b0a820d..bfcf8438 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/exit/exit.hml @@ -6,4 +6,5 @@ + \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.hml b/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.hml index 4999668e..a388e68c 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/pages/index/index.hml @@ -6,4 +6,5 @@ + \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/screenLock/screenLock.js b/LiteWearable/entry/src/main/js/MainAbility/screenLock/screenLock.js index 119a8bb9..a0558a0b 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/screenLock/screenLock.js +++ b/LiteWearable/entry/src/main/js/MainAbility/screenLock/screenLock.js @@ -25,6 +25,7 @@ function unlockScreen() { return result; } + // [End unlock_screen] // [Start is_screen_locked] function isScreenLocked() { @@ -40,6 +41,7 @@ function isScreenLocked() { }); return result; } + // [End is_screen_locked] // [Start is_secure_mode] function isSecureMode() { @@ -55,4 +57,5 @@ function isSecureMode() { }); return result; } + // [End is_secure_mode] \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/security/DES.js b/LiteWearable/entry/src/main/js/MainAbility/security/DES.js index efa05f9a..042dc889 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/security/DES.js +++ b/LiteWearable/entry/src/main/js/MainAbility/security/DES.js @@ -13,6 +13,7 @@ let IV = '12345678'; let plainText = 'DESAAAdffssghCBC5612345612345L64'; // 密文,存放加密后数据 let cipherText = ''; + // [EndExclude des_generate] // [StartExclude des_encrypt] @@ -53,6 +54,7 @@ function generateDESKey() { }); return huksInfo; } + // [EndExclude des_encrypt] // [End des_generate] function getDesCBCEncryptProperties() { @@ -171,6 +173,7 @@ function encryptDES() { return huksInfo; } + // [EndExclude des_decrypt] function stringToUint8Array(str) { let arr = []; @@ -189,6 +192,7 @@ function uint8ArrayToString(fileData) { return dataString; } + // [End des_encrypt] function GetDesCBCDecryptProperties() { diff --git a/LiteWearable/entry/src/main/js/MainAbility/security/DesCBC64.js b/LiteWearable/entry/src/main/js/MainAbility/security/DesCBC64.js index 39f36e76..590ab8c4 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/security/DesCBC64.js +++ b/LiteWearable/entry/src/main/js/MainAbility/security/DesCBC64.js @@ -3,6 +3,7 @@ import huks from '@ohos.security.huks'; const KEY_ALIAS = 'DesCBC64KeyAlias'; + // [StartExclude delete_key_process] function isKeyItemExist() { let huksInfo; @@ -20,6 +21,7 @@ function isKeyItemExist() { return huksInfo; } + // [End is_key_item_exist] // [EndExclude delete_key_process] function deleteKeyProcess() { @@ -36,4 +38,5 @@ function deleteKeyProcess() { }) return huksInfo; } + // [End delete_key_process] \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/security/HMAC.js b/LiteWearable/entry/src/main/js/MainAbility/security/HMAC.js index c3048f3c..b5532bd2 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/security/HMAC.js +++ b/LiteWearable/entry/src/main/js/MainAbility/security/HMAC.js @@ -11,6 +11,7 @@ let plainText = 'HMACSAdffssghABC5612345612345192'; let cipherText = ''; // 操作句柄 let handle; + // [EndExclude hmac_generate] // [StartExclude hmac_process] function getHMACGenProperties() { @@ -48,6 +49,7 @@ function generateHMACKey() { }); return huksInfo; } + // [End hmac_generate] // [EndExclude hmac_process] function uint8ArrayToString(fileData) { @@ -163,4 +165,5 @@ function HMACProcess() { } return huksInfo; } + // [End hmac_process] \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/security/KeyAlias.js b/LiteWearable/entry/src/main/js/MainAbility/security/KeyAlias.js index 2bf66909..234dc5bf 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/security/KeyAlias.js +++ b/LiteWearable/entry/src/main/js/MainAbility/security/KeyAlias.js @@ -71,6 +71,7 @@ function uint8ArrayToString(fileData) { return dataString; } + // [End import_key] // [EndExclude export_key] function exportKeyProcess() { @@ -89,4 +90,5 @@ function exportKeyProcess() { return huksInfo; } + // [End export_key] \ No newline at end of file diff --git a/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml b/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml index bc53d37e..5a6e0d3d 100644 --- a/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml +++ b/LiteWearable/entry/src/main/js/MainAbility/style1/style1.hml @@ -2,8 +2,10 @@
+ Hello World
+
+ Hello World
+
+ Hello World
+
- + Hello World
+