diff --git a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets index f88585fb570fcf8a262c2474bbb91e5f6537760c..44d34dda767fff4e8ff6b60591ecf8fdee45b0c5 100644 --- a/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ArkUIKit/ArkUIWindowSamples/CreateFloatWindow/entry/src/main/ets/entryability/EntryAbility.ets @@ -72,7 +72,6 @@ export default class EntryAbility extends UIAbility { hilog.info(DOMAIN, TAG, `Succeeded in showing the window.`); }); }); - // 4.销毁悬浮窗。当不再需要悬浮窗时,可根据具体实现逻辑,使用destroy对其进行销毁。 }); } }; diff --git a/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/ets/entryability/EntryAbility.ets index 98e686adfd35b84054bb77048938128b8648cddf..5093538311dea0328dd8a75f667bca86538b9695 100644 --- a/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/ets/entryability/EntryAbility.ets @@ -20,7 +20,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; import hilog from '@ohos.hilog'; const DOMAIN = 0X0000; -const TAG : string = '[Sample_CCreatMainWindow]'; +const TAG : string = '[Sample_CreatMainWindow]'; export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { diff --git a/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/module.json5 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..546b83981e5aa36322e328ffac5f7b08e8818d33 100644 --- a/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/module.json5 +++ b/ArkUIKit/ArkUIWindowSamples/CreateMainWindow/entry/src/main/module.json5 @@ -19,7 +19,8 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5 index b97e860de808ae4e85362dc1ab044800f9d27836..f0a2c1bca66bae1d20408c8aff44b834fabfa60a 100644 --- a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5 +++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow/entry/src/main/module.json5 @@ -19,7 +19,8 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..546b83981e5aa36322e328ffac5f7b08e8818d33 100644 --- a/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5 +++ b/ArkUIKit/ArkUIWindowSamples/CreateSubWindow2/entry/src/main/module.json5 @@ -19,7 +19,8 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..546b83981e5aa36322e328ffac5f7b08e8818d33 100644 --- a/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5 +++ b/ArkUIKit/ArkUIWindowSamples/ListenWindowStage/entry/src/main/module.json5 @@ -19,7 +19,8 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5 b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..546b83981e5aa36322e328ffac5f7b08e8818d33 100644 --- a/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5 +++ b/ArkUIKit/ArkUIWindowSamples/SetWindowSystemBarEnable/entry/src/main/module.json5 @@ -19,7 +19,8 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ArkUIKit/BindSheet/entry/src/main/ets/pages/bindSheet/template11/OnWillDismiss_Dismiss.ets b/ArkUIKit/BindSheet/entry/src/main/ets/pages/bindSheet/template11/OnWillDismiss_Dismiss.ets index ac559ee56fa84d1d90c7502d3a2961d9e75dcb57..711d9adae4efc6bd2e7fbf08c45bec70ed20019d 100644 --- a/ArkUIKit/BindSheet/entry/src/main/ets/pages/bindSheet/template11/OnWillDismiss_Dismiss.ets +++ b/ArkUIKit/BindSheet/entry/src/main/ets/pages/bindSheet/template11/OnWillDismiss_Dismiss.ets @@ -57,6 +57,7 @@ struct OnWillDismiss_Dismiss { primaryButton: { value: 'cancel', action: () => { + hilog.info(DOMAIN, TAG, 'Callback when the cancel button is clicked'); } }, secondaryButton: { @@ -68,6 +69,7 @@ struct OnWillDismiss_Dismiss { action: () => { // 第四步:上述第三步逻辑触发的时候,调用dismiss()关闭半模态 dismissSheetAction.dismiss(); + hilog.info(DOMAIN, TAG, 'Callback when the ok button is clicked'); } }, cancel: () => { diff --git a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/InheritFreezeOptionsPage.ets b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/InheritFreezeOptionsPage.ets index 557fcc1cbbd2e33536c44bab1386be0f89c4850b..c70c1368c0bbcd82b38eaac654d8384198ea61de 100644 --- a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/InheritFreezeOptionsPage.ets +++ b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/InheritFreezeOptionsPage.ets @@ -58,13 +58,13 @@ class TextNodeController extends NodeController { } const textNodeController: TextNodeController = new TextNodeController(); -const ZERO = 0; + @Entry @Component struct MyNavigationTestStack { @Provide('pageInfo') pageInfo: NavPathStack = new NavPathStack(); - @State message: number = ZERO; - @State logNumber: number = ZERO; + @State message: number = 0; + @State logNumber: number = 0; @Builder PageMap(name: string) { @@ -162,7 +162,8 @@ struct pageTwoStack { } } -@Component({ freezeWhenInactive: true }) // 设置冻结策略为不活跃冻结 +@Component({ freezeWhenInactive: true }) + // 设置冻结策略为不活跃冻结 struct NavigationContentMsgStack { @Link message: number; @Link index: number; @@ -177,12 +178,14 @@ struct NavigationContentMsgStack { } } -@Component({ freezeWhenInactive: true }) // 设置冻结策略为不活跃冻结 +@Component({ freezeWhenInactive: true }) + // 设置冻结策略为不活跃冻结 struct TextBuilder { @Prop @Watch('info') message: number = 0; info(): void { - hilog.info(0xF811,'testTag','%{public}s',`freeze-test TextBuilder message callback ${this.message}`); // 根据message内容变化来打印日志来判断是否冻结 + hilog.info(0xF811, 'testTag', '%{public}s', + `freeze-test TextBuilder message callback ${this.message}`); // 根据message内容变化来打印日志来判断是否冻结 } build() { @@ -195,4 +198,5 @@ struct TextBuilder { } } } + // [End Main_InheritFreezeOptionsPage] \ No newline at end of file diff --git a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/RouterPage1.ets b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/RouterPage1.ets index 2802976edf814a9fd7dd512017fe4101efa1a847..8faa10b7085eb9848e4c62df74b0d6758db01bb5 100644 --- a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/RouterPage1.ets +++ b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/RouterPage1.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -// [Start Main_RouterPage1] // ets/pages/RouterPage1.ets import { NodeController, BuilderNode, FrameNode, UIContext } from '@kit.ArkUI'; import 'ets/pages/RouterPage2'; @@ -96,5 +95,4 @@ struct Index { } .height('100%') } -} -// [End Main_RouterPage1] \ No newline at end of file +} \ No newline at end of file diff --git a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/WrappedBuilder.ets b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/WrappedBuilder.ets index 1c6885dbb59c983024a6b96c26b53947033c20e7..4114818f2c252d781f5cc21f1351f591daaaffc9 100644 --- a/ArkUIKit/BuilderNode/entry/src/main/ets/pages/WrappedBuilder.ets +++ b/ArkUIKit/BuilderNode/entry/src/main/ets/pages/WrappedBuilder.ets @@ -102,4 +102,5 @@ struct WrappedBuilderPage { .height('100%') } } + // [End Main_WrappedBuilder] \ No newline at end of file diff --git a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/ButtonCustomStyle.ets b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/ButtonCustomStyle.ets index 8981c90b1be4c7b4170323fbaaa61df2c0fa2355..78d7808b6b623569c27b297741b576d5bf69b934 100644 --- a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/ButtonCustomStyle.ets +++ b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/ButtonCustomStyle.ets @@ -81,10 +81,9 @@ export struct ButtonCustomStyle { title: $r('app.string.SetButtonType_titleFive'), description: $r('app.string.SetButtonType_descriptionFive') }) { - //图片需要更换,left使用方式做了修改 // [Start custom_create_function_button] Button({ type: ButtonType.Circle, stateEffect: true }) { - Image($r('sys.media.ohos_ic_public_cancel')).width(30).height(30) + Image($r('app.media.ic_public_delete_filled')).width(30).height(30) }.width(55).height(55).margin({ 'left': 20 }).backgroundColor(0xF55A42) // [End custom_create_function_button] } diff --git a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/CreateButton.ets b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/CreateButton.ets index a23d7b704b7eb01fb65ee986341a69e57c034cc1..2738fe98b382ec17cd8f6ce417d38ae8795af52d 100644 --- a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/CreateButton.ets +++ b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/CreateButton.ets @@ -56,10 +56,9 @@ export struct CreateButton { // [End create_button_by_button_options] // [Start create_button_by_button_options2] - //注意图片不一致 Button({ type: ButtonType.Normal, stateEffect: true }) { Row() { - Image($r('sys.media.ohos_ic_back')).width(20).height(40).margin({ left: 12 }) + Image($r('app.media.loading')).width(20).height(40).margin({ left: 12 }) Text('loading').fontSize(12).fontColor(0xffffff).margin({ left: 5, right: 12 }) }.alignItems(VerticalAlign.Center) }.borderRadius(8).backgroundColor(0x317aff).width(90).height(40) diff --git a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/HoverButtonExample.ets b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/HoverButtonExample.ets index f2001c12fa1c17377ca85c474bd80be49c7285bc..8a0207aa16bac8c67f07b4f0fb31fdbf0570e7e6 100644 --- a/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/HoverButtonExample.ets +++ b/ArkUIKit/ChooseComponent/entry/src/main/ets/pages/button/HoverButtonExample.ets @@ -37,8 +37,7 @@ export struct HoverButtonExample { }.width('90%') Button() { - //注意图片需要替换 - Image($r('sys.media.ohos_ic_public_add')) + Image($r('app.media.ic_public_add')) .width(50) .height(50) } diff --git a/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_add.png b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_add.png new file mode 100644 index 0000000000000000000000000000000000000000..845ee9a353812b204d2ae10a603857fb870862dd Binary files /dev/null and b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_add.png differ diff --git a/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_delete_filled.png b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_delete_filled.png new file mode 100644 index 0000000000000000000000000000000000000000..5f30fba812a273fbf93155676db12ae1c3ec4b9c Binary files /dev/null and b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/ic_public_delete_filled.png differ diff --git a/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/loading.png b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/loading.png new file mode 100644 index 0000000000000000000000000000000000000000..8edf9da68f6196dcb952d73fcd15831db7f800bc Binary files /dev/null and b/ArkUIKit/ChooseComponent/entry/src/main/resources/base/media/loading.png differ diff --git a/ArkUIKit/DeclarativeUIDescription/entry/src/main/ets/pages/Index.ets b/ArkUIKit/DeclarativeUIDescription/entry/src/main/ets/pages/Index.ets index b88c263119a4ff4f5d4da520bc9ffe6d84bfec3c..d57346fa3e800c3017452e52abcc8d2b5022fa64 100644 --- a/ArkUIKit/DeclarativeUIDescription/entry/src/main/ets/pages/Index.ets +++ b/ArkUIKit/DeclarativeUIDescription/entry/src/main/ets/pages/Index.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { hilog } from '@kit.PerformanceAnalysisKit' + @Entry @Component struct Index { @@ -34,7 +36,7 @@ struct Index { // [Start segment12] fn = () => { - console.info(`counter: ${this.counter}`); + hilog.info(0x0000, 'Declarative UI Description', `counter: ${this.counter}`); this.counter++; }; @@ -143,7 +145,7 @@ struct Index { .height(100) Button('click +1') .onClick(() => { - console.info('+1 clicked!'); + hilog.info(0x0000, 'Declarative UI Description', '+1 clicked!'); }) } } diff --git a/ArkUIKit/DialogProject/README_zh.md b/ArkUIKit/DialogProject/README_zh.md index 71f6b5827b5a76539f52cafdee63c5df2ce243f9..aba07fdd403628d946d53cb6eb7f634a4f454f53 100644 --- a/ArkUIKit/DialogProject/README_zh.md +++ b/ArkUIKit/DialogProject/README_zh.md @@ -35,14 +35,14 @@ entry/src/main/ets/ |---pages | |---customdialog //自定义弹出框 | | |---CreateCustomDialog.ets -| | |---CreateCustomDialog1.ets +| | |---CreateCustomDialogNew.ets | | |---DialogAnimation.ets | | |---DialogAnimation1.ets | | |---DialogAvoidSoftKeyboard.ets | | |---DialogInteraction.ets | | |---DialogInteraction1.ets -| | |---DialogInteraction2.ets -| | |---DialogInteraction3.ets +| | |---DialogInteractionUseConstructor.ets +| | |---DialogInteractionUseButton.ets | | |---DialogStyle.ets | | |---DialogStyle1.ets | | |---DialogWithPhysicalBack.ets diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog1.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialogNew.ets similarity index 61% rename from ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog1.ets rename to ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialogNew.ets index bf8f4e5d4d8c63641ebb0b472cb11e061c9f3dd0..23d73d2d328b878018429169594037067fe1dd9b 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog1.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialogNew.ets @@ -13,31 +13,31 @@ * limitations under the License. */ -// [Start create_custom_dialog_1] -// [Start create_custom_dialog_1_customDialog_controller_1] +// [Start create_custom_dialog_new] +// [Start create_custom_dialog_new_customDialog_controller_default] @CustomDialog struct CustomDialogExample { controller: CustomDialogController; build() { Column() { - //"我是内容"替换为资源文件 + //$r('app.string.i_am_content')资源文件中的value为'我是内容' Text($r('app.string.i_am_content')) .fontSize(20) }.height(60).justifyContent(FlexAlign.Center) } } -// [End create_custom_dialog_1_customDialog_controller_1] +// [End create_custom_dialog_new_customDialog_controller_default] -// [Start create_custom_dialog_1_customDialog_controller_3] -// [Start create_custom_dialog_1_customDialog_controller_2] +// [Start create_custom_dialog_new_customDialog_controller_on_click] +// [Start create_custom_dialog_new_customDialog_controller_constructor] @Entry @Component -export struct CreateCustomDialog1 { +export struct CreateCustomDialogNew { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample(), }) - // [StartExclude create_custom_dialog_1_customDialog_controller_2] + // [StartExclude create_custom_dialog_new_customDialog_controller_constructor] build() { NavDestination() { Column() { @@ -48,8 +48,8 @@ export struct CreateCustomDialog1 { }.width('100%').margin({ top: 5 }) } } - // [EndExclude create_custom_dialog_1_customDialog_controller_2] + // [EndExclude create_custom_dialog_new_customDialog_controller_constructor] } -// [End create_custom_dialog_1_customDialog_controller_2] -// [End create_custom_dialog_1_customDialog_controller_3] -// [End create_custom_dialog_1] +// [End create_custom_dialog_new_customDialog_controller_constructor] +// [End create_custom_dialog_new_customDialog_controller_on_click] +// [End create_custom_dialog_new] diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogAvoidSoftKeyboard.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogAvoidSoftKeyboard.ets index c38f3ee019f604b720fa0b8d7f0d123b7ece67e6..3b21f0f6b508e0c6b9954a857256449c1ab657e4 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogAvoidSoftKeyboard.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogAvoidSoftKeyboard.ets @@ -53,7 +53,7 @@ export struct DialogAvoidSoftKeyboard { NavDestination() { Row() { Row({ space: 20 }) { - //"打开弹窗"替换为资源文件 + //$r('app.string.open_windows')资源文件中的value为'打开弹窗' Text($r('app.string.open_windows')) .fontSize(30) .onClick(() => { diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction3.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseButton.ets similarity index 92% rename from ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction3.ets rename to ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseButton.ets index 7a1dd0cdcfa9e19abe2f818a19abcd07870160cd..1b1a1b3d4e95c2e2eea83888b8d59d56d6bae523 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction3.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseButton.ets @@ -28,11 +28,11 @@ struct CustomDialogExample { build() { Column({ space: 20 }) { if (this.textValue !== '') { - //"第二个页面的内容为"替换为资源文件 + //$r('app.string.the_second_page_is')资源文件中的value为'第二个页面的内容为' Text($r('app.string.the_second_page_is')+`:${this.textValue}`) .fontSize(20) } else { - //"是否获取第二个页面的内容"替换为资源文件 + //$r('app.wether_to_get_the_second_page.the_second_page_is')资源文件中的value为'是否获取第二个页面的内容' Text($r('app.string.wether_to_get_the_second_page')) .fontSize(20) } @@ -62,7 +62,7 @@ struct CustomDialogExample { @Entry @Component -export struct DialogInteraction3 { +export struct DialogInteractionUseButton { @State textValue: string = ''; dialogController: CustomDialogController | null = new CustomDialogController({ builder: CustomDialogExample({ diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction2.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseConstructor.ets similarity index 83% rename from ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction2.ets rename to ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseConstructor.ets index 5a2d5684ade8afca3555cae4ac34bbf7af0e69ca..2f74feda40259042dc3fa2c204cc05d20d8b9f5c 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction2.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteractionUseConstructor.ets @@ -15,8 +15,8 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; const DOMAIN = 0x0000; -// [Start dialog_interaction_2] -// [Start dialog_interaction_2_example] +// [Start dialog_interaction_use_constructor] +// [Start dialog_interaction_use_constructor_example] @CustomDialog struct CustomDialogExample { cancel: () => void = () => { @@ -27,7 +27,7 @@ struct CustomDialogExample { build() { Column() { - //"我是内容"替换为资源文件 + //$r('app.string.i_am_content')资源文件中的value为'我是内容' Text($r('app.string.i_am_content')).fontSize(20).margin({ top: 10, bottom: 10 }) Flex({ justifyContent: FlexAlign.SpaceAround }) { Button('cancel') @@ -48,12 +48,12 @@ struct CustomDialogExample { } } } -// [End dialog_interaction_2_example] +// [End dialog_interaction_use_constructor_example] -// [Start dialog_interaction_2_user] +// [Start dialog_interaction_use_constructor_user] @Entry @Component -export struct DialogInteraction2 { +export struct DialogInteractionUseConstructor { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({ cancel: ()=> { this.onCancel() }, @@ -80,5 +80,5 @@ export struct DialogInteraction2 { } } } -// [End dialog_interaction_2_user] -// [End dialog_interaction_2] \ No newline at end of file +// [End dialog_interaction_use_constructor_user] +// [End dialog_interaction_use_constructor] \ No newline at end of file diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogStyle1.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogStyle1.ets index 8c29a9d491b2a96b5d6fe6e4fe3450aa45d78ce7..016cb08342a6bc91346c1364b335cffc45f74573 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogStyle1.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/DialogStyle1.ets @@ -20,7 +20,7 @@ struct CustomDialogExample { build() { Column() { - //"我是内容"替换为资源文件 + //$r('app.string.i_am_content')资源文件中的value为'我是内容' Text($r('app.string.i_am_content')).fontSize(16).margin({ bottom: 10 }) } } diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/GetDialogStatus.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/GetDialogStatus.ets index 5622f797a67c7dfabf4b3f7d2fe61f8b8ac916b4..761e41f40bcfbca0d5f1bc206a4ed93033ed6cb3 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/GetDialogStatus.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/GetDialogStatus.ets @@ -23,7 +23,7 @@ struct CustomDialogExample { build() { Column() { - //"点我关闭弹窗:通过自定义组件自带的DialogController"替换为资源文件 + //$r('app.string.closeDialog_by_dialog')资源文件中的value为'点我关闭弹窗:通过自定义组件自带的DialogController' Button($r('app.string.closeDialog_by_dialog')) .onClick(() => { if (this.getDialogController() !== undefined) { @@ -32,12 +32,12 @@ struct CustomDialogExample { hilog.info(DOMAIN, 'testTag', 'state: no exist') } }).margin(20) - //"点击关闭弹窗:通过外部传递的DialogController"替换为资源文件 + //$r('app.string.closeDialog_by_dialog_controller')资源文件中的value为'点击关闭弹窗:通过外部传递的DialogController' Button($r('app.string.closeDialog_by_dialog_controller')) .onClick(() => { hilog.info(DOMAIN, 'testTag', 'state:' + this.controller?.getState()) }).margin(20) - //"点我关闭弹窗"替换为资源文件 + //$r('app.string.close_widows')资源文件中的value为'点我关闭弹窗' Button($r('app.string.close_widows')) .onClick(() => { if (this.getDialogController() !== undefined) { diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/Index.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/Index.ets index ec77464f2f84c55ce468e28fe70d1caad858d1b8..76d655945a24b5d1f40eeb16286982bab2473833 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/Index.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/Index.ets @@ -22,9 +22,9 @@ import { DialogInteraction } from './DialogInteraction'; import { DialogInteraction1 } from './DialogInteraction1'; import { DialogStyle } from './DialogStyle'; import { NestDialog } from './NestDialog'; -import { CreateCustomDialog1 } from './CreateCustomDialog1'; -import { DialogInteraction2 } from './DialogInteraction2'; -import { DialogInteraction3 } from './DialogInteraction3'; +import { CreateCustomDialogNew } from './CreateCustomDialogNew'; +import { DialogInteractionUseConstructor } from './DialogInteractionUseConstructor'; +import { DialogInteractionUseButton } from './DialogInteractionUseButton'; import { DialogAnimation1 } from './DialogAnimation1'; import { DialogStyle1 } from './DialogStyle1'; import { NestDialog1 } from './NestDialog1'; @@ -70,19 +70,19 @@ const routes: Route[] = [ description: $r('app.string.CustomDialog_nest_des'), }, { - name: `${Custom_ROUTE_PREFIX}/CreateCustomDialog1`, - title: resource.resourceToString($r('app.string.CreateCustomDialog1_title')), - description: $r('app.string.CreateCustomDialog1_desc'), + name: `${Custom_ROUTE_PREFIX}/CreateCustomDialogNew`, + title: resource.resourceToString($r('app.string.CreateCustomDialogNew_title')), + description: $r('app.string.CreateCustomDialogNew_desc'), }, { - name: `${Custom_ROUTE_PREFIX}/DialogInteraction2`, - title: resource.resourceToString($r('app.string.DialogInteraction2_title')), - description: $r('app.string.DialogInteraction2_desc'), + name: `${Custom_ROUTE_PREFIX}/DialogInteractionUseConstructor`, + title: resource.resourceToString($r('app.string.DialogInteractionUseConstructor_title')), + description: $r('app.string.DialogInteractionUseConstructor_desc'), }, { - name: `${Custom_ROUTE_PREFIX}/DialogInteraction3`, - title: resource.resourceToString($r('app.string.DialogInteraction3_title')), - description: $r('app.string.DialogInteraction3_desc'), + name: `${Custom_ROUTE_PREFIX}/DialogInteractionUseButton`, + title: resource.resourceToString($r('app.string.DialogInteractionUseButton_title')), + description: $r('app.string.DialogInteractionUseButton_desc'), }, { name: `${Custom_ROUTE_PREFIX}/DialogAnimation1`, @@ -153,11 +153,11 @@ export function CustomDestination(name: string) { } else if (name === routes[5].name) { NestDialog(); } else if (name === routes[6].name) { - CreateCustomDialog1(); + CreateCustomDialogNew(); } else if (name === routes[7].name) { - DialogInteraction2(); + DialogInteractionUseConstructor(); } else if (name === routes[8].name) { - DialogInteraction3(); + DialogInteractionUseButton(); } else if (name === routes[9].name) { DialogAnimation1(); } else if (name === routes[10].name) { diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxfocuspolicy/DialogFocusStrategy.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxfocuspolicy/DialogFocusStrategy.ets index fc7713a876d95f5697582ffcc98d0fff42b73062..275be9065e32187fe29372e19ad1fecd8dc684d2 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxfocuspolicy/DialogFocusStrategy.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxfocuspolicy/DialogFocusStrategy.ets @@ -18,10 +18,10 @@ @Component export struct Index { // [Start dialog_focus_text] - // 'dialog_message'需要替换为开发者所需的资源文件 + @State dialogIdIndex: number = 0; + // 'dialog_message'需要替换为开发者所需的资源名称 private message: string = this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('dialog_message') as string; - @State dialogIdIndex: number = 0; @Builder customDialogComponent() { diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxlayermanagement/DialogBoxLayer.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxlayermanagement/DialogBoxLayer.ets index d3d7acebc0e44198e84a3e1ab33ece82f590564f..f01bfe1d1e89dfc0307d0e07a9645baa844b9a50 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxlayermanagement/DialogBoxLayer.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogboxlayermanagement/DialogBoxLayer.ets @@ -29,7 +29,8 @@ export struct DialogBoxLayer { @Builder normalCustomDialog(index: number) { Column() { - Text('Normal Dialog' + index).fontSize(30) + Text(this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('open_normal_dialog') as string + + index).fontSize(30) }.height(400).padding(5).justifyContent(FlexAlign.SpaceBetween) } @@ -39,9 +40,9 @@ export struct DialogBoxLayer { @Builder topCustomDialog() { Column() { - Text('Pinned Popup').fontSize(30) + Text($r('app.string.top_dialog')).fontSize(30) Row({ space: 50 }) { - Button('Open standard popup') + Button($r('app.string.open_dialog')) .onClick(() => { // [Start open_custom_dialog] this.getUIContext().getPromptAction().openCustomDialog({ @@ -66,7 +67,7 @@ export struct DialogBoxLayer { NavDestination() { Row() { Column({ space: 5 }) { - Button('Click the popup') + Button($r('app.string.click_dialog')) .fontSize(20) .onClick(() => { // [Start open_top_custom_dialog] diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogcontroller/DialogController.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogcontroller/DialogController.ets index de58420aad434c7014d58f1c0ce433cea3b735b9..fd548b17890ced74422af0431905c9fce9742974 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogcontroller/DialogController.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/dialogcontroller/DialogController.ets @@ -166,7 +166,7 @@ export struct DialogController { Text(this.message) .fontSize(30) if (dialogController !== undefined) { - Button('Click me to check the pop-up status') + Button($r('app.string.click_check_status')) .onClick(() => { hilog.info(0x0000, 'dialogController', 'state:' + dialogController.getState()); }) @@ -178,12 +178,12 @@ export struct DialogController { .backgroundColor('#FFF0F0F0') } - // [Start dialog_component_get_state] + // [End dialog_component_get_state] build() { NavDestination() { Column({ space: 5 }) { - Button('OpenCustomDialogWithController Dialog') + Button($r('app.string.open_custom_dialog_with_controller')) .onClick(() => { // [Start content_node] let dialogController: promptAction.CommonController = new promptAction.DialogController(); @@ -197,7 +197,7 @@ export struct DialogController { }); // [End content_node] }) - Button('PresentCustomDialog+CustomBuilder Dialog') + Button($r('app.string.present_custom_dialog')) .onClick(() => { // [Start dialog_controller_component] let dialogController: promptAction.CommonController = new promptAction.DialogController(); @@ -208,7 +208,7 @@ export struct DialogController { }); // [End dialog_controller_component] }) - Button('PresentCustomDialog+CustomBuilderWithId Dialog') + Button($r('app.string.custom_builder_with_id')) .onClick(() => { // [Start dialog_controller_id] let dialogController: promptAction.CommonController = new promptAction.DialogController(); @@ -219,7 +219,7 @@ export struct DialogController { }); // [End dialog_controller_id] }) - Button('CustomDialogController Dialog') + Button($r('app.string.custom_dialog_controller_dialog')) .onClick(() => { // [Start custom_dialog_example_click] let customDialogController: CustomDialogController = new CustomDialogController({ diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/pageleveldialogbox/PageLevelDialogBox.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/pageleveldialogbox/PageLevelDialogBox.ets index cff21940b57546a8fbbdd90c0169e92abb60e313..40efa490e3c173215cca5e3222c0e80d6d27f2d1 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/pageleveldialogbox/PageLevelDialogBox.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/customdialog/pageleveldialogbox/PageLevelDialogBox.ets @@ -39,11 +39,10 @@ function customDialogBuilder(uiContext: UIContext) { @Component export struct PageLevelDialogBox { @State message: string = 'Hello World'; - private uiContext: UIContext = this.getUIContext(); @Builder customDialogComponent() { - customDialogBuilder(this.uiContext); + customDialogBuilder(this.getUIContext()); } build() { @@ -58,7 +57,7 @@ export struct PageLevelDialogBox { .onClick(() => { const node: FrameNode | null = this.getUIContext().getFrameNodeById('test_text') || null; // [Start open_custom_dialog] - this.uiContext.getPromptAction().openCustomDialog({ + this.getUIContext().getPromptAction().openCustomDialog({ builder: () => { this.customDialogComponent(); }, diff --git a/ArkUIKit/DialogProject/entry/src/main/ets/pages/maskdialog/CustomDialogControl.ets b/ArkUIKit/DialogProject/entry/src/main/ets/pages/maskdialog/CustomDialogControl.ets index 4f706381c83ba3fd470d62483ace69656d8c5431..5fbd48a3d611604be03b6eab1aef7b0acc853e64 100644 --- a/ArkUIKit/DialogProject/entry/src/main/ets/pages/maskdialog/CustomDialogControl.ets +++ b/ArkUIKit/DialogProject/entry/src/main/ets/pages/maskdialog/CustomDialogControl.ets @@ -20,29 +20,29 @@ import { ImmersiveMode, LevelMode, promptAction } from '@kit.ArkUI'; @Entry @Component export struct CustomDialogControl { - // [Start custom_dialog_control_immersive_default] + // [Start custom_dialog_control_immersive] @State immersiveMode: ImmersiveMode = ImmersiveMode.DEFAULT; - // [End custom_dialog_control_immersive_default] + // [StartExclude custom_dialog_control_immersive] - // [Start custom_dialog_control_autoCancel_opt] + // [Start custom_dialog_control_autoCancel] autoCancelOpt: promptAction.CustomDialogOptions = { builder: () => { this.myBuilder(); }, autoCancel: false, } as promptAction.CustomDialogOptions; - // [End custom_dialog_control_autoCancel_opt] + // [StartExclude custom_dialog_control_autoCancel] - // [Start custom_dialog_control_modal_opt] + // [Start custom_dialog_control_modal] modalOpt: promptAction.CustomDialogOptions = { builder: () => { this.myBuilder(); }, isModal: false, } as promptAction.CustomDialogOptions; - // [End custom_dialog_control_modal_opt] + // [StartExclude custom_dialog_control_modal] - // [Start custom_dialog_control_mask_opt] + // [Start custom_dialog_control_mask] maskOpt: promptAction.CustomDialogOptions = { builder: () => { this.myBuilder(); @@ -55,16 +55,16 @@ export struct CustomDialogControl { }, maskColor: '#33AA0000' } as promptAction.CustomDialogOptions; - // [End custom_dialog_control_mask_opt] + // [StartExclude custom_dialog_control_mask] - // [Start custom_dialog_control_transition_opt] + // [Start custom_dialog_control_transition] transitionOpt: promptAction.CustomDialogOptions = { builder: () => { this.myBuilder(); }, transition: TransitionEffect.OPACITY.animation({ duration: 3000 }) } as promptAction.CustomDialogOptions; - // [End custom_dialog_control_transition_opt] + // [StartExclude custom_dialog_control_transition] @Builder myBuilder() { @@ -78,43 +78,43 @@ export struct CustomDialogControl { build() { NavDestination() { Column() { - // [Start custom_dialog_control_autoCance_btn] + // [EndExclude custom_dialog_control_autoCancel] Button('openCustomDialog autoCancel:false') .width('100%') .margin({ top: 10 }) .onClick(() => { this.getUIContext().getPromptAction().openCustomDialog(this.autoCancelOpt) }) - // [End custom_dialog_control_autoCance_btn] + // [End custom_dialog_control_autoCancel] - // [Start custom_dialog_control_modal_btn] + // [EndExclude custom_dialog_control_modal] Button('openCustomDialog isModal:false') .width('100%') .margin({ top: 10 }) .onClick(() => { this.getUIContext().getPromptAction().openCustomDialog(this.modalOpt) }) - // [End custom_dialog_control_modal_btn] + // [End custom_dialog_control_modal] - // [Start custom_dialog_control_mask_btn] + // [EndExclude custom_dialog_control_mask] Button('openCustomDialog maskOpt') .width('100%') .margin({ top: 10 }) .onClick(() => { this.getUIContext().getPromptAction().openCustomDialog(this.maskOpt) }) - // [End custom_dialog_control_mask_btn] + // [End custom_dialog_control_mask] - // [Start custom_dialog_control_transition_btn] + // [EndExclude custom_dialog_control_transition] Button('openCustomDialog transition') .width('100%') .margin({ top: 10 }) .onClick(() => { this.getUIContext().getPromptAction().openCustomDialog(this.transitionOpt); }) - // [End custom_dialog_control_transition_btn] + // [End custom_dialog_control_transition] - // [Start custom_dialog_control_immersive_btn] + // [EndExclude custom_dialog_control_immersive] Button('openCustomDialog immersiveMode') .width('100%') .margin({ top: 10 }) @@ -129,7 +129,7 @@ export struct CustomDialogControl { immersiveMode: this.immersiveMode, }) }) - // [End custom_dialog_control_immersive_btn] + // [End custom_dialog_control_immersive] // [Start custom_dialog_control_mask_transition] Button('openCustomDialog maskTransition') diff --git a/ArkUIKit/DialogProject/entry/src/main/resources/base/element/string.json b/ArkUIKit/DialogProject/entry/src/main/resources/base/element/string.json index a64e86cc2f04e6f32ac68f85ddf9fe03e88a187e..33d36b9cc8f5f86c0e3354e53c92d1a710f6a009 100644 --- a/ArkUIKit/DialogProject/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/DialogProject/entry/src/main/resources/base/element/string.json @@ -562,27 +562,27 @@ "value": "即时反馈提供了两种显示模式,分别为DEFAULT(显示在应用内)、TOP_MOST(显示在应用之上)。" }, { - "name": "CreateCustomDialog1_title", - "value": "创建自定义弹出框1" + "name": "CreateCustomDialogNew_title", + "value": "创建自定义弹出框新页面" }, { - "name": "CreateCustomDialog1_desc", + "name": "CreateCustomDialogNew_desc", "value": "使用@CustomDialog装饰器装饰自定义弹出框,可在此装饰器内自定义弹出框内容。CustomDialogController需在@Component内定义。" }, { - "name": "DialogInteraction2_title", - "value": "弹出框的交互2" + "name": "DialogInteractionUseConstructor_title", + "value": "弹出框的交互使用构造器" }, { - "name": "DialogInteraction2_desc", + "name": "DialogInteractionUseConstructor_desc", "value": "页面内需要在构造器内进行接收,同时创建相应的函数操作。" }, { - "name": "DialogInteraction3_title", - "value": "弹出框的交互3" + "name": "DialogInteractionUseButton_title", + "value": "弹出框的交互使用button" }, { - "name": "DialogInteraction3_desc", + "name": "DialogInteractionUseButton_desc", "value": "可通过弹出框中的按钮实现路由跳转,同时获取跳转页面向当前页传入的参数。" }, { @@ -848,6 +848,42 @@ { "name": "paste", "value": "粘贴" + }, + { + "name": "click_check_status", + "value": "点我查询弹窗状态" + }, + { + "name": "open_custom_dialog_with_controller", + "value": "OpenCustomDialogWithController弹窗" + }, + { + "name": "present_custom_dialog", + "value": "PresentCustomDialog+CustomBuilder弹窗" + }, + { + "name": "custom_builder_with_id", + "value": "PresentCustomDialog+CustomBuilderWithId弹窗" + }, + { + "name": "custom_dialog_controller_dialog", + "value": "CustomDialogController弹窗" + }, + { + "name": "top_dialog", + "value": "我是置顶弹窗" + }, + { + "name": "open_dialog", + "value": "点我打开普通弹窗" + }, + { + "name": "open_normal_dialog", + "value": "我是普通弹窗" + }, + { + "name": "click_dialog", + "value": "点击弹窗" } ] } \ No newline at end of file diff --git a/ArkUIKit/DialogProject/entry/src/ohosTest/ets/test/CustomDialog.test.ets b/ArkUIKit/DialogProject/entry/src/ohosTest/ets/test/CustomDialog.test.ets index 2cfe135435659639864ed892c942d61e56174ff7..033a1120a2c352eabe19b2de2b54d4b4fdf3e5f3 100644 --- a/ArkUIKit/DialogProject/entry/src/ohosTest/ets/test/CustomDialog.test.ets +++ b/ArkUIKit/DialogProject/entry/src/ohosTest/ets/test/CustomDialog.test.ets @@ -65,32 +65,32 @@ export default function CustomDialogTest() { await driver.pressBack(); await sleep(1000); - let button_createCustomDialog1 = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.CreateCustomDialog1_title')), MatchPattern.CONTAINS)); + let button_createCustomDialog1 = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.CreateCustomDialogNew_title')), MatchPattern.CONTAINS)); await button_createCustomDialog1.click(); let button_createCustomDialog1_click = await driver.findComponent(ON.text('click me', MatchPattern.CONTAINS)); await button_createCustomDialog1_click.click(); await driver.pressBack(); await driver.pressBack(); - let button_dialogInteraction2 = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.DialogInteraction2_title')), MatchPattern.CONTAINS)); - await button_dialogInteraction2.click(); - let button_dialogInteraction2_click = await driver.findComponent(ON.text('click me', MatchPattern.CONTAINS)); - await button_dialogInteraction2_click.click(); - let button_dialogInteraction2_confirm = await driver.findComponent(ON.text('confirm', MatchPattern.CONTAINS)); - await button_dialogInteraction2_confirm.click(); + let button_dialogInteractionUseConstructor = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.DialogInteractionUseConstructor_title')), MatchPattern.CONTAINS)); + await button_dialogInteractionUseConstructor.click(); + let button_dialogInteractionUseConstructor_click = await driver.findComponent(ON.text('click me', MatchPattern.CONTAINS)); + await button_dialogInteractionUseConstructor_click.click(); + let button_dialogInteractionUseConstructor_confirm = await driver.findComponent(ON.text('confirm', MatchPattern.CONTAINS)); + await button_dialogInteractionUseConstructor_confirm.click(); await driver.pressBack(); let stackList = await driver.findComponent(ON.type('List')); - await stackList.scrollSearch(ON.text(resource.resourceToString($r('app.string.DialogInteraction3_title')))); - - let button_dialogInteraction3 = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.DialogInteraction3_title')), MatchPattern.CONTAINS)); - await button_dialogInteraction3.click(); - let button_dialogInteraction3_click = await driver.findComponent(ON.text('click me', MatchPattern.CONTAINS)); - await button_dialogInteraction3_click.click(); - let button_dialogInteraction3_confirm = await driver.findComponent(ON.text('confirm', MatchPattern.CONTAINS)); - await button_dialogInteraction3_confirm.click(); - let button_dialogInteraction3_return = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.click_and_return')), MatchPattern.CONTAINS)); - await button_dialogInteraction3_return.click(); + await stackList.scrollSearch(ON.text(resource.resourceToString($r('app.string.DialogInteractionUseButton_title')))); + + let button_dialogInteractionUseButton = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.DialogInteractionUseButton_title')), MatchPattern.CONTAINS)); + await button_dialogInteractionUseButton.click(); + let button_dialogInteractionUseButton_click = await driver.findComponent(ON.text('click me', MatchPattern.CONTAINS)); + await button_dialogInteractionUseButton_click.click(); + let button_dialogInteractionUseButton_confirm = await driver.findComponent(ON.text('confirm', MatchPattern.CONTAINS)); + await button_dialogInteractionUseButton_confirm.click(); + let button_dialogInteractionUseButton_return = await driver.findComponent(ON.text(resource.resourceToString($r('app.string.click_and_return')), MatchPattern.CONTAINS)); + await button_dialogInteractionUseButton_return.click(); await sleep(1000); await driver.pressBack(); await sleep(1000); diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKey.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKey.ets index 595e594e83d4e4fac7a082a2daeff3322a5eb89a..c4c54d291a8a4551d4ba10ffc41c76555710dc19 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKey.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKey.ets @@ -16,66 +16,66 @@ // [Start listen_response_key_event] @Entry @Component -export struct OnKey { +struct KeyEventExample { @State buttonText: string = ''; @State buttonType: string = ''; @State columnText: string = ''; @State columnType: string = ''; build() { - // [StartExclude listen_response_key_event] - NavDestination() { - Column({ space: 12 }) { - // [EndExclude listen_response_key_event] - Column() { - Button('onKeyEvent') - .defaultFocus(true) - .width(140).height(70) - .onKeyEvent((event?: KeyEvent) => { // 给Button设置onKeyEvent事件 - if(event){ - if (event.type === KeyType.Down) { - this.buttonType = 'Down'; - } - if (event.type === KeyType.Up) { - this.buttonType = 'Up'; - } - this.buttonText = 'Button: \n' + - 'KeyType:' + this.buttonType + '\n' + - 'KeyCode:' + event.keyCode + '\n' + - 'KeyText:' + event.keyText; - } - }) - - Divider() - Text(this.buttonText).fontColor(Color.Green) - - Divider() - Text(this.columnText).fontColor(Color.Red) - }.width('100%').height('100%').justifyContent(FlexAlign.Center) - .onKeyEvent((event?: KeyEvent) => { // 给父组件Column设置onKeyEvent事件 + Column() { + Button('onKeyEvent') + .defaultFocus(true) + .width(140).height(70) + .onKeyEvent((event?: KeyEvent) => { // 给Button设置onKeyEvent事件 if(event){ if (event.type === KeyType.Down) { - this.columnType = 'Down'; + this.buttonType = 'Down'; } if (event.type === KeyType.Up) { - this.columnType = 'Up'; + this.buttonType = 'Up'; } - this.columnText = 'Column: \n' + - 'KeyType:' + this.buttonType + '\n' + - 'KeyCode:' + event.keyCode + '\n' + - 'KeyText:' + event.keyText; + this.buttonText = 'Button: \n' + + 'KeyType:' + this.buttonType + '\n' + + 'KeyCode:' + event.keyCode + '\n' + + 'KeyText:' + event.keyText; } }) + Divider() + Text(this.buttonText).fontColor(Color.Green) + + Divider() + Text(this.columnText).fontColor(Color.Red) + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + .onKeyEvent((event?: KeyEvent) => { // 给父组件Column设置onKeyEvent事件 + if(event){ + if (event.type === KeyType.Down) { + this.columnType = 'Down'; + } + if (event.type === KeyType.Up) { + this.columnType = 'Up'; + } + this.columnText = 'Column: \n' + + 'KeyType:' + this.columnType + '\n' + + 'KeyCode:' + event.keyCode + '\n' + + 'KeyText:' + event.keyText; } - .width('100%') - .height('100%') - .padding({ left: 12, right: 12 }) - // [StartExclude listen_response_key_event] - } - .backgroundColor('#f1f2f3') - .title($r('app.string.Device_OnKey_title')) - // [EndExclude listen_response_key_event] + }) } } -// [End listen_response_key_event] \ No newline at end of file +// [End listen_response_key_event] + +@Builder +export function OnKey() { + NavDestination() { + Column({ space: 12 }) { + KeyEventExample() + } + .width('100%') + .height('100%') + .padding({ left: 12, right: 12 }) + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Device_OnKey_title')) +} \ No newline at end of file diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyDistributeEvent.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyDistributeEvent.ets index fc58891f9e618b06f747ea399e9748d17978ab57..ba2db6157f7bc46a6077258ba9da6c651ab8bbc1 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyDistributeEvent.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyDistributeEvent.ets @@ -12,61 +12,66 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +// [Start key_distribute_event] import { hilog } from '@kit.PerformanceAnalysisKit'; const TAG = '[Sample_Eventproject]'; const DOMAIN = 0xF811; const BUNDLE = 'Eventproject_'; -// [Start key_distribute_event] + @Entry @Component -export struct OnKeyDistributeEvent { +struct Index { build() { - // [StartExclude key_distribute_event] - NavDestination() { - Column({ space: 12 }) { - // [EndExclude key_distribute_event] - Row() { - Row() { - Button('button1').id('button1').onKeyEvent((event) => { - hilog.info(DOMAIN, TAG, BUNDLE + 'button1'); - return true - }) - Button('button2').id('button2').onKeyEvent((event) => { - hilog.info(DOMAIN, TAG, BUNDLE + 'button2'); - return true - }) - } - .width('100%') - .height('100%') - .id('Row1') - .onKeyEventDispatch((event) => { - let context = this.getUIContext(); - context.getFocusController().requestFocus('button1'); - return context.dispatchKeyEvent('button1', event); + Row() { + Row() { + Button('button1') + .id('button1') + .onKeyEvent((event) => { + hilog.info(DOMAIN, TAG, BUNDLE + 'button1'); + return true + }) + Button('button2') + .id('button2') + .onKeyEvent((event) => { + hilog.info(DOMAIN, TAG, BUNDLE + 'button2'); + return true }) - - } - .height('100%') - .width('100%') - .onKeyEventDispatch((event) => { - if (event.type == KeyType.Down) { - let context = this.getUIContext(); - context.getFocusController().requestFocus('Row1'); - return context.dispatchKeyEvent('Row1', event); - } - return true; - }) - // [StartExclude key_distribute_event] } .width('100%') .height('100%') - .padding({ left: 12, right: 12 }) + .id('Row1') + .onKeyEventDispatch((event) => { + let context = this.getUIContext(); + context.getFocusController().requestFocus('button1'); + return context.dispatchKeyEvent('button1', event); + }) + } - .backgroundColor('#f1f2f3') - .title($r('app.string.OnKeyDistributeEvent_title')) - // [EndExclude key_distribute_event] + .height('100%') + .width('100%') + .onKeyEventDispatch((event) => { + if (event.type == KeyType.Down) { + let context = this.getUIContext(); + context.getFocusController().requestFocus('Row1'); + return context.dispatchKeyEvent('Row1', event); + } + return true; + }) } } -// [End key_distribute_event] \ No newline at end of file +// [End key_distribute_event] + +@Builder +export function OnKeyDistributeEvent() { + NavDestination() { + Column({ space: 12 }) { + Index() + } + .width('100%') + .height('100%') + .padding({ left: 12, right: 12 }) + } + .backgroundColor('#f1f2f3') + .title($r('app.string.OnKeyDistributeEvent_title')) +} \ No newline at end of file diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreIme.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreIme.ets index f47c9f35befffe02051bd0f82c01b03b1cedf2e0..508f09a6dcd437e17d1ce1496a8648bed4679d3d 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreIme.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreIme.ets @@ -18,40 +18,41 @@ import { KeyCode } from '@kit.InputKit'; @Entry @Component -export struct PreIme { +struct PreImeEventExample { @State buttonText: string = ''; @State buttonType: string = ''; @State columnText: string = ''; @State columnType: string = ''; build() { - // [StartExclude key_event_intercept] - NavDestination() { - Column({ space: 12 }) { - // [EndExclude key_event_intercept] - Column() { - Search({ - placeholder: 'Search...' - }) - .width('80%') - .height('40vp') - .border({ radius:'20vp' }) - .onKeyPreIme((event:KeyEvent) => { - if (event.keyCode == KeyCode.KEYCODE_DPAD_LEFT) { - return true; - } - return false; - }) - } - } - // [StartExclude key_event_intercept] - .width('100%') - .height('100%') - .padding({ left: 12, right: 12 }) + Column() { + Search({ + placeholder: 'Search...' + }) + .width('80%') + .height('40vp') + .border({ radius:'20vp' }) + .onKeyPreIme((event:KeyEvent) => { + if (event.keyCode == KeyCode.KEYCODE_DPAD_LEFT) { + return true; + } + return false; + }) } - .backgroundColor('#f1f2f3') - .title($r('app.string.Device_OnKeyPreIme_title')) - // [EndExclude key_event_intercept] } } -// [End key_event_intercept] \ No newline at end of file +// [End key_event_intercept] + +@Builder +export function PreIme() { + NavDestination() { + Column({ space: 12 }) { + PreImeEventExample() + } + .width('100%') + .height('100%') + .padding({ left: 12, right: 12 }) + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Device_OnKeyPreIme_title')) +} \ No newline at end of file diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreImeCommit.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreImeCommit.ets index 284ac7f347d69f8e83079a0d27877672f5da5dbd..f6ae4f2c114198e59e3d6ac887a1b56f4277af92 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreImeCommit.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreImeCommit.ets @@ -12,56 +12,58 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +// [Start key_event_intercept] import { hilog } from '@kit.PerformanceAnalysisKit'; const TAG = '[Sample_Eventproject]'; const DOMAIN = 0xF811; const BUNDLE = 'Eventproject_'; -// [Start key_event_intercept] + @Entry @Component -export struct OnKeyPreImeCommit { +struct TextAreaDemo { @State content: string = ''; @State text: string = ''; controller: TextAreaController = new TextAreaController(); build() { - // [StartExclude key_event_intercept] - NavDestination() { - Column({ space: 12 }) { - // [EndExclude key_event_intercept] - Column() { - Text('Submissions: ' + this.content) - TextArea({ controller: this.controller, text: this.text }) - .onKeyPreIme((event: KeyEvent) => { - hilog.info(DOMAIN, TAG, BUNDLE + JSON.stringify(event)); - if (event.keyCode === 2054 && event.type === KeyType.Down) { // 回车键物理码 - const hasCtrl = event?.getModifierKeyState?.(['Ctrl']); - if (hasCtrl) { - hilog.info(DOMAIN, TAG, BUNDLE + 'Line break'); - } else { - hilog.info(DOMAIN, TAG, BUNDLE + 'Submissions:' + this.text); - this.content = this.text; - this.text = ''; - event.stopPropagation(); - } - return true; - } - return false; - }) - .onChange((value: string) => { - this.text = value - }) - } - // [StartExclude key_event_intercept] - } - .width('100%') - .height('100%') - .padding({ left: 12, right: 12 }) + Column() { + Text('Submissions: ' + this.content) + TextArea({ controller: this.controller, text: this.text }) + .onKeyPreIme((event: KeyEvent) => { + hilog.info(DOMAIN, TAG, `${BUNDLE + JSON.stringify(event)}`); + if (event.keyCode === 2054 && event.type === KeyType.Down) { // 回车键物理码 + const hasCtrl = event?.getModifierKeyState?.(['Ctrl']); + if (hasCtrl) { + hilog.info(DOMAIN, TAG, BUNDLE + 'Line break'); + } else { + hilog.info(DOMAIN, TAG, BUNDLE + 'Submissions:' + this.text); + this.content = this.text; + this.text = ''; + event.stopPropagation(); + } + return true; + } + return false; + }) + .onChange((value: string) => { + this.text = value; + }) } - .backgroundColor('#f1f2f3') - .title($r('app.string.OnKeyPreImeCommit_title')) - // [EndExclude key_event_intercept] } } -// [End key_event_intercept] \ No newline at end of file +// [End key_event_intercept] + +@Builder +export function OnKeyPreImeCommit() { + NavDestination() { + Column({ space: 12 }) { + TextAreaDemo() + } + .width('100%') + .height('100%') + .padding({ left: 12, right: 12 }) + } + .backgroundColor('#f1f2f3') + .title($r('app.string.OnKeyPreImeCommit_title')) +} \ No newline at end of file diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreventBubble.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreventBubble.ets index 6922df6c6705b5ac0b0f77111ff4194f1dbc0817..1c4772b8bc1a33849fab2a50a09139aeb4ea8e26 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreventBubble.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/device/OnKeyPreventBubble.ets @@ -16,17 +16,13 @@ // [Start listen_response_key_event] @Entry @Component -export struct OnKeyPreventBubble { +struct KeyEventPreventBubble { @State buttonText: string = ''; @State buttonType: string = ''; @State columnText: string = ''; @State columnType: string = ''; build() { - // [StartExclude listen_response_key_event] - NavDestination() { - Column({ space: 12 }) { - // [EndExclude listen_response_key_event] Column() { Button('onKeyEvent') .defaultFocus(true) @@ -70,15 +66,20 @@ export struct OnKeyPreventBubble { 'KeyText:' + event.keyText; } }) - // [StartExclude listen_response_key_event] - } - .width('100%') - .height('100%') - .padding({ left: 12, right: 12 }) - } - .backgroundColor('#f1f2f3') - .title($r('app.string.Device_OnKey_title')) - // [EndExclude listen_response_key_event] } } -// [End listen_response_key_event] \ No newline at end of file +// [End listen_response_key_event] + +@Builder +export function OnKeyPreventBubble() { + NavDestination() { + Column({ space: 12 }) { + KeyEventPreventBubble() + } + .width('100%') + .height('100%') + .padding({ left: 12, right: 12 }) + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Device_OnKeyPreventBubble_title')) +} \ No newline at end of file diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/drop/DropAnimationExample.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/drop/DropAnimationExample.ets index 01915b2324b46a30279fd5f50ac1de09516e2c84..5de9b894aa45248551191eced0e6e70141e65dec 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/drop/DropAnimationExample.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/drop/DropAnimationExample.ets @@ -58,7 +58,7 @@ export struct DropAnimationExample { } //[EndExclude drop_image_start] }) - //[Start drop_image_start] + //[End drop_image_start] }.width('45%') .height('100%') diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusScopePriorityPrevious.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusScopePriorityPrevious.ets index d4e6987fbc4059e44df30554918e4bbee6b039d3..7b8c745af68b0a83c597f02ccc9e3ba9024ddcc7 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusScopePriorityPrevious.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusScopePriorityPrevious.ets @@ -19,12 +19,12 @@ export struct FocusScopePriorityPrevious { build() { NavDestination() { - Row() { - Button('Button1') - .defaultFocus(true) - Button('Button2') - .focusScopePriority('RowScope', FocusPriority.PREVIOUS) - }.focusScopeId('RowScope') + Row() { + Button('Button1') + .defaultFocus(true) + Button('Button2') + .focusScopePriority('RowScope', FocusPriority.PREVIOUS) + }.focusScopeId('RowScope') } // [StartExclude dynamic_focus_scope_priority_previous] .backgroundColor('#f1f2f3') diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTransfer.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTransfer.ets index 1185e3320000873acd122922e4ee84b608e5f55c..e64a8a8cf7ffcae414c37c2bab021f75133add43 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTransfer.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTransfer.ets @@ -17,7 +17,7 @@ @Entry export struct FocusTransferExample { @State logText: string = '\n'; - context = this.getUIContext().getHostContext(); + context = this.getUIContext().getHostContext(); addText(message: string) { this.logText += `${message}\n`; diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTraversalGuidelines.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTraversalGuidelines.ets index 83c3c2218771b573394ff7b053b956d2448197e6..aa4ebb006d00365978139d5fa88799107261c54b 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTraversalGuidelines.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/FocusTraversalGuidelines.ets @@ -19,34 +19,33 @@ export struct FocusLinerExample { build() { NavDestination() { - Column() { Column() { - Button('Column Button1') - .width(150) - .height(45) - .fontColor(Color.White) - .margin(10) - Button('Column Button2') - .width(150) - .height(45) - .fontColor(Color.White) - .margin(10) + Column() { + Button('Column Button1') + .width(150) + .height(45) + .fontColor(Color.White) + .margin(10) + Button('Column Button2') + .width(150) + .height(45) + .fontColor(Color.White) + .margin(10) + } + .margin(10) + Row() { + Button('Row Button1') + .width(150) + .height(45) + .fontColor(Color.White) + .margin(10) + Button('Row Button2') + .width(150) + .height(45) + .fontColor(Color.White) + .margin(10) + } } - .margin(10) - - Row() { - Button('Row Button1') - .width(150) - .height(45) - .fontColor(Color.White) - .margin(10) - Button('Row Button2') - .width(150) - .height(45) - .fontColor(Color.White) - .margin(10) - } - } } // [StartExclude dynamic_focus_liner] .backgroundColor('#f1f2f3') diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/NextFocus.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/NextFocus.ets index a6a5ba72af58b51c08f26b910bcd1392e0999ca6..d9054aed7841a51faebf029a1d896fba2db9ddf6 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/NextFocus.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/NextFocus.ets @@ -19,31 +19,36 @@ export struct NextFocusExample { build() { NavDestination() { - Column({space: 30}) { - Row().height('30%') - Row({space: 10}) { - Button('A') - .id('A') - .nextFocus({forward: 'F', backward: 'C', down: 'B'}) - Button('B') - .id('B') - .nextFocus({ down: 'C'}) - Button('C') - .id('C') - } - Column({space: 10}) { - Button('D') - .id('D') - Button('E') - .id('E') - .nextFocus({forward: 'A', backward: 'M', up: 'E', right: 'F'}) - } - Row({space: 10}) { - Button('F') - .id('F') - .nextFocus({forward: 'B', down: 'A'}); - } - }.width('100%') + Column({ space: 30 }) { + Row().height('30%') + Row({ space: 10 }) { + Button('A') + .id('A') + .nextFocus({ forward: 'F', backward: 'C', down: 'B' }) + Button('B') + .id('B') + .nextFocus({ down: 'C' }) + Button('C') + .id('C') + } + Column({ space: 10 }) { + Button('D') + .id('D') + Button('E') + .id('E') + .nextFocus({ + forward: 'A', + backward: 'M', + up: 'E', + right: 'F' + }) + } + Row({ space: 10 }) { + Button('F') + .id('F') + .nextFocus({ forward: 'B', down: 'A' }); + } + }.width('100%') } // [StartExclude dynamic_focus_next] .backgroundColor('#f1f2f3') diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/OnFocusOnBlurEvents.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/OnFocusOnBlurEvents.ets index 4efb5cf7a2f05a056612895c04fc927f25ed0af2..c3c5650da6986d48a271be96d56cdc62a8895fb5 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/OnFocusOnBlurEvents.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/focus/OnFocusOnBlurEvents.ets @@ -19,47 +19,47 @@ export struct FocusAndBlurExample { build() { NavDestination() { - Column() { - Column({ space: 5 }) { - Row() { // 父节点Row1 - Button('Button1') // 子节点Button1 - .width(140) - .height(45) - .margin(5) - .onFocus(() => { - console.info('Button1 onFocus'); - }) - .onBlur(() => { - console.info('Button1 onBlur'); - }) - } - .onFocus(() => { - console.info('Row1 onFocus'); - }) - .onBlur(() => { - console.info('Row1 onBlur'); - }) + Column() { + Column({ space: 5 }) { + Row() { // 父节点Row1 + Button('Button1') // 子节点Button1 + .width(140) + .height(45) + .margin(5) + .onFocus(() => { + console.info('Button1 onFocus'); + }) + .onBlur(() => { + console.info('Button1 onBlur'); + }) + } + .onFocus(() => { + console.info('Row1 onFocus'); + }) + .onBlur(() => { + console.info('Row1 onBlur'); + }) - Row() { // 父节点Row2 - Button('Button2') // 子节点Button2 - .width(140) - .height(45) - .margin(5) - .onFocus(() => { - console.info('Button2 onFocus'); - }) - .onBlur(() => { - console.info('Button2 onBlur'); - }) - } - .onFocus(() => { - console.info('Row2 onFocus'); - }) - .onBlur(() => { - console.info('Row2 onBlur'); - }) - }.width('100%').margin({ top: 5 }) - }.width('100%') + Row() { // 父节点Row2 + Button('Button2') // 子节点Button2 + .width(140) + .height(45) + .margin(5) + .onFocus(() => { + console.info('Button2 onFocus'); + }) + .onBlur(() => { + console.info('Button2 onBlur'); + }) + } + .onFocus(() => { + console.info('Row2 onFocus'); + }) + .onBlur(() => { + console.info('Row2 onBlur'); + }) + }.width('100%').margin({ top: 5 }) + }.width('100%') } // [StartExclude dynamic_focus_blur] .backgroundColor('#f1f2f3') diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridEts.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridEts.ets index ad0d60db197bfe498c4c0301d627b97fe5b4857d..844562aed01caea6d248f7c2f745ab3500ca87e0 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridEts.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridEts.ets @@ -186,7 +186,7 @@ export struct GridEts { }) .dragPreviewOptions({ numberBadge: this.numberBadge }) //[End grid_numberBadge_start] - //[Start grid_isSelected_start] + //[End grid_isSelected_start] .onPreDrag((status: PreDragStatus) => { // 1.长按时通知,350ms回调 if (status == PreDragStatus.PREPARING_FOR_DRAG_DETECTION) { @@ -258,6 +258,7 @@ export struct GridEts { backgroundBlurStyle: BlurStyle.COMPONENT_THICK, barStyle: BarStyle.STACK }) + // 'app.string.Pages_Index_GridExample'需要替换为开发者所需的文本资源文件 .title($r('app.string.Pages_Index_GridExample')) } } diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridExample.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridExample.ets index 42a1a7b35f184a445b96eabd2c0918a15c0f077d..22f8577421cc8defcceb11a33e90710969be43a0 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridExample.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/grid/GridExample.ets @@ -25,45 +25,45 @@ struct GridEts { @State numberBadge: number = 0; @Styles - normalStyles(): void{ + normalStyles(): void { .opacity(1.0) } @Styles - selectStyles(): void{ + selectStyles(): void { .opacity(0.4) } onPageShow(): void { let i: number = 0; - for (i = 0; i < 100; i++) { - this.numbers.push(i); - this.isSelectedGrid.push(false); - this.previewData.push({}); - } + for(i = 0; i < 100; i++) { + this.numbers.push(i); + this.isSelectedGrid.push(false); + this.previewData.push({}); } +} - @Builder - RandomBuilder(idx: number) { - Column() - .backgroundColor(Color.Blue) - .width(50) - .height(50) - .opacity(1.0) - } +@Builder +RandomBuilder(idx: number) { + Column() + .backgroundColor(Color.Blue) + .width(50) + .height(50) + .opacity(1.0) +} - build() { - Column({ space: 5 }) { - Grid() { - ForEach(this.numbers, (idx: number) => { - GridItem() { - Column() - .backgroundColor(Color.Blue) - .width(50) - .height(50) - .opacity(1.0) - .id('grid' + idx) - } +build() { + Column({ space: 5 }) { + Grid() { + ForEach(this.numbers, (idx: number) => { + GridItem() { + Column() + .backgroundColor(Color.Blue) + .width(50) + .height(50) + .opacity(1.0) + .id('grid' + idx) + } .dragPreview(this.previewData[idx]) .selectable(true) .selected(this.isSelectedGrid[idx]) @@ -93,14 +93,14 @@ struct GridEts { { isMultiSelectionEnabled: true, defaultAnimationBeforeLifting: true }) .onDragStart(() => { }) - }, (idx: string) => idx) - } + }, (idx: string) => idx) + } .columnsTemplate('1fr 1fr 1fr 1fr 1fr') .columnsGap(5) .rowsGap(10) .backgroundColor(0xFAEEE0) - }.width('100%').margin({ top: 5 }) - } + }.width('100%').margin({ top: 5 }) +} } //[End gridExample_start] diff --git a/ArkUIKit/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets b/ArkUIKit/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets index 053502061fb81ac51434de2faa54186759b0d155..88378abd52b57067c6e4d1089b915940788a86a3 100644 --- a/ArkUIKit/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets +++ b/ArkUIKit/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets @@ -26,6 +26,7 @@ export const springLoadingRoutePrefix: string = 'springLoadingExample'; export struct SpringLoadingPage { context1 = this.getUIContext().getHostContext() @Local isShowSheet: boolean = false; + // 'app.string.Select_Result'需要替换为开发者所需的文本资源文件 private searchResult: string = this.context1?.resourceManager.getStringSync($r('app.string.Select_Result').id)!; @Local isSearchDone: boolean = false; private reminderColor: Color = Color.Green; @@ -148,11 +149,12 @@ export struct SpringLoadingPage { //[EndExclude SpringLoading_start] //[EndExclude springLoading_example] Column() { + // 'app.string.DoubleClick_Text'需要替换为开发者所需的文本资源文件 Text($r('app.string.DoubleClick_Text')) .fontSize(30) .copyOption(CopyOptions.InApp) // 开启copyOption之后,文本组件即可支持选择内容进行拖拽 }.padding({ bottom: 30 }) - + // 'app.string.Search_Device'需要替换为开发者所需的文本资源文件 Button($r('app.string.Search_Device')) .width('80%') .height('80vp') @@ -160,6 +162,7 @@ export struct SpringLoadingPage { .bindSheet($$this.isShowSheet, this.SheetBuilder(), { detents: [SheetSize.MEDIUM, SheetSize.LARGE, 600], preferType: SheetType.BOTTOM, + // 'app.string.Search_Device'需要替换为开发者所需的文本资源文件 title: { title: $r('app.string.Search_Device') }, }) //[StartExclude springLoading_example] @@ -184,16 +187,17 @@ export struct SpringLoadingPage { //[StartExclude SpringLoading_start] } .backgroundColor('#f1f3f5') - .title('', { - backgroundBlurStyle: BlurStyle.COMPONENT_THICK, - barStyle: BarStyle.STACK - }) - .title($r('app.string.Pages_Index_DropAnimation')) + .title('', { + backgroundBlurStyle: BlurStyle.COMPONENT_THICK, + barStyle: BarStyle.STACK + }) + // 'app.string.Pages_Index_DropAnimation'需要替换为开发者所需的文本资源文件 + .title($r('app.string.Pages_Index_DropAnimation')) //[EndExclude springLoading_example] //[StartExclude SpringLoading_start] }.width('100%').height('100%') - .justifyContent(FlexAlign.Center) + .justifyContent(FlexAlign.Center) } //[End springLoading_example] diff --git a/ArkUIKit/EventProject/entry/src/main/resources/base/element/string.json b/ArkUIKit/EventProject/entry/src/main/resources/base/element/string.json index de66b15b0304ecf3325e51b4ef2f1e63c095d403..c764b22b9763959dbf299fdc860eff8f9ca3391a 100644 --- a/ArkUIKit/EventProject/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/EventProject/entry/src/main/resources/base/element/string.json @@ -68,9 +68,13 @@ "name": "Device_OnKey_title", "value": "按键事件" }, + { + "name": "Device_OnKeyPreventBubble_title", + "value": "阻止按键事件冒泡" + }, { "name": "Device_OnKeyPreIme_title", - "value": "按键事件" + "value": "屏蔽按键事件" }, { "name": "Device_OnMouse_title", diff --git a/ArkUIKit/GestureGroup/entry/src/main/ets/pages/Sequence.ets b/ArkUIKit/GestureGroup/entry/src/main/ets/pages/Sequence.ets index d728b3812e45a839a2c6e6e6274d3979a68c1718..11d5fc1b2bfbacdd78fec258484eb0a9681df61b 100644 --- a/ArkUIKit/GestureGroup/entry/src/main/ets/pages/Sequence.ets +++ b/ArkUIKit/GestureGroup/entry/src/main/ets/pages/Sequence.ets @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +// [Start sequence_identification] +// xxx.ets import { hilog } from '@kit.PerformanceAnalysisKit'; const DOMAIN = 0x0001; const TAG = 'Sample_gesturegroup'; -// [Start sequence_identification] -// xxx.ets @Entry @Component struct sequenceIdentification { diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/Index.ets b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/Index.ets index 79d22123f3357f3bf53199482d81b285caca8a38..cc2381535f0581f7e7c23520948e76a2ea70f918 100644 --- a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/Index.ets +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/Index.ets @@ -12,22 +12,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { router } from '@kit.ArkUI'; -// [Start progress_example_up] @Entry @Component -struct ProgressCase1 { - @State progressValue: number = 0 // 设置进度条初始值为0 - // [StartExclude progress_example_up] +struct Index { scroller: Scroller = new Scroller(); - // [EndExclude progress_example_up] build() { - // [StartExclude progress_example_up] NavDestination() { Scroll(this.scroller) { - // [EndExclude progress_example_up] Column({space:10}) { - // [End progress_example_up] + Row() { + Text($r('app.string.Progress_Style')) + Blank() + Button($r('app.string.Progress_Update_Example')) + .onClick((event: ClickEvent) => { + router.pushUrl({ + url: 'pages/ProgressCase1' + }) + }) + }.width('90%') Text($r('app.string.Linear_Progress')).fontSize(9).fontColor(0xCCCCCC).width('90%') // [Start progress_style_1] Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(200).height(50) @@ -79,25 +83,12 @@ struct ProgressCase1 { Progress({ value: 50, total: 150, type: ProgressType.Capsule }).width(50).height(100).color(Color.Blue).backgroundColor(Color.Black) // [End progress_style_5] } - // [Start progress_example] - Progress({value:0, total:100, type:ProgressType.Capsule}).width(200).height(50).value(this.progressValue) - Row().width('100%').height(5) - Button("进度条+5") - .onClick(()=>{ - this.progressValue += 5; - if (this.progressValue > 100){ - this.progressValue = 0; - } - }) }.width('100%') } - // [StartExclude progress_example] + .scale({ x: 0.98 }) .id('scroll_') } .backgroundColor('#f1f2f3') - .title($r('app.string.Progress_Style')) - // [EndExclude progress_example] } } -// [End progress_example] diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/ProgressCase1.ets b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/ProgressCase1.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc31cfac4380ffca2a378ddd184520bec918994f --- /dev/null +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/ets/pages/ProgressCase1.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 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. + */ +// [Start progress_example] +@Entry +@Component +struct ProgressCase1 { + @State progressValue: number = 0; // 设置进度条初始值为0 + build() { + Column() { + Column() { + Progress({value:0, total:100, type:ProgressType.Capsule}).width(200).height(50).value(this.progressValue) + Row().width('100%').height(5) + Button('进度条+5') + .onClick(()=>{ + this.progressValue += 5; + if (this.progressValue > 100){ + this.progressValue = 0; + } + }) + } + }.width('100%').height('100%') + } +} +// [End progress_example] \ No newline at end of file diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/element/string.json b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/element/string.json index a43641294d54e4d67f0763d83e0a6555746f776e..59b8abbeb67e288fca775ae6caed1d4c8a47cb8b 100644 --- a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/element/string.json @@ -26,12 +26,16 @@ }, { "name": "Progress_Style", - "value": "设置进度条样式" + "value": "不同进度条样式" }, { "name": "Progress_Example", "value": "场景示例" }, + { + "name": "Progress_Update_Example", + "value": "更新进度示例" + }, { "name": "Progress_Example_desc", "value": "更新当前进度值,如应用安装进度条,可通过点击Button增加progressValue,value属性将progressValue设置给Progress组件,进度条组件即会触发刷新,更新当前进度。\n\n" @@ -42,23 +46,23 @@ }, { "name": "Linear_Progress", - "value": "Linear Progress" + "value": "线性样式进度条" }, { "name": "Ring_Progress", - "value": "Ring Progress" + "value": "环形无刻度样式进度条" }, { "name": "ScaleRing_Progress", - "value": "ScaleRing Progress" + "value": "环形有刻度样式进度条" }, { "name": "Eclipse_Progress", - "value": "Eclipse Progress" + "value": "圆形样式进度条" }, { "name": "Capsule_Progress", - "value": "Capsule Progress" + "value": "胶囊样式进度条" }, { "name": "progress_add", diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/profile/main_pages.json index 1898d94f58d6128ab712be2c68acc7c98e9ab9ce..65cfe781089e20d6a475456404c194ac9081cd4c 100644 --- a/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/profile/main_pages.json +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,6 @@ { "src": [ - "pages/Index" + "pages/Index", + "pages/ProgressCase1" ] -} +} \ No newline at end of file diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/ets/test/Index.test.ets b/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/ets/test/Index.test.ets index bbedacdb430e35baf7f500c87028cd85607f9569..3f4be8653b0f40f1b2bd8adbdd294cdc9b64da29 100644 --- a/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/ets/test/Index.test.ets +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/ets/test/Index.test.ets @@ -17,6 +17,7 @@ import { describe, it, expect, beforeAll } from '@ohos/hypium'; import { abilityDelegatorRegistry, Driver, ON, Component } from '@kit.TestKit'; import { UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit' +import { KeyCode } from '@kit.InputKit'; const delegator = abilityDelegatorRegistry.getAbilityDelegator(); const bundleName = abilityDelegatorRegistry.getArguments().bundleName; @@ -76,16 +77,14 @@ export default function IndexTest() { */ it('testProgressIncrease', 0, async (done: Function) => { hilog.info(DOMAIN, TAG, BUNDLE + "ProgressTest: testProgressIncrease begin"); - - let scrollComponent: Component = await driver.waitForComponent(ON.id('scroll_'), 1000); - let scrollCenter = await scrollComponent.getBoundsCenter(); - await driver.swipe(scrollCenter.x, scrollCenter.y + 400, scrollCenter.x, scrollCenter.y - 400, 3000); - await driver.waitForIdle(500, 500); - + const routerBtn = await driver.findComponent(ON.text('更新进度示例')); + await routerBtn.click(); + await driver.delayMs(500); const increaseBtn = await driver.findComponent(ON.text('进度条+5')); expect(increaseBtn === null).assertFalse(); await increaseBtn.click(); await driver.delayMs(500); + await driver.triggerKey(KeyCode.KEYCODE_BACK); hilog.info(DOMAIN, TAG, BUNDLE + "ProgressTest: testProgressIncrease end"); done(); }); @@ -97,16 +96,16 @@ export default function IndexTest() { */ it('testProgressMaxValue', 0, async (done: Function) => { hilog.info(DOMAIN, TAG, BUNDLE + "ProgressTest: testProgressMaxValue begin"); - let scrollComponent: Component = await driver.waitForComponent(ON.id('scroll_'), 1000); - let scrollCenter = await scrollComponent.getBoundsCenter(); - await driver.swipe(scrollCenter.x, scrollCenter.y + 400, scrollCenter.x, scrollCenter.y - 400, 3000); - await driver.waitForIdle(500, 500); + const routerBtn = await driver.findComponent(ON.text('更新进度示例')); + await routerBtn.click(); + await driver.delayMs(500); const increaseBtn = await driver.findComponent(ON.text('进度条+5')); for (let i = 0; i < 25; i++) { await increaseBtn.click(); await driver.delayMs(100); } await driver.delayMs(500); + await driver.triggerKey(KeyCode.KEYCODE_BACK); hilog.info(DOMAIN, TAG, BUNDLE + "ProgressTest: testProgressDecrease end"); done(); }); diff --git a/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/module.json5 b/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/module.json5 index 23e190a98dd54841c310eb987b8fc38e929c4c00..4c262abdf023b2ec4a9333c029b0b544d561a77d 100644 --- a/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/module.json5 +++ b/ArkUIKit/InfoComponent/ProgressProject/entry/src/ohosTest/module.json5 @@ -18,7 +18,10 @@ "module": { "name": "entry_test", "type": "feature", - "deviceTypes": [], + "deviceTypes": [ + "default", + "tablet" + ], "deliveryWithInstall": true, "installationFree": false } diff --git a/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image1.png b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image1.png index 342250f65c0474ff7230699bdcc26fefa602eb07..80ca2e762001a721a8bce0839e85a5096e6d0d25 100644 Binary files a/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image1.png and b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image1.png differ diff --git a/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image2.png b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image2.png index 07ad673e1ab3d9d79e93b51144a63fcfe49def62..c8623a180a5e93acd859b7d878ef3675768b716f 100644 Binary files a/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image2.png and b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image2.png differ diff --git a/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image3.png b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image3.png new file mode 100644 index 0000000000000000000000000000000000000000..d3a3436b98ff6f508680aff23d213ec82df0cb42 Binary files /dev/null and b/ArkUIKit/InfoComponent/ProgressProject/screenshots/device/image3.png differ diff --git a/ArkUIKit/MultipleLayoutProject/entry/.gitignore b/ArkUIKit/MultipleLayoutProject/entry/.gitignore deleted file mode 100644 index e2713a2779c5a3e0eb879efe6115455592caeea5..0000000000000000000000000000000000000000 --- a/ArkUIKit/MultipleLayoutProject/entry/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/node_modules -/oh_modules -/.preview -/build -/.cxx -/.test \ No newline at end of file diff --git a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutNozIndex.ets b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutNozIndex.ets index 7d22e6ca24619ede8b6d6d6cb9794594e29382a7..c5fae82e5557884e2fb3690694c5034d5071e6da 100644 --- a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutNozIndex.ets +++ b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutNozIndex.ets @@ -20,17 +20,17 @@ struct StackLayoutNozIndex { //[Start StackLayoutNozIndex_start] Stack({ alignContent: Alignment.BottomStart }) { Column() { - //$r('app.string.stack_num1')需要替换为开发者所需的资源文件,stack_num1为'Stack子元素1' + //'app.string.stack_num1'资源文件中的value值为'Stack子元素1' Text($r('app.string.stack_num1')).textAlign(TextAlign.End).fontSize(20) }.width(100).height(100).backgroundColor(0xffd306) Column() { - //$r('app.string.stack_num2')需要替换为开发者所需的资源文件,stack_num2为'Stack子元素2' + //'app.string.stack_num2'资源文件中的value值为'Stack子元素2' Text($r('app.string.stack_num2')).fontSize(20) }.width(150).height(150).backgroundColor(Color.Pink) Column() { - //$r('app.string.stack_num3')需要替换为开发者所需的资源文件,stack_num3为'Stack子元素3' + //'app.string.stack_num3'资源文件中的value值为'Stack子元素3' Text($r('app.string.stack_num3')).fontSize(20) }.width(200).height(200).backgroundColor(Color.Grey) }.width(350).height(350).backgroundColor(0xe0e0e0) diff --git a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutSceneExample.ets b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutSceneExample.ets index d76de44d8d996d198380b2449c01a1bf6c75cbdc..1fa383ddc13e6064218d8718f539492d073ef03a 100644 --- a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutSceneExample.ets +++ b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutSceneExample.ets @@ -34,11 +34,11 @@ struct StackSample { }.width('100%').height('100%') Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { - //$r('app.string.contacts')需要替换为开发者所需的资源文件,contacts为'联系人' + //'app.string.contacts'资源文件中的value值为'联系人' Text($r('app.string.contacts')).fontSize(16) - //$r('app.string.setting')需要替换为开发者所需的资源文件,setting为'设置' + //'app.string.setting'资源文件中的value值为'设置' Text($r('app.string.setting')).fontSize(16) - //$r('app.string.text_message')需要替换为开发者所需的资源文件,text_message为'短信' + //'app.string.text_message'资源文件中的value值为'短信' Text($r('app.string.text_message')).fontSize(16) } .width('50%') diff --git a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutzIndex.ets b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutzIndex.ets index 343bdda818f37f2ac9c92682fddf9df11bee1a90..af7f18327ed5145c4571c47a7cfcd8b6e3ddeb92 100644 --- a/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutzIndex.ets +++ b/ArkUIKit/MultipleLayoutProject/entry/src/main/ets/pages/stacklayout/StackLayoutzIndex.ets @@ -20,17 +20,17 @@ struct StackLayoutzIndex { //[Start StackLayoutzIndex_start] Stack({ alignContent: Alignment.BottomStart }) { Column() { - //$r('app.string.stack_num1')需要替换为开发者所需的资源文件,stack_num1为'Stack子元素1' + //'app.string.stack_num1'资源文件中的value值为'Stack子元素1' Text($r('app.string.stack_num1')).fontSize(20) }.width(100).height(100).backgroundColor(0xffd306).zIndex(2) Column() { - //$r('app.string.stack_num2')需要替换为开发者所需的资源文件,stack_num2为'Stack子元素2' + //'app.string.stack_num2'资源文件中的value值为'Stack子元素2' Text($r('app.string.stack_num2')).fontSize(20) }.width(150).height(150).backgroundColor(Color.Pink).zIndex(1) Column() { - //$r('app.string.stack_num3')需要替换为开发者所需的资源文件,stack_num3为'Stack子元素3' + //'app.string.stack_num3'资源文件中的value值为'Stack子元素3' Text($r('app.string.stack_num3')).fontSize(20) }.width(200).height(200).backgroundColor(Color.Grey) }.width(350).height(350).backgroundColor(0xe0e0e0) diff --git a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUICustomNode.h b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUICustomNode.h index fd3a1075f8b9a5852c6281e373f094b405cf7c03..2037c14fbb3fd81b2ae7297b85052959d19a79dd 100644 --- a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUICustomNode.h +++ b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUICustomNode.h @@ -53,16 +53,19 @@ public: } private: + // [StartExclude arkUICustomNode_start] int32_t NUM_2 = 2; int32_t NUM_3 = 3; int32_t NUM_4 = 4; int32_t NUM_5 = 5; - + // [EndExclude arkUICustomNode_start] static void OnStaticCustomEvent(ArkUI_NodeCustomEvent *event) { // 获取组件实例对象,调用相关实例方法。 + // [StartExclude arkUICustomNode_start] auto targetId = OH_ArkUI_NodeCustomEvent_GetEventTargetId(event); auto handle = OH_ArkUI_NodeCustomEvent_GetNodeHandle(event); + // [EndExclude arkUICustomNode_start] auto customNode = reinterpret_cast(OH_ArkUI_NodeCustomEvent_GetUserData(event)); auto type = OH_ArkUI_NodeCustomEvent_GetEventType(event); switch (type) { @@ -76,12 +79,14 @@ private: case ARKUI_NODE_CUSTOM_EVENT_ON_DRAW_FRONT: customNode->OnDrawFront(event); break; + // [StartExclude arkUICustomNode_start] case ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW: customNode->OnDrawForeGround(event); break; case ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW: customNode->OnDrawOverLay(event); break; + // [EndExclude arkUICustomNode_start] default: break; } @@ -159,7 +164,7 @@ private: OH_Drawing_BrushDestroy(brush); OH_Drawing_PathDestroy(path); } - + // [StartExclude arkUICustomNode_start] void OnDrawForeGround(ArkUI_NodeCustomEvent *event) { auto drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event); @@ -207,6 +212,7 @@ private: OH_Drawing_BrushDestroy(brush); OH_Drawing_PathDestroy(path); } + // [EndExclude arkUICustomNode_start] }; } // namespace NativeModule diff --git a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUITextNode.h b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUITextNode.h index c6c0b760d5663da952d71147a2d538ddcb2c1a40..73a61ba087b217b9d4b906bd120f826ea7787474 100644 --- a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUITextNode.h +++ b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/ArkUITextNode.h @@ -20,11 +20,12 @@ #include #include +#include #include "ArkUINode.h" #include -#include "NativeEntry.h" + // [StartExclude arkUITestNode_start] -#include +#include "NativeEntry.h" // [EndExclude arkUITestNode_start] namespace NativeModule { @@ -46,7 +47,7 @@ void OnDrawCompleted(void *userData) ArkUI_AttributeItem item = {nullptr, 0, "draw callback"}; nativeModule->setAttribute(node, NODE_TEXT_CONTENT, &item); } - +// [StartExclude arkUITestNode_start] void ColorChangeCallback(ArkUI_SystemColorMode colorMode, void *userData) { if (userData) { @@ -58,12 +59,11 @@ void ColorChangeCallback(ArkUI_SystemColorMode colorMode, void *userData) NativeModuleInstance::GetInstance()->GetNativeNodeAPI()->setAttribute(handle, NODE_FONT_COLOR, &item); } } - +// [EndExclude arkUITestNode_start] class ArkUITextNode : public ArkUINode { public: ArkUITextNode() : ArkUINode((NativeModuleInstance::GetInstance()->GetNativeNodeAPI())->createNode(ARKUI_NODE_TEXT)) {} - // 文本属性接口封装。 void SetFontSize(float fontSize) { ArkUI_NumberValue value[] = {{.f32 = fontSize}}; @@ -116,6 +116,7 @@ public: ArkUI_AttributeItem item = {nullptr, 0, inspectorId.c_str()}; nativeModule_->setAttribute(handle_, NODE_ID, &item); } + // [StartExclude arkUITestNode_start] void RegistSystemColorModeChange() { OH_ArkUI_RegisterSystemColorModeChangeEvent(handle_, handle_, ColorChangeCallback); @@ -125,6 +126,7 @@ public: { OH_ArkUI_UnregisterSystemColorModeChangeEvent(handle_); } + // [EndExclude arkUITestNode_start] }; } // namespace NativeModule diff --git a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/Drawing.h b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/Drawing.h index 9534f358a025086ab0b9ad8190060c38a0ad3d40..f09d819d8ee46e27472822f7e4276628e92614d8 100644 --- a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/Drawing.h +++ b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/Drawing.h @@ -21,8 +21,9 @@ #include #include #include +// [StartExclude drawing_start] #include "common/common.h" - +// [EndExclude drawing_start] ArkUI_NodeHandle test_draw(ArkUI_NativeNodeAPI_1 *nodeAPI) { // 创建节点 @@ -51,15 +52,16 @@ ArkUI_NodeHandle test_draw(ArkUI_NativeNodeAPI_1 *nodeAPI) }; A *a = new A; a->node = customNode; + // [StartExclude userdata_start] nodeAPI->setAttribute(customNode, NODE_WIDTH, NODE_WIDTH_Item); nodeAPI->setAttribute(customNode, NODE_HEIGHT, NODE_HEIGHT_Item); nodeAPI->setAttribute(customNode, NODE_BACKGROUND_COLOR, NODE_BACKGROUND_COLOR_Item); // 进行事件注册 + // [EndExclude userdata_start] nodeAPI->registerNodeCustomEvent(customNode, ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW, 1, a); // 事件回调函数的编写 nodeAPI->registerNodeCustomEventReceiver([](ArkUI_NodeCustomEvent *event) { // 事件回调函数逻辑 - // [End userdata_start] // 获取自定义事件的相关信息。 // [Start nodeCustomEvent_start] auto type = OH_ArkUI_NodeCustomEvent_GetEventType(event); @@ -67,6 +69,7 @@ ArkUI_NodeHandle test_draw(ArkUI_NativeNodeAPI_1 *nodeAPI) auto userData = reinterpret_cast(OH_ArkUI_NodeCustomEvent_GetUserData(event)); // [End nodeCustomEvent_start] if (type == ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW && targetId == 1 && userData->flag) { + // [Start nodeCustomEvent_start] // [Start drawCanvas_Start] // 获取自定义事件绘制的上下文。 auto *drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event); @@ -89,8 +92,10 @@ ArkUI_NodeHandle test_draw(ArkUI_NativeNodeAPI_1 *nodeAPI) OH_Drawing_CanvasAttachPen(canvas, pen); OH_Drawing_CanvasDrawPath(canvas, path); // [End drawCanvas_Start] + // [EndExclude nodeCustomEvent_start] } }); + // [End userdata_start] // 自定义节点上树 nodeAPI->addChild(column, customNode); return column; diff --git a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NativeEntry.cpp b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NativeEntry.cpp index 02f631d061ed6478e421a2d32491bec66d6e14af..28efb9e5882c5e5a49778b4dc5217ce15651ab6d 100644 --- a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NativeEntry.cpp +++ b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NativeEntry.cpp @@ -31,6 +31,8 @@ #include #include "ArkUICustomContainerNode.h" #include "ArkUICustomNode.h" + +// 全局环境变量声明 static napi_env g_env = nullptr; // [Start Interface_entrance_mounting_file] #include "NativeEntry.h" diff --git a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NormalTextListExample.h b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NormalTextListExample.h index 5035b1800d945e0ffe1b28bc08c17e879583c930..198897cbc344bbb5e13f90835058fe2bd8b543a5 100644 --- a/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NormalTextListExample.h +++ b/ArkUIKit/NativeType/NativeNodeUtilsSample/entry/src/main/cpp/NormalTextListExample.h @@ -23,7 +23,9 @@ #include "ArkUIListItemNode.h" #include "ArkUIListNode.h" #include "ArkUITextNode.h" +// [StartExclude normalTextListExample_start] #include "common/common.h" +// [EndExclude normalTextListExample_start] #include namespace NativeModule { diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/hsp/Hsp3.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/hsp/Hsp3.ets index b5da2fe5a5fd85000c27d4dc71373a09c7c12cf7..2bc1456c6b49333bd9f8aa7b8832cdb7032d7b39 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/hsp/Hsp3.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/hsp/Hsp3.ets @@ -17,7 +17,8 @@ import { BusinessError } from '@kit.BasicServicesKit'; import '@ohos/library/src/main/ets/pages/Index'; // 引入共享包中的命名路由页面 import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/BackHome.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/BackHome.ets index df2b08187258a6c7ccd40afd131dae931ab94e25..b948c886c00f755917fd598216c026859fa660c6 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/BackHome.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/BackHome.ets @@ -14,9 +14,9 @@ */ import { router } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; -// [Start back_home] @Entry({ routeName: 'myPage' }) @Component struct BackHome { @@ -51,5 +51,4 @@ struct BackHome { }.width('100%') }.height('100%') } -} -// [End back_home] \ No newline at end of file +} \ No newline at end of file diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Index.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Index.ets index 0a7ae5b88e397f455bcf5b6c4ceba07a822d8396..4083287ca21deef5bd8d1bf5cc71f2d29d1ab6f6 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Index.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Index.ets @@ -16,7 +16,8 @@ // [Start jump_click] import { router } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/IndexPara.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/IndexPara.ets index cb3136146ea4c1f0c69721cdd37c03648ba3122e..a5aca5cc29a4f1f46e14b015f35fb2cb7beee7e9 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/IndexPara.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/IndexPara.ets @@ -13,7 +13,8 @@ * limitations under the License. */ import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; // [Start home_param1] class DataModelInfo { diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Login.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Login.ets index 1e65a9c53d7f0d27a346df4e3fa751fb7b4c66f0..81fc1babd6abfd0ea73d752c62426897932d210c 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Login.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Login.ets @@ -16,7 +16,8 @@ // [Start login_click] import { router } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/SearchResult.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/SearchResult.ets index eaa2baab37f4f10b21d70f527fc59b35f22c14ef..49ffcb2925e133f66f5ec9ddebf081d65e2eaeda 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/SearchResult.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/SearchResult.ets @@ -13,9 +13,10 @@ * limitations under the License. */ // [Start search_click] -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; import { router } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Setting.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Setting.ets index ff3f02d92531499665322d30f29054fab8721ca3..d393e9681489a4b5c53436ac5c0e0d4fa26d74c5 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Setting.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/jumpPage/Setting.ets @@ -16,7 +16,8 @@ // [Start setting_click] import { router } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Index.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Index.ets index 6046a6a71a632eae8de3e5a14354511dc8897862..f9e0676bea3001bea256e75ca2ca881cbce0630c 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Index.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Index.ets @@ -14,23 +14,26 @@ */ // [Start life_index] +import { hilog } from '@kit.PerformanceAnalysisKit'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; // Index.ets @Entry @Component struct MyComponent { // 只有被@Entry装饰的组件才可以调用页面的生命周期 onPageShow() { - console.info('Index onPageShow'); + hilog.info(DOMAIN, TAG, 'Index onPageShow'); } // 只有被@Entry装饰的组件才可以调用页面的生命周期 onPageHide() { - console.info('Index onPageHide'); + hilog.info(DOMAIN, TAG, 'Index onPageHide'); } // 只有被@Entry装饰的组件才可以调用页面的生命周期 onBackPress() { - console.info('Index onBackPress'); + hilog.info(DOMAIN, TAG, 'Index onBackPress'); // 返回true表示页面自己处理返回逻辑,不进行页面路由;返回false表示使用默认的路由返回逻辑,不设置返回值按照false处理 return true; } diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Page.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Page.ets index d6f4d5f11e3ff24eabac426492597cb43175ab55..6e94b8069289a30f78c3c073a612581d17bedf8f 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Page.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/lifeCycle/Page.ets @@ -15,7 +15,8 @@ // [Start life_page] import { hilog } from '@kit.PerformanceAnalysisKit'; - import { DOMAIN, TAG } from '../../common/Common'; + const DOMAIN = 0xF811; + const TAG = '[Sample_ArkTSRouter]'; // Page.ets @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowAlert.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowAlert.ets index cf8b710f394d42943ae66d0b5a569f1a67d70d5e..08f59c558ba2b4c6119a2d7923bd0f40147279f7 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowAlert.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowAlert.ets @@ -15,11 +15,10 @@ // [Start page_showAlert1] import { BusinessError } from '@kit.BasicServicesKit'; -// [End page_showAlert1] import { hilog } from '@kit.PerformanceAnalysisKit'; - -const DOMAIN = 0xF811 +const DOMAIN = 0xF811; const TAG = '[Sample_ArkTSRouter]'; +// [End page_showAlert1] @Entry @Component @@ -31,8 +30,7 @@ struct ShowAlert { // 调用this.getUIContext().getRouter().showAlertBeforeBackPage方法,设置返回询问框的信息 try { this.getUIContext().getRouter().showAlertBeforeBackPage({ - // 您还没有完成支付,确定要返回吗? - message: 'You haven\'t completed the payment yet. Are you sure you want to return?', // 设置询问框的内容 + message: this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('pageRouter_dialog_context') as string, // 设置询问框的内容 }); } catch (err) { let message = (err as BusinessError).message; diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowDialog.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowDialog.ets index 00c8bc14c7e42f8a78c91b4e277e81aac2e5e213..c47f1e2bb88357da8c32c9f18e24145df968f956 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowDialog.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/pageRouter/pageTransition/ShowDialog.ets @@ -16,10 +16,10 @@ // [Start page_showDialog1] import { promptAction} from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; -// [End page_showDialog1] import { hilog } from '@kit.PerformanceAnalysisKit'; -const DOMAIN = 0xF811 +const DOMAIN = 0xF811; const TAG = '[Sample_ArkTSRouter]'; +// [End page_showDialog1] @Entry @Component @@ -30,14 +30,14 @@ struct ShowAlert { // 弹出自定义的询问框 this.getUIContext().getPromptAction().showDialog({ // 您还没有完成支付,确定要返回吗? - message: 'You haven\'t completed the payment yet. Are you sure you want to return?', + message: this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('pageRouter_dialog_context') as string, buttons: [ { - text: 'Cancel', + text: this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('pageRouter_dialog_canceled') as string, color: '#FF0000' }, { - text: 'Confirm', + text: this.getUIContext().getHostContext()?.resourceManager.getStringByNameSync('pageRouter_dialog_confirmed') as string, color: '#0099FF' } ] diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/GetRouter.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/GetRouter.ets index bf95522703764b5fac9e0d703c64b695d22f8088..0224d155a1ff01f0d144514c43b160fa3d79d3f2 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/GetRouter.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/GetRouter.ets @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { router } from '@kit.ArkUI'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/Index.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/Index.ets index a50776e94e80461fb83a75834066830f2750ca66..33ad3a9e89ba57ffb6c9910f053237e462e43f4c 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/Index.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/navPathStack/Index.ets @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { router } from '@kit.ArkUI'; // [Start nav_stack_one] @Entry diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Comm.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Comm.ets index 95428cabbacedbe237c7054fdb526d030452062a..13d0bcc5ae9a476aaa94f0b6033176529ee19563 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Comm.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Comm.ets @@ -13,10 +13,11 @@ * limitations under the License. */ -import { DOMAIN, TAG } from '../../common/Common'; -import { hilog } from '@kit.PerformanceAnalysisKit'; // [Start observer_comm] import { UIContext, uiObserver } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; function callbackFunc(info: uiObserver.RouterPageInfo) { hilog.info(DOMAIN, TAG,'RouterPageInfo is : ' + JSON.stringify(info)); diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Index.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Index.ets index 78eabed3b870d92c10552d6f42483209453e68f2..a22f1afbe8f8d9470115fb5de1c4bd8b25cc48dd 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Index.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/Index.ets @@ -13,13 +13,14 @@ * limitations under the License. */ -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; // [Start observer_index] // EntryAbility.ets import { BusinessError } from '@kit.BasicServicesKit'; import { UIObserver, window } from '@kit.ArkUI'; import { UIAbility } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; export default class EntryAbility extends UIAbility { // ... diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/QueryNav.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/QueryNav.ets index c2451af0a2e3b9ce333a419f849ae3bb0920a1ba..b15794a4f2d8720e55e3a8d85a145cea247ae372 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/QueryNav.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/observer/QueryNav.ets @@ -16,7 +16,8 @@ // [Start observer_query] import { uiObserver } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Component export struct NavDestinationExample { diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Hsp12.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Hsp12.ets index b2bbc2eb057d5ff84bedc9ebc42177490955a5cb..eb4b046e4558846e4d88135121044829fbcb489b 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Hsp12.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Hsp12.ets @@ -13,11 +13,12 @@ * limitations under the License. */ -import { hilog } from '@kit.PerformanceAnalysisKit'; // [Start router_hsp12] import { BusinessError } from '@kit.BasicServicesKit'; -import { DOMAIN, TAG } from '../../common/Common'; import('library/src/main/ets/pages/routerToNavigation/router/Index'); // 引入共享包中的命名路由页面 +import { hilog } from '@kit.PerformanceAnalysisKit'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Index.ets b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Index.ets index cd9166d87d3beb27e77a15773cd68e44052cb20a..0e4d12cbc26176e2d1ed13bc1085aa5d899c3e16 100644 --- a/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Index.ets +++ b/ArkUIKit/Navigation/entry/src/main/ets/pages/routerToNavigation/router/Index.ets @@ -17,7 +17,8 @@ // Index.ets import { router } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { DOMAIN, TAG } from '../../common/Common'; +const DOMAIN = 0xF811; +const TAG = '[Sample_ArkTSRouter]'; @Entry @Component diff --git a/ArkUIKit/Navigation/entry/src/main/resources/base/element/string.json b/ArkUIKit/Navigation/entry/src/main/resources/base/element/string.json index 70119abe0b90c5157b7008b245f3c9aee862e08f..03f23e378b3a448a26d5fbbef85e2affdefbce33 100644 --- a/ArkUIKit/Navigation/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/Navigation/entry/src/main/resources/base/element/string.json @@ -185,6 +185,15 @@ }, { "name": "pageRouter_jump_text9_dialog", "value": "系统默认询问框-ShowDialog" + }, { + "name": "pageRouter_dialog_context", + "value": "您还没有完成支付,确定要返回吗?" + }, { + "name": "pageRouter_dialog_canceled", + "value": "取消" + }, { + "name": "pageRouter_dialog_confirmed", + "value": "确认" } ] } \ No newline at end of file diff --git a/ArkUIKit/Prop/entry/src/main/ets/pages/PageEight.ets b/ArkUIKit/Prop/entry/src/main/ets/pages/PageEight.ets index 360c55aecaa5293ff389572b9584ff8ca4eff5ec..ef85ecc0ef3ab22f1dea5cd62e2c1749fce03782 100644 --- a/ArkUIKit/Prop/entry/src/main/ets/pages/PageEight.ets +++ b/ArkUIKit/Prop/entry/src/main/ets/pages/PageEight.ets @@ -48,15 +48,15 @@ struct ObservedDemo { Text('嵌套对象数据展示') .fontSize(20) .fontWeight(FontWeight.Bold) - .margin(20); + .margin(20) // 展示Father的name属性 Text(`父亲的名字: ${this.father.name}`) - .fontSize(16); + .fontSize(16) // 展示Son的title属性(嵌套层级) Text(`儿子的标题: ${this.father.son.title}`) - .fontSize(16); + .fontSize(16) } .margin(30) @@ -66,13 +66,13 @@ struct ObservedDemo { Button(`change the father's name`) .onClick(() => { this.father.name = '新的父亲名字'; // 直接修改,@Observed会触发更新 - }); + }) // 按钮2:修改Son的title(嵌套的第二层属性) Button(`modify the son's title`) .onClick(() => { this.father.son.title = '新的儿子标题'; // 深层修改,@Observed会触发更新 - }); + }) } } .width('100%') diff --git a/ArkUIKit/Prop/entry/src/main/ets/pages/PageEighteen.ets b/ArkUIKit/Prop/entry/src/main/ets/pages/PageEighteen.ets index 6e8c71b67dd3c2056a1c03cb528f1e762155a3a6..28aeef0fa04e3f65173508d771cf385daee7e22b 100644 --- a/ArkUIKit/Prop/entry/src/main/ets/pages/PageEighteen.ets +++ b/ArkUIKit/Prop/entry/src/main/ets/pages/PageEighteen.ets @@ -70,23 +70,21 @@ struct DataDisplay { Button('assign ["1"]') .fontSize(8) - .onClick(() => this.title = ['1']); + .onClick(() => this.title = ['1']) // 按钮2:第一项改为 "2" Button('change to "2"') .fontSize(8) - .onClick(() => this.title.length > 0 && (this.title[0] = '2')); + .onClick(() => this.title.length > 0 && (this.title[0] = '2')) // 按钮4:新增 "3" Button('insert "3"') .fontSize(8) - .onClick(() => this.title.push('3')); + .onClick(() => this.title.push('3')) // 按钮3:删除最后一项 Button('delete') .fontSize(8) - .onClick(() => this.title.pop()); - + .onClick(() => this.title.pop()) } - } } .padding(20); diff --git a/ArkUIKit/Prop/entry/src/main/ets/pages/PageFour.ets b/ArkUIKit/Prop/entry/src/main/ets/pages/PageFour.ets index 8beac836320594599e0cd15d6f4a576b562ea644..51ed5afbde055d5d95e7e23f0fd0d35cef1186a0 100644 --- a/ArkUIKit/Prop/entry/src/main/ets/pages/PageFour.ets +++ b/ArkUIKit/Prop/entry/src/main/ets/pages/PageFour.ets @@ -55,7 +55,6 @@ struct Index { }) } } - // [EndExclude prop_four_start] } } // [End prop_four_start] diff --git a/ArkUIKit/Prop/entry/src/main/ets/pages/PageSeventeen.ets b/ArkUIKit/Prop/entry/src/main/ets/pages/PageSeventeen.ets index 1d553502cfa66490cabc03c0ff487a5610c34282..061675d9003a18b4f453c18f4145b7a861a6b8b9 100644 --- a/ArkUIKit/Prop/entry/src/main/ets/pages/PageSeventeen.ets +++ b/ArkUIKit/Prop/entry/src/main/ets/pages/PageSeventeen.ets @@ -63,7 +63,7 @@ struct NestedDisplay { // [Start prop_seventeen_start] this.title.value = 'Hi'; // 第一层属性变化,UI 会更新 // [End prop_seventeen_start] - }); + }) // 按钮2:修改第二层属性(@Prop 观察不到,UI 不更新) Button('change title.info.value to "ArkUI"') @@ -71,7 +71,7 @@ struct NestedDisplay { // [Start prop_seventeen_start] this.title.info.value = 'ArkUI'; // 第二层属性变化,@Prop 无反应 // [End prop_seventeen_start] - }); + }) // 按钮3:重新赋值整个 Model(强制更新所有属性) Button('Reassign Model') @@ -81,7 +81,7 @@ struct NestedDisplay { this.title.value, new Info(this.title.info.value) ); - }); + }) } .margin({ top: 20 }); } @@ -107,7 +107,7 @@ struct Test { .width('100%') .height('100%') .justifyContent(FlexAlign.Start) - .padding(15); + .padding(15) } } diff --git a/ArkUIKit/Prop/entry/src/main/ets/pages/PageSixteen.ets b/ArkUIKit/Prop/entry/src/main/ets/pages/PageSixteen.ets index 295edbf439c9b17ac4b7b19a678e9ba63a8b41a8..bd5b01119465d9f79cbadac43ca2bcef8f48b9ba 100644 --- a/ArkUIKit/Prop/entry/src/main/ets/pages/PageSixteen.ets +++ b/ArkUIKit/Prop/entry/src/main/ets/pages/PageSixteen.ets @@ -36,12 +36,12 @@ struct DisplayComponent { // 显示简单类型 count Text(`简单类型 count 的值:${this.count}`) .fontSize(18) - .margin(5); + .margin(5) // 显示复杂类型 title 的值 Text(`复杂类型 title 的值:${this.title.value}`) .fontSize(18) - .margin(5); + .margin(5) // 按钮:触发数据赋值变化(验证@Prop的观察能力) Column({ space: 10 }) { @@ -50,18 +50,18 @@ struct DisplayComponent { // [StartExclude prop_sixteen_start] this.count = 1; // 简单类型赋值变化,UI会更新 // [EndExclude prop_sixteen_start] - }); + }) Button('change title to "Hi"') .onClick(() => { // [StartExclude prop_sixteen_start] this.title = new Model('Hi'); // 复杂类型赋值新对象,UI会更新 // [EndExclude prop_sixteen_start] - }); + }) } - .margin({ top: 20 }); + .margin({ top: 20 }) } - .padding(30); + .padding(30) } } @@ -83,7 +83,7 @@ struct TestPro { .width('100%') .height('100%') .justifyContent(FlexAlign.Start) - .padding(15); + .padding(15) } } diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Card.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Card.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d635fdaa6f8ef4b0bf47d3fe19977fd30dc00d1 --- /dev/null +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Card.ets @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2025 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. + */ + +@Component +export struct CompletedRoutableCard { + @Prop + symbol: Resource = $r('sys.symbol.label'); + @Prop + @Require + title: string; + @Prop + @Require + description: ResourceStr; + + build() { + Card({ verticalAlign: VerticalAlign.Top }) { + Button({ type: ButtonType.Circle }) { + SymbolGlyph(this.symbol) + .fontColor(['#fff']) + .fontSize(16) + } + .borderRadius(14) + + Column({ space: 8 }) { + Text(this.title) + .fontColor($r('sys.color.font_primary')) + + Text(this.description) + .fontColor($r('sys.color.font_secondary')) + .fontSize($r('sys.float.Body_S')) + } + .alignItems(HorizontalAlign.Start) + .layoutWeight(1) + } + } +} + +@Component +export struct Card { + @Prop + verticalAlign: VerticalAlign = VerticalAlign.Center; + @BuilderParam + content: () => void; + + build() { + Row({ space: 12 }) { + this.content() + } + .alignItems(this.verticalAlign) + .backgroundColor('#fff') + .borderRadius(12) + .padding(12) + .width('100%') + } +} + +@Component +export struct RoutableCard { + @Prop + icon: Resource = $r('sys.symbol.label'); + @Prop + @Require + title: ResourceStr; + + build() { + Card() { + Button({ type: ButtonType.Circle }) { + SymbolGlyph(this.icon) + .fontColor(['#fff']) + .fontSize(16) + } + .borderRadius(14) + + Text(this.title) + .fontColor($r('sys.color.font_primary')) + .minFontSize(12) + .maxFontSize(16) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .layoutWeight(1) + + Blank() + + Button({ type: ButtonType.Normal, buttonStyle: ButtonStyleMode.TEXTUAL }) { + SymbolGlyph($r('sys.symbol.chevron_right')) + .fontSize(18) + .fontColor([$r('sys.color.font_secondary')]) + } + } + } +} + +@Component +export struct ComponentCard { + @Prop + @Require + title: ResourceStr; + @BuilderParam content: () => void; + @Prop + description?: ResourceStr; + + build() { + Column({ space: 8 }) { + Text(this.title) + .fontSize(14) + .fontColor('#666') + Row({ space: 12}) { + this.content(); + } + if (this.description) { + Text(this.description) + .backgroundColor('#eee') + .borderRadius(4) + .padding(4) + .fontSize(12) + .fontColor('#999') + .width('100%') + } + } + .alignItems(HorizontalAlign.Start) + .backgroundColor('#fff') + .borderRadius(12) + .padding(12) + .width('100%') + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Resource.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Resource.ets new file mode 100644 index 0000000000000000000000000000000000000000..94a397a7a917f26760136ea338c14553d10e4f17 --- /dev/null +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Resource.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 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. + */ +export class ResourceManager { + public context: Context | null = null; + + // 初始化上下文 + initContext(context: Context) { + this.context = context; + } + + public resourceToString(resource: Resource): string { + try { + return this.context?.resourceManager.getStringSync(resource.id) || ''; + } catch (error) { + // TODO: Implement error handling. + return '' + } + } +} + +// 默认导出let +let resourceToStringManager = new ResourceManager(); + +export default resourceToStringManager as ResourceManager; \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Route.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Route.ets new file mode 100644 index 0000000000000000000000000000000000000000..da3d2cc3284d5cba7d3b667a3c1c61f5c6b5a9dc --- /dev/null +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/common/Route.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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. + */ + +export interface Route { + title: string ; + name: string; + items?: Route[]; + description?: ResourceStr; +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/entryability/EntryAbility.ets index 98182799de1294d4c21194646a0c30eff08aea33..3f727b590dd62aa4a3b7ac0a7970982dd603e259 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/entryability/EntryAbility.ets @@ -15,13 +15,14 @@ import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; - +import resource from '../common/Resource'; const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + resource.initContext(this.context) } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); } diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/BuilderNode.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/BuilderNode.ets index f4f0073ec4ca13c7656ba8a9a7b5b3fa77d3a61e..668e57ab6992b11f62f1036339e75a4b774b54f8 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/BuilderNode.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/BuilderNode.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -// [End Builder_Node] +// [Start Builder_Node] import { BuilderNode, FrameNode, NodeController } from '@kit.ArkUI'; @Builder @@ -40,7 +40,7 @@ class TextNodeController extends NodeController { if (globalBuilderNode === null && this.uiContext) { globalBuilderNode = new BuilderNode(this.uiContext); // 构建BuilderNode,TestRemove作为子组件 - globalBuilderNode.build(wrapBuilder<[]>(buildText), undefined, {enableProvideConsumeCrossing: true}); + globalBuilderNode.build(wrapBuilder<[]>(buildText), undefined, { enableProvideConsumeCrossing: true }); } if (this.rootNode && globalBuilderNode) { this.rootNode.appendChild(globalBuilderNode.getFrameNode()); @@ -62,15 +62,18 @@ class TextNodeController extends NodeController { @Entry @ComponentV2 -export struct Parent { +struct RemoChildDisconnectProvider { @Provider() content: string = 'Index: hello world'; - @Monitor('content') providerWatch() { + + @Monitor('content') + providerWatch() { console.info(`Provider change ${this.content}`); } + controllerIndex: TextNodeController = new TextNodeController(); build() { - Column({space: 8}) { + Column({ space: 8 }) { Text(`Provider: ${this.content}`) // 添加BuilderNode,@Consumer与@Provider建立双向同步 @@ -106,7 +109,9 @@ export struct Parent { @ComponentV2 struct TestRemove { @Consumer() content: string = 'default value'; - @Monitor('content') consumerWatch() { + + @Monitor('content') + consumerWatch() { console.info(`Consumer change ${this.content}`); } @@ -126,4 +131,18 @@ struct TestRemove { } } } -// [End Builder_Node] \ No newline at end of file +// [End Builder_Node] + +@Component +export struct BuilderNodeDemo { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + RemoChildDisconnectProvider() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Builder_Node')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeArray.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeArray.ets index 395437e06a0bbdb328b1837ea1bffc51103447af..e0f95787c1d36edaa81c26c626906ca6246ce882 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeArray.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeArray.ets @@ -16,8 +16,8 @@ // [Start Decorative_Array] @Entry @ComponentV2 -export struct Parent { - @Provider() count: number[] = [1,2,3]; +struct Parent { + @Provider() count: number[] = [1, 2, 3]; build() { Row() { @@ -45,7 +45,7 @@ export struct Parent { @ComponentV2 struct Child { - @Consumer() count: number[] = [9,8,7]; + @Consumer() count: number[] = [9, 8, 7]; build() { Column() { @@ -66,4 +66,18 @@ struct Child { .width('100%') } } -// [End Decorative_Array] \ No newline at end of file +// [End Decorative_Array] + +@Component +export struct DecorativeArray { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Array')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeComplex.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeComplex.ets index 4ff62a63c8c46617561bc0e378d0f4f6b235e7fa..bfb0af6f450e11f76d9d2cab8fc4216bfba60ca0 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeComplex.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeComplex.ets @@ -27,7 +27,7 @@ class User { const data: User[] = [new User('Json', 10), new User('Eric', 15)]; @Entry @ComponentV2 -export struct Parent { +struct Parent { @Provider('data') users: User[] = data; build() { @@ -65,4 +65,18 @@ struct Child { } } } -// [End Decorative_Complex] \ No newline at end of file +// [End Decorative_Complex] + +@Component +export struct DecorativeComplex { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Complex')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeDate.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeDate.ets index a22bc03a61b572269bbcc30cc79adc0ced9f105e..2d803921f43af0c01e02ec5972af566167d961b1 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeDate.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeDate.ets @@ -16,7 +16,7 @@ // [Start Decorative_Date] @Entry @ComponentV2 -export struct Parent { +struct Parent { @Provider() selectedDate: Date = new Date('2021-08-08'); build() { @@ -42,6 +42,7 @@ export struct Parent { } } } + @ComponentV2 struct Child { @Consumer() selectedDate: Date = new Date('2022-07-07'); @@ -68,4 +69,18 @@ struct Child { } } } -// [End Decorative_Date] \ No newline at end of file +// [End Decorative_Date] + +@Component +export struct DecorativeDate { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Date')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeInitialized.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeInitialized.ets index b4c36e0bc8ecdb09db8dab61d0921947af1c2b63..3e07070bf788ab75e11e59c22554f8fdc38ed0b6 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeInitialized.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeInitialized.ets @@ -39,13 +39,13 @@ struct Parent { this.val++; }) Text(`Parent @Param val2: ${this.val2}`).fontSize(30) - Child ({ val: this.val }) + Child({ val: this.val }) }.border({ width: 2, color: Color.Green }) } } @ComponentV2 -export struct Child { +struct Child { @Require @Param val: number; build() { @@ -54,4 +54,18 @@ export struct Child { }.border({ width: 2, color: Color.Pink }) } } -// [End Decorative_Initialized] \ No newline at end of file +// [End Decorative_Initialized] + +@Component +export struct DecorativeInitialized { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Index() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Initialized')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeMap.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeMap.ets index 9adf14035613f895eb50465ee6e58162bf51c1ed..9b599fd7ccb5ede1aaa1f09cdcb4a06bd5bf4535 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeMap.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeMap.ets @@ -16,7 +16,7 @@ // [Start Decorative_Map] @Entry @ComponentV2 -export struct Parent { +struct Parent { @Provider() message: Map = new Map([[0, 'a'], [1, 'b'], [3, 'c']]); build() { @@ -46,6 +46,7 @@ export struct Parent { } } } + @ComponentV2 struct Child { @Consumer() message: Map = new Map([[0, 'd'], [1, 'e'], [3, 'f']]); @@ -76,4 +77,18 @@ struct Child { } } } -// [End Decorative_Map] \ No newline at end of file +// [End Decorative_Map] + +@Component +export struct DecorativeMap { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Map')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeSet.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeSet.ets index 2f2aa4ad3c98cf848b3f0a5a6b1bb75635b8de8e..710ca0ab0476b1533c87892e7d927b51539f25f1 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeSet.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DecorativeSet.ets @@ -42,6 +42,7 @@ export struct Parent { } } } + @ComponentV2 struct Child { @Consumer() message: Set = new Set([1, 2, 3, 4, 5, 6]); @@ -68,4 +69,18 @@ struct Child { } } } -// [End Decorative_Set] \ No newline at end of file +// [End Decorative_Set] + +@Component +export struct DecorativeSet { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Decorative_Set')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DragDrop.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DragDrop.ets index 52067fca6c284deb0dbbbb4e48f9f672e9cb3225..c8ccf7e2a93d77318670e90bab8b0daa004d4690 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DragDrop.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/DragDrop.ets @@ -35,7 +35,8 @@ struct Parent { @ComponentV2 struct Child { - @Consumer() onDrag: (x: number, y: number) => void = (x: number, y: number) => {}; + @Consumer() onDrag: (x: number, y: number) => void = (x: number, y: number) => { + }; build() { Button('changed') @@ -46,4 +47,19 @@ struct Child { }) } } -// [End Drag_Drop] \ No newline at end of file + +// [End Drag_Drop] + +@Component +export struct DragDrop { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Drag_Drop')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/NoTwowayBinding.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/NoTwowayBinding.ets index e63aba198a6c1519240f0099e603f9d5cfcdf451..68b45c289238ae31840479bddf7a0f3c5de92908 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/NoTwowayBinding.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/NoTwowayBinding.ets @@ -16,7 +16,7 @@ // [Start No_Twoway_Binding] @Entry @ComponentV2 -export struct Parent { +struct Parent { @Provider() str1: string = 'hello'; build() { @@ -44,4 +44,18 @@ struct Child { } } } -// [End No_Twoway_Binding] \ No newline at end of file +// [End No_Twoway_Binding] + +@Component +export struct NoTwowayBinding { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.No_Twoway_Binding')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/ProviderSame.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/ProviderSame.ets index 73abaeaf4b523e20e07ab79369d7e177b087df0f..c1af639dd879a2b0b30727378eb9f6007ecbb80d 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/ProviderSame.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/ProviderSame.ets @@ -34,13 +34,13 @@ struct Parent { build() { Column() { Text(`${this.val2}`) - Child () + Child() } } } @ComponentV2 -export struct Child { +struct Child { @Consumer() val: number = 0; // 20 build() { @@ -49,4 +49,18 @@ export struct Child { } } } -// [End Provider_Same] \ No newline at end of file +// [End Provider_Same] + +@Component +export struct ProviderSame { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Index() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Provider_Same')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/TwowayBinding.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/TwowayBinding.ets index f1ada25c98db82e8d39d5a45a82fdf78b5242754..28abb28db969cb498e33507ced19461d25b76540 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/TwowayBinding.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/homePage/TwowayBinding.ets @@ -16,7 +16,7 @@ // [Start Twoway_Binding] @Entry @ComponentV2 -export struct Parent { +struct Parent { @Provider() str: string = 'hello'; build() { @@ -44,4 +44,18 @@ struct Child { } } } -// [End Twoway_Binding] \ No newline at end of file +// [End Twoway_Binding] + +@Component +export struct TwowayBinding { + @State egLanes: LengthConstrain = { minLength: 200, maxLength: 300 }; + @Consume pathStack: NavPathStack; + + build() { + NavDestination() { + Parent() + } + .backgroundColor('#f1f2f3') + .title($r('app.string.Twoway_Binding')) + } +} \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/ets/pages/Index.ets b/ArkUIKit/ProviderConsumer/entry/src/main/ets/pages/Index.ets index c0595aa10fc0710e6f8376eaf77d6ff8f2040783..3db849a4b1ab6acee16f7c92e763b3a7d68548fd 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/ets/pages/Index.ets +++ b/ArkUIKit/ProviderConsumer/entry/src/main/ets/pages/Index.ets @@ -12,97 +12,150 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { router, Router } from '@kit.ArkUI' +import { LengthMetrics, router, Router } from '@kit.ArkUI' +import { RoutableCard } from '../common/Card'; +import resource from '../common/Resource'; +import { Route } from '../common/Route'; +import { BuilderNodeDemo } from '../homePage/BuilderNode'; +import { DecorativeArray } from '../homePage/DecorativeArray'; +import { DecorativeComplex } from '../homePage/DecorativeComplex'; +import { DecorativeDate } from '../homePage/DecorativeDate'; +import { DecorativeInitialized } from '../homePage/DecorativeInitialized'; +import { DecorativeMap } from '../homePage/DecorativeMap'; +import { DecorativeSet } from '../homePage/DecorativeSet'; +import { DragDrop } from '../homePage/DragDrop'; +import { NoTwowayBinding } from '../homePage/NoTwowayBinding'; +import { ProviderSame } from '../homePage/ProviderSame'; +import { TwowayBinding } from '../homePage/TwowayBinding'; + + +const routes: Route[] = [ + { + title: resource.resourceToString($r('app.string.Twoway_Binding')), + name: 'TwowayBinding' + }, + { + title: resource.resourceToString($r('app.string.No_Twoway_Binding')), + name: 'NoTwowayBinding' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Array')), + name: 'DecorativeArray' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Date')), + name: 'DecorativeDate' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Map')), + name: 'DecorativeMap' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Set')), + name: 'DecorativeSet' + }, + { + title: resource.resourceToString($r('app.string.Drag_Drop')), + name: 'DragDrop' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Complex')), + name: 'DecorativeComplex' + }, + { + title: resource.resourceToString($r('app.string.Provider_Same')), + name: 'ProviderSame' + }, + { + title: resource.resourceToString($r('app.string.Decorative_Initialized')), + name: 'DecorativeInitialized' + }, + { + title: resource.resourceToString($r('app.string.Builder_Node')), + name: 'BuilderNode' + } +]; + +@Builder +function destination(name: string) { + if (name === 'TwowayBinding') { + TwowayBinding(); + } else if (name === 'NoTwowayBinding'){ + NoTwowayBinding() + } else if (name === 'DecorativeArray') { + DecorativeArray(); + } else if (name === 'DecorativeDate') { + DecorativeDate(); + } else if (name === 'DecorativeMap') { + DecorativeMap(); + } else if (name === 'DecorativeSet') { + DecorativeSet(); + } else if (name === 'DragDrop') { + DragDrop(); + } else if (name === 'DecorativeComplex') { + DecorativeComplex(); + } else if (name === 'ProviderSame') { + ProviderSame(); + } else if (name === 'DecorativeInitialized') { + DecorativeInitialized(); + } else if (name === 'BuilderNode') { + BuilderNodeDemo(); + } +} @Entry @Component struct Index { -build() { - Column(){ - Column(){ - Text($r('app.string.Twoway_Binding')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/TwowayBinding'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.No_Twoway_Binding')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/NoTwowayBinding'}) - }) - Column(){ - Text($r('app.string.Decorative_Array')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeArray'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Decorative_Date')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeDate'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Decorative_Map')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeMap'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Decorative_Set')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeSet'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Drag_Drop')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DragDrop'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Decorative_Complex')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeComplex'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Provider_Same')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/ProviderSame'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Decorative_Initialized')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/DecorativeInitialized'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Code_First')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/CodeFirst'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Code_Second')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/CodeSecond'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Code_Three')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/CodeThree'}) - }).margin({top:'50'}) - Column(){ - Text($r('app.string.Builder_Node')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - this.getUIContext().getRouter().pushUrl({url:'homePage/BuilderNode'}) - }).margin({top:'50'}) - } -} + @State condition: string = ''; + @Provide pathStack: NavPathStack = new NavPathStack(); + + getFilteredRoutes(): Route[] { + if (!this.condition) { + return routes; + } + return routes.filter((route: Route) => { + return route.title.includes(this.condition); + }) + } + + @LocalBuilder + Title() { + Column() { + Search({ value: this.condition }) + .onChange(value => { + this.condition = value; + }) + .margin({ start: LengthMetrics.vp(16), end: LengthMetrics.vp(16) }) + } + .justifyContent(FlexAlign.Center) + .height('100%') + } + + build() { + Column() { + Navigation(this.pathStack) { + List({ space: 12 }) { + ForEach(this.getFilteredRoutes(), (route: Route) => { + ListItem() { + RoutableCard({ title: route.title }) + } + .width('100%') + .onClick(() => { + this.pathStack.pushPath({ name: route.name }); + }) + }) + } + .padding({ start: LengthMetrics.vp(16), end: LengthMetrics.vp(16) }) + .contentStartOffset(56) + .height('100%') + .width('100%') + } + .backgroundColor($r('sys.color.comp_background_focus')) + .title({ builder: this.Title, height: 56 }, { + backgroundBlurStyle: BlurStyle.COMPONENT_THICK, + barStyle: BarStyle.STACK + }) + .navDestination(destination) + } + } } \ No newline at end of file diff --git a/ArkUIKit/ProviderConsumer/entry/src/main/resources/base/profile/main_pages.json b/ArkUIKit/ProviderConsumer/entry/src/main/resources/base/profile/main_pages.json index ebe00470cc7f85208608bb4c3a0e8b080fa070a3..ec57f7ed2de69d0b4519be5e788bbb318c380d99 100644 --- a/ArkUIKit/ProviderConsumer/entry/src/main/resources/base/profile/main_pages.json +++ b/ArkUIKit/ProviderConsumer/entry/src/main/resources/base/profile/main_pages.json @@ -1,19 +1,6 @@ { "src": [ - "pages/Index", - "homePage/TwowayBinding", - "homePage/NoTwowayBinding", - "homePage/DecorativeArray", - "homePage/DecorativeDate", - "homePage/DecorativeMap", - "homePage/DecorativeSet", - "homePage/DragDrop", - "homePage/DecorativeComplex", - "homePage/ProviderSame", - "homePage/DecorativeInitialized", - "homePage/CodeFirst", - "homePage/CodeSecond", - "homePage/CodeThree" + "pages/Index" ] } diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/arcList/ArcListArcIndexerBar.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/arcList/ArcListArcIndexerBar.ets index 59b69a774f73861b7f66aa058b13a5ec97c067ef..6758a7e1ae9bc1a2314809ec42c50d73deaf8983 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/arcList/ArcListArcIndexerBar.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/arcList/ArcListArcIndexerBar.ets @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import { ComponentCard } from '../../common/Card'; +import { ArcAlphabetIndexer, ArcAlphabetIndexerAttribute } from '@ohos.arkui.ArcAlphabetIndexer'; +import { util } from '@kit.ArkTS'; +import { ColorMetrics, ComponentContent } from '@ohos.arkui.node'; // [Start arcAlphabetIndexer_start] import { ArcList, ArcListAttribute, ArcListItemAttribute, ArcListItem, LengthMetrics } from '@kit.ArkUI'; -import { ColorMetrics, ComponentContent } from '@ohos.arkui.node'; -import { util } from '@kit.ArkTS'; -import { ArcAlphabetIndexer, ArcAlphabetIndexerAttribute } from '@ohos.arkui.ArcAlphabetIndexer'; -import { ComponentCard } from '../../common/Card'; // [StartExclude arcAlphabetIndexer_start] class Contact { diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets index 4b33c1a7f630b156787a3ba8f3be28bdae2b4f0c..6f46754ba682acc50a22710a1a59014ba7ec8065 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets @@ -14,12 +14,13 @@ */ import { ComponentCard } from '../../common/Card'; -// [Start build_a_office_services_grid_of_foreach] import common from '@ohos.app.ability.common'; +// [Start build_a_office_services_grid_of_foreach] @Entry @Component export struct DataInGrid { @State services: Array = []; + // [StartExclude build_a_office_services_grid_of_foreach] aboutToAppear(): void { const context = this.getUIContext().getHostContext() as common.UIAbilityContext; const meeting = context.resourceManager.getStringByNameSync('Meeting') @@ -31,6 +32,8 @@ export struct DataInGrid { const printing = context.resourceManager.getStringByNameSync('Printing') this.services.push(printing) } + // [EndExclude build_a_office_services_grid_of_foreach] + build() { // [StartExclude build_a_office_services_grid_of_foreach] NavDestination() { @@ -38,7 +41,6 @@ export struct DataInGrid { Column({ space: 12 }) { // [StartExclude build_a_office_services_grid_of_foreach] ComponentCard({ title: $r('app.string.DataInGrid_titleOfficeServices') }) { - // [EndExclude build_a_office_services_grid_of_foreach] // $r('app.string.build_a_office_services_grid')需要替换为开发者所需的字符串资源 // [Start build_a_office_services_grid] // [Start build_a_office_services_meeting] @@ -70,7 +72,9 @@ export struct DataInGrid { GridItem() { // $r('app.string.Printing')需要替换为开发者所需的资源文件 Text($r('app.string.Printing')) + // [StartExclude build_a_office_services_meeting] .fontSize(24) + // [EndExclude build_a_office_services_meeting] } } // [StartExclude build_a_office_services_meeting] @@ -86,7 +90,6 @@ export struct DataInGrid { // [End build_a_office_services_grid] } - // [StartExclude build_a_office_services_grid_of_foreach] // $r('app.string.DataInGrid_titleForEach')需要替换为开发者所需的资源文件 ComponentCard({ title: $r('app.string.DataInGrid_titleForEach') }) { // [EndExclude build_a_office_services_grid_of_foreach] @@ -97,13 +100,13 @@ export struct DataInGrid { }.backgroundColor('#FFF1F3F5') }, (service: string): string => service) } + .rowsTemplate(('1fr 1fr') as string) + .columnsTemplate(('1fr 1fr') as string) // [StartExclude build_a_office_services_grid_of_foreach] .height(200) .columnsGap(6) .rowsGap(6) // [EndExclude build_a_office_services_grid_of_foreach] - .rowsTemplate(('1fr 1fr') as string) - .columnsTemplate(('1fr 1fr') as string) } } // [End build_a_office_services_grid_of_foreach] diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridCalculator.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridCalculator.ets index b44c0e5b11b18ef250f7ea040a07f1cd588328bf..1a16fc343326682cd087d2caa44fa00fa3003577 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridCalculator.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridCalculator.ets @@ -25,6 +25,17 @@ export struct GridCalculator { layoutOptions: GridLayoutOptions = { regularSize: [1, 1], onGetRectByIndex: (index: number) => { + // [StartExclude Set_numberrows_columns] + let key1: number = 16; + let key2: number = 15; + // [EndExclude Set_numberrows_columns] + + if (index == key1) { // key1是“0”按键对应的index + return [6, 0, 1, 2]; + } else if (index == key2) { // key2是“=”按键对应的index + return [5, 3, 2, 1]; + } + // [StartExclude Set_numberrows_columns] if (index == 0) { return [2, 0, 1, 1]; } else if (index == 1) { @@ -55,14 +66,12 @@ export struct GridCalculator { return [5, 1, 1, 1]; } else if (index == 14) { return [5, 2, 1, 1]; - } else if (index == 15) { - return [5, 3, 2, 1]; - } else if (index == 16) { - return [6, 0, 1, 2]; } else if (index == 17) { return [6, 2, 1, 1]; } + // [EndExclude Set_numberrows_columns] return [0, 0, 2, 4]; + // 这里需要根据具体布局返回其他item的位置 } } // [StartExclude Set_numberrows_columns] @@ -94,13 +103,12 @@ export struct GridCalculator { } .columnsTemplate('1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr') - // [StartExclude Set_numberrows_columns] + // [End Set_numberrows_columns] + .rowsGap(8) .columnsGap(5) .width('100%') .height('80%') - // [EndExclude Set_numberrows_columns] - // [End Set_numberrows_columns] } } } diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridLayout.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridLayout.ets index 464b10d7282f3dc3b451609145686325b01240cf..e79217b31ccf9bd2d7fa15beb494e5e7796b77f1 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridLayout.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridLayout.ets @@ -69,13 +69,13 @@ export struct GridLayout { }.backgroundColor('#ffe0e2e4') // [EndExclude build_a_grid] } - //设置行列间距 // [StartExclude build_a_grid] + //设置行列间距 .columnsGap(10) .rowsGap(15) .height(150) - // [EndExclude build_a_grid] //设置行列数量与占比 + // [EndExclude build_a_grid] .rowsTemplate('1fr 1fr 1fr') .columnsTemplate('1fr 2fr 1fr') // [End build_a_grid] @@ -145,13 +145,10 @@ export struct GridLayout { // [EndExclude Set_the_direction_of_the_main_axis_of_the_grid] } .maxCount(3) - // [StartExclude Set_the_direction_of_the_main_axis_of_the_grid] - .columnsGap(4) - .rowsGap(4) - // [EndExclude Set_the_direction_of_the_main_axis_of_the_grid] .layoutDirection(GridDirection.Row) // [End Set_the_direction_of_the_main_axis_of_the_grid] - + .columnsGap(4) + .rowsGap(4) Grid() { GridItem() { Text('1') diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridScrollbar.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridScrollbar.ets index 46a91a71913300ac634495f5a6c5585982c68ce5..2ce320f715e4814ed030fa653770b8de85300f4f 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridScrollbar.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridScrollbar.ets @@ -20,9 +20,10 @@ import { ComponentCard } from '../../common/Card'; @Component export struct GridScrollbar { numbers: GridDataSource = new GridDataSource([]); - // [Start Add_external_scrollbar] - scroller: Scroller = new Scroller(); - // [StartExclude Add_external_scrollbar] + // [Start Add_external_scrollbar_gridScroller] + private gridScroller: Scroller = new Scroller(); + // [End Add_external_scrollbar_gridScroller] + @State gridPosition: number = 0; //0代表滚动到grid顶部,1代表中间值,2代表滚动到grid底部。 aboutToAppear() { @@ -34,17 +35,16 @@ export struct GridScrollbar { } this.numbers = new GridDataSource(list); } - // [EndExclude Add_external_scrollbar] build() { - // [StartExclude Add_external_scrollbar] NavDestination() { Column({ space: 12 }) { // $r('app.string.GridScrollbar_title')需要替换为开发者所需的资源文件 ComponentCard({ title: $r('app.string.GridScrollbar_title') }) { Row({ space: 5 }) { - // [EndExclude Add_external_scrollbar] - Grid(this.scroller) { - // [StartExclude Add_external_scrollbar] + // [Start Add_external_scrollbar1] + // gridScroller初始化Grid组件的scroller参数,绑定gridScroller与网格。 + Grid( this.gridScroller) { + // [StartExclude Add_external_scrollbar1] LazyForEach(this.numbers, (day: string) => { GridItem() { Text() @@ -55,9 +55,9 @@ export struct GridScrollbar { .textAlign(TextAlign.Center) } }, (index: number) => index.toString()) - // [EndExclude Add_external_scrollbar] + // [EndExclude Add_external_scrollbar1] } - // [StartExclude Add_external_scrollbar] + // [End Add_external_scrollbar1] .columnsTemplate('1fr 1fr 1fr 1fr 1fr') .columnsGap(10) .rowsGap(10) @@ -73,10 +73,11 @@ export struct GridScrollbar { .backgroundColor(0xFAEEE0) .height(300) .margin({left:10}) - // [EndExclude Add_external_scrollbar] - ScrollBar({ scroller: this.scroller }).height(300) - // [End Add_external_scrollbar] - // [StartExclude Add_external_scrollbar] + // [Start Add_external_scrollbar2] + // gridScroller初始化ScrollBar组件的scroller参数,绑定gridScroller与滚动条。 + ScrollBar({ scroller: this.gridScroller }) + // [End Add_external_scrollbar2] + .height(300) }.width('100%').margin({ top: 5 }) } } @@ -84,7 +85,6 @@ export struct GridScrollbar { .height('100%') .padding({ left: 12, right: 12 }) } - // [EndExclude Add_external_scrollbar] .backgroundColor('#f1f2f3') .title($r('app.string.GridScrollbar_title')) } diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridSideToSide.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridSideToSide.ets index 0b8f7016cc453cfb6a835116c4a497c4cb1dfba4..faea315aac0bf29a4a2d232a5f20c3c71756cb92 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridSideToSide.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/GridSideToSide.ets @@ -40,7 +40,7 @@ export struct GridSideToSide { build() { NavDestination() { - Column({ space: 12 }) { + Column({ space: 5 }) { // $r('app.string.GridSideToSide_title')需要替换为开发者所需的资源文件 ComponentCard({ title: $r('app.string.GridSideToSide_title') }) { // [Start Control_scrolling_position] diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/LongGrid.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/LongGrid.ets index ac5c3b462f1d358fae6b563141315ef28976c253..8a52facc6dc6112b97f8e13c2f0b638c0276027a 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/LongGrid.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/LongGrid.ets @@ -39,22 +39,11 @@ export struct LongGrid { ComponentCard({ title: $r('app.string.LongGrid_title') }) { Column({ space: 5 }) { // [Start long_list] - Grid(this.scroller) { - LazyForEach(this.numbers, (day: string) => { + Grid() { + LazyForEach(this.numbers, () => { GridItem() { - // [StartExclude long_list] - Text(day) - .fontSize(16) - .backgroundColor(0xF9CF93) - .width('100%') - .height(80) - .textAlign(TextAlign.Center) - // [EndExclude long_list] } - } - // [StartExclude long_list] - , (index: number) => index.toString()) - // [EndExclude long_list] + }) } .cachedCount(3) // [End long_list] diff --git a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets index f15991d1ecb04e62593fc1e510496ffe72445015..914568c338bb9cbaa624ab15db62090058b9c5f9 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets @@ -14,12 +14,13 @@ */ import { ComponentCard } from '../../common/Card'; -// [Start build_scrollable_horizontally_grid_layouts] import common from '@ohos.app.ability.common'; +// [Start build_scrollable_horizontally_grid_layouts] @Entry @Component export struct ScrollableGrid { @State services: Array = []; + // [StartExclude build_scrollable_horizontally_grid_layouts] aboutToAppear(): void { const context = this.getUIContext().getHostContext() as common.UIAbilityContext; const streaming = context.resourceManager.getStringByNameSync('Live_Streaming') @@ -43,39 +44,42 @@ export struct ScrollableGrid { const more = context.resourceManager.getStringByNameSync('More') this.services.push(more) } + // [EndExclude build_scrollable_horizontally_grid_layouts] build() { // [StartExclude build_scrollable_horizontally_grid_layouts] NavDestination() { // [EndExclude build_scrollable_horizontally_grid_layouts] - Column({ space: 12 }) { + + Column({ space: 5 }) { // [StartExclude build_scrollable_horizontally_grid_layouts] ComponentCard({ title: $r('app.string.ScrollableGrid_titleHorizontal') }) { // [EndExclude build_scrollable_horizontally_grid_layouts] + Grid() { - ForEach(this.services, (service: string) => { + ForEach(this.services, (service: string, index) => { GridItem() { - Text(service) - }.backgroundColor('#FFF1F3F5').width('25%') + } + .width('25%') }, (service: string): string => service) } + .rowsTemplate('1fr 1fr') // 只设置rowsTemplate属性,当内容超出Grid区域时,可水平滚动。 + .rowsGap(15) + // [StartExclude build_scrollable_horizontally_grid_layouts] .height(200) .columnsGap(10) // [EndExclude build_scrollable_horizontally_grid_layouts] - .rowsGap(15) - .rowsTemplate('1fr 1fr') // 只设置rowsTemplate属性,当内容超出Grid区域时,可水平滚动。 - // [StartExclude build_scrollable_horizontally_grid_layouts] } - // [EndExclude build_scrollable_horizontally_grid_layouts] } + // [StartExclude build_scrollable_horizontally_grid_layouts] .width('100%') .height('100%') .padding({ left: 12, right: 12 }) - // [StartExclude build_scrollable_horizontally_grid_layouts] + } .backgroundColor('#f1f2f3') .title($r('app.string.ScrollableGrid_title')) - // [EndExclude build_scrollable_horizontally_grid_layouts] } + // [EndExclude build_scrollable_horizontally_grid_layouts] } // [End build_scrollable_horizontally_grid_layouts] \ No newline at end of file diff --git a/ArkUIKit/ScrollableComponent/entry/src/ohosTest/ets/test/index.test.ets b/ArkUIKit/ScrollableComponent/entry/src/ohosTest/ets/test/index.test.ets index 02b0c35fb8ee153405893538577ad5dd6bfdcfb6..30141ae346437e2698af2202909f58cc60108f5d 100644 --- a/ArkUIKit/ScrollableComponent/entry/src/ohosTest/ets/test/index.test.ets +++ b/ArkUIKit/ScrollableComponent/entry/src/ohosTest/ets/test/index.test.ets @@ -1144,11 +1144,11 @@ export default function IndexTest() { }) /** - * @tc.number UiTest_51 - * @tc.name testBottomTabBar - * @tc.desc 内容标签不同步 + * @tc.number UiTest_051 + * @tc.name testSyncTabContentAndTitle + * @tc.desc 测试内容标签不同步 */ - it('testBottomTabBar', 0, async (done: Function) => { + it('testSyncTabContentAndTitle', 0, async (done: Function) => { let driver = Driver.create(); let componentButton = await driver.findComponent(ON.text('Tabs', MatchPattern.CONTAINS)); expect(componentButton === null).assertFalse(); @@ -1168,11 +1168,11 @@ export default function IndexTest() { }) /** - * @tc.number UiTest_51 - * @tc.name testBottomTabBar - * @tc.desc 缓存数 + * @tc.number UiTest_052 + * @tc.name testTabCacheCount + * @tc.desc 测试Tab组件缓存数量 */ - it('testBottomTabBar', 0, async (done: Function) => { + it('testCacheCount', 0, async (done: Function) => { let driver = Driver.create(); let componentButton = await driver.findComponent(ON.text('Tabs', MatchPattern.CONTAINS)); expect(componentButton === null).assertFalse(); diff --git a/ArkUIKit/ShapeDrawing/entry/src/main/ets/pages/ViewPort1.ets b/ArkUIKit/ShapeDrawing/entry/src/main/ets/pages/ViewPort1.ets index 026209e94ee124d97a78777a47536e211da56b22..8ed54905d14854c20aadd63dea91c4949ced8156 100644 --- a/ArkUIKit/ShapeDrawing/entry/src/main/ets/pages/ViewPort1.ets +++ b/ArkUIKit/ShapeDrawing/entry/src/main/ets/pages/ViewPort1.ets @@ -37,7 +37,8 @@ struct ViewPort1 { build() { Column() { // 画一个宽高都为75的圆 - Text('Original Size Circle') + // $r('app.string.OriginalSizeCircle')需要替换为开发者所需的资源文件 + Text($r('app.string.OriginalSizeCircle')) Circle({ width: 75, height: 75 }).fill('#E87361') Row({ space: 10 }) { @@ -45,7 +46,8 @@ struct ViewPort1 { // 创建一个宽高都为150的shape组件,背景色为黄色,一个宽高都为75的viewPort。 // 用一个蓝色的矩形来填充viewPort,在viewPort中绘制一个直径为75的圆。 // 绘制结束,viewPort会根据组件宽高放大两倍。 - Text('Enlarged Circle') + // $r('app.string.EnlargedCircle')需要替换为开发者所需的资源文件 + Text($r('app.string.EnlargedCircle')) Shape() { Rect().width('100%').height('100%').fill('#0097D4') Circle({ width: 75, height: 75 }).fill('#E87361') @@ -60,7 +62,8 @@ struct ViewPort1 { // 创建一个宽高都为150的shape组件,背景色为黄色,一个宽高都为300的viewPort。 // 用一个绿色的矩形来填充viewPort,在viewPort中绘制一个直径为75的圆。 // 绘制结束,viewPort会根据组件宽高缩小两倍。 - Text('Shrunk Circle') + // $r('app.string.ShrunkCircle')需要替换为开发者所需的资源文件 + Text($r('app.string.ShrunkCircle')) Shape() { Rect().width('100%').height('100%').fill('#BDDB69') Circle({width: 75, height: 75}).fill('#E87361') diff --git a/ArkUIKit/ShapeDrawing/entry/src/main/resources/base/element/string.json b/ArkUIKit/ShapeDrawing/entry/src/main/resources/base/element/string.json index fd299280e70719a7faebeb64b31bca5ca7b55876..295c5ecc8d4928640f41a5698362e60e54780248 100644 --- a/ArkUIKit/ShapeDrawing/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/ShapeDrawing/entry/src/main/resources/base/element/string.json @@ -11,6 +11,18 @@ { "name": "EntryAbility_label", "value": "shapedrawing" + }, + { + "name": "OriginalSizeCircle", + "value": "原始尺寸Circle组件" + }, + { + "name": "EnlargedCircle", + "value": "shape内放大的Circle组件" + }, + { + "name": "ShrunkCircle", + "value": "Shape内缩小的Circle组件" } ] } \ No newline at end of file diff --git a/ArkUIKit/TextComponent/entry/build-profile.json5 b/ArkUIKit/TextComponent/entry/build-profile.json5 index 48a79133bba1361549b5b101c1e7c184d136654d..8bbe548ca77166375df1b97f53c10c7b4b7e46ad 100644 --- a/ArkUIKit/TextComponent/entry/build-profile.json5 +++ b/ArkUIKit/TextComponent/entry/build-profile.json5 @@ -22,6 +22,7 @@ "cppFlags": "", "abiFilters": [ "x86_64", + "armeabi-v7a", "arm64-v8a" ] } diff --git a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/CreateApply.ets b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/CreateApply.ets index b4df36b2e3b4d616b1c3a65ee8a51f4dbf3477e9..31a690d4b17a80fd9325ba5768ba3ceafedd6032 100644 --- a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/CreateApply.ets +++ b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/CreateApply.ets @@ -18,8 +18,10 @@ import resource from '../../common/resource'; @Entry @Component struct styled_string_demo1 { - styledString1: StyledString = new StyledString(resource.resourceToString($r('app.string.CreateApply_Text_1'))); - mutableStyledString1: MutableStyledString = new MutableStyledString(resource.resourceToString($r('app.string.CreateApply_Text_2'))); + //'app.string.CreateApply_Text_Forty_Five'资源文件中的value值为"运动45分钟" + styledString1: StyledString = new StyledString(resource.resourceToString($r('app.string.CreateApply_Text_Forty_Five'))); + //'app.string.CreateApply_Text_Third_Five'资源文件中的value值为"运动35分钟" + mutableStyledString1: MutableStyledString = new MutableStyledString(resource.resourceToString($r('app.string.CreateApply_Text_Third_Five'))); controller1: TextController = new TextController(); controller2: TextController = new TextController(); diff --git a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringBaselineOffsetStyle.ets b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringBaselineOffsetStyle.ets index 9542c93c2e68c63e2041539a73355b8def94b569..af51b66733b2979bfce46631f42782a139b884ae 100644 --- a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringBaselineOffsetStyle.ets +++ b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringBaselineOffsetStyle.ets @@ -20,7 +20,7 @@ import { LengthMetrics } from '@kit.ArkUI'; @Component struct styled_string_demo5 { @State str: string = - this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_2')) as string; + this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_Third_Five')) as string; mutableStyledString: MutableStyledString = new MutableStyledString(this.str, [ { start: 0, diff --git a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringDecorationStyle.ets b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringDecorationStyle.ets index a63d3351846385ff3da9917911e45a39e28ab504..9793fb137199f0a8c31eabf0d1ec769185804c99 100644 --- a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringDecorationStyle.ets +++ b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringDecorationStyle.ets @@ -18,7 +18,8 @@ @Component struct styled_string_demo4 { @State str: string = - this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_2')) as string; + this.getUIContext() + .getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_Third_Five')) as string; mutableStyledString: MutableStyledString = new MutableStyledString(this.str, [ { start: 0, diff --git a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringLetterSpacingStyle.ets b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringLetterSpacingStyle.ets index 38beb15cfe0a30bf3ef2f3f94a9db0f5c89f671d..c632366b2ace2a4e9f2d2f1b37de6fbea0a9e367 100644 --- a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringLetterSpacingStyle.ets +++ b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringLetterSpacingStyle.ets @@ -20,7 +20,7 @@ import { LengthMetrics, LengthUnit } from '@kit.ArkUI'; @Component struct styled_string_demo7 { @State str: string = - this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_2')) as string; + this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_Third_Five')) as string; mutableStyledString: MutableStyledString = new MutableStyledString(this.str, [ { start: 0, diff --git a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringTextShadowStyle.ets b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringTextShadowStyle.ets index 1cf0c1400dda462e9d4edbbfbab2ec7044aaad2a..7770192a68c4f2098cb69860a3c00b4bc6994f3f 100644 --- a/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringTextShadowStyle.ets +++ b/ArkUIKit/TextComponent/entry/src/main/ets/pages/propertyString/StyledStringTextShadowStyle.ets @@ -18,7 +18,7 @@ @Component struct styled_string_demo3 { @State str: string = - this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_2')) as string; + this.getUIContext().getHostContext()?.resourceManager.getStringSync($r('app.string.CreateApply_Text_Third_Five')) as string; mutableStyledString: MutableStyledString = new MutableStyledString(this.str, [ { start: 0, diff --git a/ArkUIKit/TextComponent/entry/src/main/resources/base/element/string.json b/ArkUIKit/TextComponent/entry/src/main/resources/base/element/string.json index 66537aee0c105ee3c57e498f09e273bc3faa78ed..9f4febdf8468894dcea779507cce155750234252 100644 --- a/ArkUIKit/TextComponent/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/TextComponent/entry/src/main/resources/base/element/string.json @@ -1209,11 +1209,11 @@ "value": "Sign in" }, { - "name": "CreateApply_Text_1", + "name": "CreateApply_Text_Forty_Five", "value": "运动45分钟" }, { - "name": "CreateApply_Text_2", + "name": "CreateApply_Text_Third_Five", "value": "运动35分钟" }, { diff --git a/ArkUIKit/TextComponent/entry/src/ohosTest/ets/test/index1.test.ets b/ArkUIKit/TextComponent/entry/src/ohosTest/ets/test/index1.test.ets index c16cdae2ca62f11eee610848435e3f10fac98a5a..cc0eafe7e4864400ba2e77c5249def82f182e814 100644 --- a/ArkUIKit/TextComponent/entry/src/ohosTest/ets/test/index1.test.ets +++ b/ArkUIKit/TextComponent/entry/src/ohosTest/ets/test/index1.test.ets @@ -66,10 +66,10 @@ export default function IndexTest1() { expect(sampleButton === null).assertFalse(); await sampleButton.click(); - str = await getResourceString($r('app.string.CreateApply_Text_1')); + str = await getResourceString($r('app.string.CreateApply_Text_Forty_Five')); let styledString = await driver.findComponent(ON.text(str)); expect(styledString === null).assertFalse(); - str = await getResourceString($r('app.string.CreateApply_Text_2')); + str = await getResourceString($r('app.string.CreateApply_Text_Third_Five')); let mutableStyledString = await driver.findComponent(ON.text(str)); expect(mutableStyledString === null).assertFalse(); diff --git a/ArkUIKit/ThemeSkinning/entry/src/main/ets/pages/Theme2/Theme2.ets b/ArkUIKit/ThemeSkinning/entry/src/main/ets/pages/Theme2/Theme2.ets index ab0404fd4e6b50623da2ce7ae1a85216b0c59a3d..8dd472cff1f82420b53de0616afb20ff3ca97613 100644 --- a/ArkUIKit/ThemeSkinning/entry/src/main/ets/pages/Theme2/Theme2.ets +++ b/ArkUIKit/ThemeSkinning/entry/src/main/ets/pages/Theme2/Theme2.ets @@ -38,7 +38,9 @@ class AppThemeSec implements CustomTheme { @Component struct DisplayPage1 { @State customTheme: CustomTheme = new AppTheme(); - @State message: string = 'Set a custom theme style for specific pages'; + // $r('app.string.SetCustomThemeStyle')需要替换为开发者所需的资源文件 + @State message: string = + this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.SetCustomThemeStyle')); count = 0; build() { diff --git a/ArkUIKit/ThemeSkinning/entry/src/main/resources/base/element/string.json b/ArkUIKit/ThemeSkinning/entry/src/main/resources/base/element/string.json index 47ecd470cdf147a154dbeda5c7f1ae0d4a3208a8..a8bdfb0f0cfce9483964de45ac5af95572ebce64 100644 --- a/ArkUIKit/ThemeSkinning/entry/src/main/resources/base/element/string.json +++ b/ArkUIKit/ThemeSkinning/entry/src/main/resources/base/element/string.json @@ -35,6 +35,10 @@ { "name": "Theme3_label1", "value": "ThemeCustomTamplateThree" + }, + { + "name": "SetCustomThemeStyle", + "value": "设置应用局部页面自定义主题风格" } ] } \ No newline at end of file diff --git a/ArkUIKit/UIContext/entry/src/main/ets/Common/ContextUtils.ets b/ArkUIKit/UIContext/entry/src/main/ets/Common/ContextUtils.ets index fd17cd0fdee8f6e329f17dc5eaa9802b73bf78b3..6c466d65f0bf0520ffd23d2949740f63814557c6 100644 --- a/ArkUIKit/UIContext/entry/src/main/ets/Common/ContextUtils.ets +++ b/ArkUIKit/UIContext/entry/src/main/ets/Common/ContextUtils.ets @@ -28,5 +28,4 @@ export class ContextUtils { return ContextUtils.context; } } - // [End Common_ContextUtils] \ No newline at end of file diff --git a/ArkUIKit/UIContext/entry/src/main/ets/entryability/EntryAbility.ets b/ArkUIKit/UIContext/entry/src/main/ets/entryability/EntryAbility.ets index 1e1f020a1e7d4c9cc3d4ca4196ce50554f397723..1a9e07380ae330e06de88758731996c9378ea898 100644 --- a/ArkUIKit/UIContext/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ArkUIKit/UIContext/entry/src/main/ets/entryability/EntryAbility.ets @@ -60,17 +60,21 @@ export default class EntryAbility extends UIAbility { hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); let localStorage = new LocalStorage(); localStorage.setOrCreate('message', 'Message from Storage') + // [StartExclude Common_LocalStorage] hilog.info(DOMAIN, 'testTag', '%{public}s', 'success localStorage'); let window = windowStage.getMainWindowSync(); // 注册主窗的回调。 WindowUIContextUtils.registerWindowCallback(window); // 在loadContent前调用getUIContext时,UI实例未创建,存在异常。 + // [EndExclude Common_LocalStorage] windowStage.loadContent('pages/Index', localStorage, (err) => { // 需要在loadContent完成后获取UIContext。 if (err.code) { hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); return; } + hilog.info(DOMAIN, 'testTag', `loadContent success.`); + // [StartExclude Common_LocalStorage] // 需要在回调中调用。 try { let uiContext = window.getUIContext(); @@ -87,7 +91,7 @@ export default class EntryAbility extends UIAbility { hilog.error(DOMAIN, 'testTag', `Can't get UIContext, ${e}`); } // loadContent是异步接口,在此处调用不能保证UI实例已经创建成功。 - hilog.info(DOMAIN, 'testTag', `loadContent success.`); + // [EndExclude Common_LocalStorage] }); } diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/cpp/embedded/embedded.cpp b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/cpp/embedded/embedded.cpp index 030f62d6826bed52704f59a1e0be84035256ab38..2c6ceaff21f42db2e0216fef9bfd05e9130a03da 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/cpp/embedded/embedded.cpp +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/cpp/embedded/embedded.cpp @@ -39,9 +39,9 @@ napi_value embeddedNode(napi_env env, napi_callback_info info) ArkUI_NodeContentHandle nodeContentHandle = nullptr; OH_ArkUI_GetNodeContentFromNapiValue(env, args[0], &nodeContentHandle); OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + //[EndExclude embeddedComponentCTest_start] // 创建节点 ArkUI_NodeHandle embeddedNode = nodeAPI->createNode(ARKUI_NODE_EMBEDDED_COMPONENT); - //[EndExclude embeddedComponentCTest_start] // 设置属性 AbilityBase_Element Element = {.bundleName = "com.example.uiextensionandaccessibility", .abilityName = "ExampleEmbeddedAbility", diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/extensionability/ExampleEmbeddedAbility.ets b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/extensionability/ExampleEmbeddedAbility.ets index 66471442abf7dd9214dc5bc8aef067dcbfc9a8c0..9874ac96060d57368e767d84a8595f222b2d0e30 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/extensionability/ExampleEmbeddedAbility.ets +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/extensionability/ExampleEmbeddedAbility.ets @@ -14,28 +14,29 @@ */ // [Start exampleEmbeddedAbility_start] import { EmbeddedUIExtensionAbility, UIExtensionContentSession, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; const TAG: string = '[ExampleEmbeddedAbility]' export default class ExampleEmbeddedAbility extends EmbeddedUIExtensionAbility { onCreate() { - console.log(TAG, `onCreate`); + hilog.info(0x0000, TAG, '%{public}s', `onCreate`); } onForeground() { - console.log(TAG, `onForeground`); + hilog.info(0x0000, TAG, '%{public}s', `onForeground`); } onBackground() { - console.log(TAG, `onBackground`); + hilog.info(0x0000, TAG, '%{public}s', `onBackground`); } onDestroy() { - console.log(TAG, `onDestroy`); + hilog.info(0x0000, TAG, '%{public}s', `onDestroy`); } onSessionCreate(want: Want, session: UIExtensionContentSession) { - console.log(TAG, `onSessionCreate, want: ${JSON.stringify(want)}`); + hilog.info(0x0000, TAG , '%{public}s', `onSessionCreate, want: ${JSON.stringify(want)}`); let param: Record = { 'session': session }; @@ -45,7 +46,7 @@ export default class ExampleEmbeddedAbility extends EmbeddedUIExtensionAbility { } onSessionDestroy(session: UIExtensionContentSession) { - console.log(TAG, `onSessionDestroy`); + hilog.info(0x0000, TAG , '%{public}s', `onSessionDestroy`); } } // [End exampleEmbeddedAbility_start] diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/EmbeddedComponent/Embedded.ets b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/EmbeddedComponent/Embedded.ets index 4ae6cdf23be1beb22681f668a76dea14c7a5e138..0cbb84ece7d145aaa6bebe68200bf11d0e26b5ac 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/EmbeddedComponent/Embedded.ets +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/EmbeddedComponent/Embedded.ets @@ -24,7 +24,9 @@ export struct Embedded { abilityName: 'ExampleEmbeddedAbility', }; build() { + // [StartExclude embedded_start] NavDestination() { + // [EndExclude embedded_start] Row() { Column() { Text(this.message).fontSize(30) @@ -33,7 +35,7 @@ export struct Embedded { .height('90%') .onTerminated((info) => { // 点击extension页面内的terminateSelfWithResult按钮后触发onTerminated回调,文本框显示如下信息 - this.message = `Termination: code = ${info.code} , want = ${ JSON.stringify(info.want)}`; + this.message = `Termination: code = ${info.code} , want = ${JSON.stringify(info.want)}`; }) .onError((error) => { // 失败或异常触发onError回调,文本框显示如下报错内容 @@ -44,9 +46,11 @@ export struct Embedded { } .height('100%') } + // [StartExclude embedded_start] .backgroundColor('#f1f2f3') - // $r('app.media.Embedded_Component_title')需要替换为开发者所需的文本资源文件 - .title($r('app.string.Embedded_Component_title')) + // $r('app.media.Embedded_Component_title')需要替换为开发者所需的文本资源文件 + .title($r('app.string.Embedded_Component_title')) + // [EndExclude embedded_start] } } // [End embedded_start] \ No newline at end of file diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets index 18f6bf9856793294a00a6ec3b74a52d4d18dd21a..381dd8eb92998103b7b1df4aead437e768fff50a 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets @@ -16,17 +16,19 @@ // [Start accessibility_text_start] @Component export struct AccessibilityText { - - @Builder customAccessibilityNode() { + @Builder + customAccessibilityNode() { Column() { Text(`virtual node`) } .width(10) - .height(10) + .height(10) } build() { + // [StartExclude accessibility_text_start] NavDestination() { + // [EndExclude accessibility_text_start] Row() { // [StartExclude accessibility_text_start] // [Start accessibility_group_start] @@ -34,50 +36,63 @@ export struct AccessibilityText { Text('HelloWorld').fontSize(50).fontWeight(FontWeight.Bold) } .accessibilityGroup(true) + // [End accessibility_group_start] // [Start accessibility_level_start] Column() { Text('HelloWorld').fontSize(50).fontWeight(FontWeight.Bold) } .accessibilityGroup(true) - .accessibilityLevel('yes') + .accessibilityLevel('yes') + // [End accessibility_level_start] // [Start accessibility_text_group_start] Column() { Text('HelloWorld').fontSize(50).fontWeight(FontWeight.Bold) } .accessibilityGroup(true) - .accessibilityLevel('yes') - .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + .accessibilityLevel('yes') + // 'app.string.UniversalAttributesAccessibility_text7'需要替换为开发者所需的文本资源文件 + .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + // [End accessibility_text_group_start] // [Start accessibility_description_start] Column() { Text('HelloWorld') } .accessibilityGroup(true) - .accessibilityLevel('yes') - .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) - .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) + .accessibilityLevel('yes') + // 'app.string.UniversalAttributesAccessibility_text7'需要替换为开发者所需的文本资源文件 + .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + // 'app.string.UniversalAttributesAccessibility_text8'需要替换为开发者所需的文本资源文件 + .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) + // [End accessibility_description_start] // [Start accessibility_checked_start] Column() { Text('HelloWorld').fontSize(50).fontWeight(FontWeight.Bold) } .accessibilityGroup(true) - .accessibilityLevel('yes') - .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) - .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) - .accessibilityChecked(true) + .accessibilityLevel('yes') + // 'app.string.UniversalAttributesAccessibility_text7'需要替换为开发者所需的文本资源文件 + .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + // 'app.string.UniversalAttributesAccessibility_text8'需要替换为开发者所需的文本资源文件 + .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) + .accessibilityChecked(true) + // [End accessibility_checked_start] // [Start accessibility_selected_start] Column() { Text('HelloWorld').fontSize(50).fontWeight(FontWeight.Bold) } .accessibilityGroup(true) - .accessibilityLevel('yes') - .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) - .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) - .accessibilitySelected(undefined) + .accessibilityLevel('yes') + // 'app.string.UniversalAttributesAccessibility_text7'需要替换为开发者所需的文本资源文件 + .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + // 'app.string.UniversalAttributesAccessibility_text8'需要替换为开发者所需的文本资源文件 + .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) + .accessibilitySelected(undefined) + // [End accessibility_selected_start] // [EndExclude accessibility_text_start] Column() { @@ -91,21 +106,23 @@ export struct AccessibilityText { .fontWeight(FontWeight.Bold) } .width('100%') - .accessibilityGroup(true) - .accessibilityLevel('yes') - // $r('app.media.UniversalAttributesAccessibility_text7')需要替换为开发者所需的文本资源文件 - .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) - // $r('app.media.UniversalAttributesAccessibility_text8')需要替换为开发者所需的文本资源文件 - .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) - .accessibilityVirtualNode(this.customAccessibilityNode) - .accessibilityChecked(true) - .accessibilitySelected(undefined) + .accessibilityGroup(true) + .accessibilityLevel('yes') + // $r('app.media.UniversalAttributesAccessibility_text7')需要替换为开发者所需的文本资源文件 + .accessibilityText($r('app.string.UniversalAttributesAccessibility_text7')) + // $r('app.media.UniversalAttributesAccessibility_text8')需要替换为开发者所需的文本资源文件 + .accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8')) + .accessibilityVirtualNode(this.customAccessibilityNode) + .accessibilityChecked(true) + .accessibilitySelected(undefined) } .height('100%') } + //[StartExclude accessibility_text_start] .backgroundColor('#f1f2f3') - // $r('app.media.UniversalAttributesAccessibility_title1')需要替换为开发者所需的文本资源文件 - .title($r('app.string.UniversalAttributesAccessibility_title1')) + // $r('app.media.UniversalAttributesAccessibility_title1')需要替换为开发者所需的文本资源文件 + .title($r('app.string.UniversalAttributesAccessibility_title1')) + //[EndExclude accessibility_text_start] } } // [End accessibility_text_start] \ No newline at end of file diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/Index.ets b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/Index.ets index f09015806b7674f82c4ce3cc40831766430977d7..ba5d99f0be5bec9cd492c258dcfeadd022810c6d 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/Index.ets +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/Index.ets @@ -26,17 +26,23 @@ export const ACCESSIBILITY_ROUTE_PREFIX: string = 'UniversalAttributesAccessibil const routes: Route[] = [ { name: `${ACCESSIBILITY_ROUTE_PREFIX}/AccessibilityText`, + // 'app.string.UniversalAttributesAccessibility_title1'需要替换为开发者所需的文本资源文件 title: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_title1')), + // 'app.string.UniversalAttributesAccessibility_description1'需要替换为开发者所需的文本资源文件 description: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_description1')), }, { name: `${ACCESSIBILITY_ROUTE_PREFIX}/AccessibilityGroup`, + // 'app.string.UniversalAttributesAccessibility_title2'需要替换为开发者所需的文本资源文件 title: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_title2')), + // 'app.string.UniversalAttributesAccessibility_description2'需要替换为开发者所需的文本资源文件 description: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_description2')), }, { name: `${ACCESSIBILITY_ROUTE_PREFIX}/AccessibilityFocusDrawLevel`, + // 'app.string.UniversalAttributesAccessibility_title3'需要替换为开发者所需的文本资源文件 title: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_title3')), + // 'app.string.UniversalAttributesAccessibility_description3'需要替换为开发者所需的文本资源文件 description: resource.resourceToString($r('app.string.UniversalAttributesAccessibility_description3')), } ]; @@ -67,18 +73,19 @@ struct AccessibilityExample { CompletedRoutableCard({ title: route.title, description: route.description }) } .width('100%') - .onClick(() => { - this.pathStack.pushPath({ name: route.name }); - }) + .onClick(() => { + this.pathStack.pushPath({ name: route.name }); + }) }) } .contentStartOffset(56) - .padding({ left: 16, right: 16 }) + .padding({ left: 16, right: 16 }) } .backgroundColor('#f1f3f5') - .title(resource.resourceToString($r('app.string.pageIndex_UniversalAttributesAccessibility')), { - backgroundBlurStyle: BlurStyle.COMPONENT_THICK, - barStyle: BarStyle.STACK - }) + // 'app.string.pageIndex_UniversalAttributesAccessibility'需要替换为开发者所需的文本资源文件 + .title(resource.resourceToString($r('app.string.pageIndex_UniversalAttributesAccessibility')), { + backgroundBlurStyle: BlurStyle.COMPONENT_THICK, + barStyle: BarStyle.STACK + }) } } \ No newline at end of file diff --git a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/VirtualNodeExample.ets b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/VirtualNodeExample.ets index b18faadce25166899c12859c19eb13b19344e733..ffc228c6df6ff258b2a02f1654bc4d56569d83c1 100644 --- a/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/VirtualNodeExample.ets +++ b/ArkUIKit/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/VirtualNodeExample.ets @@ -18,12 +18,14 @@ @Component struct VirtualNodeExample { @Builder customAccessibilityNode() { + // 'app.string.UniversalAttributesAccessibility_text6'需要替换为开发者所需的文本资源文件 Text($r('app.string.UniversalAttributesAccessibility_text6')) .fontSize(50) .fontWeight(FontWeight.Bold) } build() { Column() { + // 'app.string.UniversalAttributesAccessibility_text5'需要替换为开发者所需的文本资源文件 Text($r('app.string.UniversalAttributesAccessibility_text5')) .fontSize(50) .fontWeight(FontWeight.Bold) diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/BasicNesting.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/BasicNesting.ets index 541a8545850a9ed0a57642dcb692053f6162a441..d2566368a72810e603e3e3a12363250d1e834d49 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/BasicNesting.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/BasicNesting.ets @@ -115,6 +115,5 @@ struct MyView { } } } - // [End Basic_nesting] export default MyView; diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ComplexMethodsNesting.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ComplexMethodsNesting.ets index 6be9d4cff5e66735a52bd0fd33c8cb67163df0b6..caacb84015597e6726fb8c0726148eab29973ece 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ComplexMethodsNesting.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ComplexMethodsNesting.ets @@ -53,76 +53,30 @@ class ParentCounter { @Component struct ParentComp { @State counter: ParentCounter[] = [new ParentCounter(1), new ParentCounter(2), new ParentCounter(3)]; - + // [Start Complex_Methods_Nesting] build() { Row() { - Column() { - // [Start Complex_Methods_Nesting] CounterComp({ value: this.counter[0] }) // ParentComp组件传递 ParentCounter 给 CounterComp 组件 - // [StartExclude Complex_Methods_Nesting] - CounterComp({ value: this.counter[1] }) - CounterComp({ value: this.counter[2] }) - Divider().height(5) - ForEach(this.counter, - (item: ParentCounter) => { - CounterComp({ value: item }) - }, - (item: ParentCounter) => item.id.toString() - ); - Divider().height(5) - Text('Parent: reset entire counter') - .fontSize(20).height(50) - .onClick(() => { - this.counter = [ - new ParentCounter(1), - new ParentCounter(2), - new ParentCounter(3) - ] - }) - Text('Parent: incr counter[0].counter') - .fontSize(20).height(50) - .onClick(() => { - this.counter[0].incrCounter(); - this.counter[0].incrSubCounter(10); - }) - Text('Parent: set.counter to 10') - .fontSize(20).height(50) - .onClick(() => { - this.counter[0].setSubCounter(10); - }) - } } } + // [StartExclude Complex_Methods_Nesting] } @Component struct CounterComp { // [EndExclude Complex_Methods_Nesting] @ObjectLink value: ParentCounter; // @ObjectLink 接收 ParentCounter - - // [StartExclude Complex_Methods_Nesting] - build() { - Column({ space: 10 }) { - Text(`${this.value.counter}`) - .fontSize(25) - .onClick(() => { - this.value.incrCounter(); - }) - // [EndExclude Complex_Methods_Nesting] // CounterChild 是 CounterComp 的子组件,CounterComp 传递 this.value.subCounter 给 CounterChild 组件 CounterChild({ subValue: this.value.subCounter }) - // [StartExclude Complex_Methods_Nesting] - Divider().height(2) - } } + // [StartExclude Complex_Methods_Nesting] } @Component struct CounterChild { // [EndExclude Complex_Methods_Nesting] @ObjectLink subValue: SubCounter; // @ObjectLink 接收 SubCounter - // [End Complex_Methods_Nesting] build() { Text(`${this.subValue.counter}`) diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DelayedChange.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DelayedChange.ets index b83e0c4651af69aef7f58b6e599e3724287d8ce5..3683afa639da1cf8c306652f8847bc62ed62253c 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DelayedChange.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DelayedChange.ets @@ -31,10 +31,8 @@ class RenderClass { @Component struct DelayedChangeIndex { @State @Watch('renderClassChange') renderClass: RenderClass = new RenderClass(); - // [StartExclude Delayed_change] private context = this.getUIContext().getHostContext() as common.UIAbilityContext; - // [EndExclude Delayed_change] renderClassChange() { // $r('app.string.renderClass_Change')需要替换为开发者所需的资源文件 hilog.info(DOMAIN, TAG, `${this.context.resourceManager.getStringSync($r('app.string.renderClass_Change').id)}:` + @@ -60,5 +58,4 @@ struct DelayedChangeIndex { .height('100%') } } - // [End Delayed_change] \ No newline at end of file diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DifferencesPropObjectLink.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DifferencesPropObjectLink.ets index 99ee6054334d1051f03c7df4e0d9db728072fc2b..bc31b84f90c5cdd83aa88c6c7f6dc5ca7b67f359 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DifferencesPropObjectLink.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/DifferencesPropObjectLink.ets @@ -58,7 +58,6 @@ struct UserChild { } } } - // [End Differences_Prop_ObjectLink] const differencesPropObjectLink = Index; export default differencesPropObjectLink; diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/NotTriggerUIRefresh.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/NotTriggerUIRefresh.ets index f718a4ef98a67b49ed71b881a941c03c7bd95f2e..1ddd22f0fbbe9c53ca5f2e0e18d55707ad4fceac 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/NotTriggerUIRefresh.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/NotTriggerUIRefresh.ets @@ -79,7 +79,6 @@ struct Child { .width('100%') } } - // [End Not_Trigger_UI_Refresh_Proxy] const notTriggerUIRefreshParent = Parent; export default notTriggerUIRefreshParent; \ No newline at end of file diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ObjectLinkDataSourceUpdate.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ObjectLinkDataSourceUpdate.ets index c256a4c9a903a6db8e9d0e8e2f48909880179123..136a077d610c7a89fef395f449ec539217b821f2 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ObjectLinkDataSourceUpdate.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/ObservedAndObjectLinkFAQs/ObjectLinkDataSourceUpdate.ets @@ -69,10 +69,8 @@ struct Parent { struct Child { @ObjectLink @Watch('onChange02') per: Person; clickEvent?: () => void; - // [StartExclude ObjectLink_Data_source_update_timing] private context = this.getUIContext().getHostContext() as common.UIAbilityContext; - // [EndExclude ObjectLink_Data_source_update_timing] onChange02() { hilog.info(DOMAIN, TAG, `:::onChange02:${this.per.name}`); // 5 } @@ -95,7 +93,6 @@ struct Child { hilog.info(DOMAIN, TAG, `:::--------${this.context.resourceManager.getStringSync($r('app.string.ObjectLinkDataSourceUpdate_Child').id)}: ${this.per.name}`); // 4 }; } - // [End ObjectLink_Data_source_update_timing] const objectLinkDataSourceUpdateParent = Parent; export default objectLinkDataSourceUpdateParent; \ No newline at end of file diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/CompleteExampleTwoDimensionalArray.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/CompleteExampleTwoDimensionalArray.ets index ba5df704621fd987abd59f71333ce835f22d4516..4f2f0fd6e2b5f670d3362c8e6646f8316f7479e1 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/CompleteExampleTwoDimensionalArray.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/CompleteExampleTwoDimensionalArray.ets @@ -70,5 +70,4 @@ struct IndexPage { } } } - // [End Complete_Example_Two_Dimensional_Array] \ No newline at end of file diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromMapClass.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromMapClass.ets index acecb658924c82006242d42e53a29696e6585fbf..6815d50e7c0ff067d8e4f7d1ceee1dbb28f97901 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromMapClass.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromMapClass.ets @@ -22,7 +22,6 @@ class Info { } } - @Observed export class MyMap extends Map { public name: string; @@ -37,7 +36,6 @@ export class MyMap extends Map { } } - @Entry @Component struct MapSampleNested { diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromSetClass.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromSetClass.ets index 298071133d50fdd1631f05592e97550d69bad83e..8d200ed2ecef1bb019541e33216e6c7cde482cfe 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromSetClass.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/InheritFromSetClass.ets @@ -22,7 +22,6 @@ class Info { } } - @Observed export class MySet extends Set { public name: string; diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/TwoDimensionalArray.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/TwoDimensionalArray.ets index a9fadf6473e6650e9b6ed56297d0b8eecd25773e..fa4efc83d95c36a3a48740f28e221d30bce382f3 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/TwoDimensionalArray.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/objectLinkusagescenarios/TwoDimensionalArray.ets @@ -17,7 +17,6 @@ @Observed class ObservedArrays extends Array { } - // [End Two_dimensional_array] // [Start Two_dimensional_array_example] diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/DecoratorDescription.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/DecoratorDescription.ets index b587ff8fb288a1644c0558ca33d5116b30195b23..c7ea5291a49c97ae005a1eb1c7e148c956787f21 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/DecoratorDescription.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/DecoratorDescription.ets @@ -63,27 +63,24 @@ struct DecoratorDescriptionHelloWorld { // [Start Modify_and_change] @ObjectLink parent: Parent; - // [StartExclude Modify_and_change] build() { - RelativeContainer() { - Button('') - .onClick(() => { - // [EndExclude Modify_and_change] - // 赋值变化可以被观察到 - this.parent.child = new Child(5); - this.parent.count = 5; - // Child没有被@Observed装饰,其属性的变化观察不到 - this.parent.child.num = 5; - // [End Modify_and_change] - - // [Start Attribute_assignment] - // 允许@ObjectLink装饰的数据属性赋值 - this.objLink.a = '...' - // [End Attribute_assignment] - }) + Column() { } - .height('100%') - .width('100%') + .onClick(() => { + // 赋值变化可以被观察到 + this.parent.child = new Child(5); + this.parent.count = 5; + // Child没有被@Observed装饰,其属性的变化观察不到 + this.parent.child.num = 5; + // [StartExclude Modify_and_change] + // [Start Attribute_assignment] + // 允许@ObjectLink装饰的数据属性赋值 + this.objLink.a = '...'; + // [End Attribute_assignment] + // [EndExclude Modify_and_change] + }) } + // [End Modify_and_change] } + export default DecoratorDescription; diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/ObservationChangeInheritance.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/ObservationChangeInheritance.ets index f4d94cdd0f1b03f1edebf5dd194c303093ba0916..afc540ee853f67c28f865931c0e57fcad2bb71d1 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/ObservationChangeInheritance.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/overview/ObservationChangeInheritance.ets @@ -69,7 +69,6 @@ struct Parent { } } } - // [End Observation_ChangeInheritance] const observationChangeInheritance = Parent; export default observationChangeInheritance; \ No newline at end of file diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/ReadOnlyVariable.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/ReadOnlyVariable.ets index 03ff07009d9db23606d9b8a43e9e78b77cb5ed03..5f3c30f92a27e42759c34711a2ede722c935cea7 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/ReadOnlyVariable.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/ReadOnlyVariable.ets @@ -27,10 +27,8 @@ class Info { @Component struct Child { @ObjectLink num: Info; - // [StartExclude variables_decorated_ObjectLink_read_only] private context = this.getUIContext().getHostContext() as common.UIAbilityContext; - // [EndExclude variables_decorated_ObjectLink_read_only] build() { Column() { // $r('app.string.value_num')需要替换为开发者所需的资源文件 @@ -47,10 +45,8 @@ struct Child { @Component struct Parent { @State num: Info = new Info(10); - // [StartExclude variables_decorated_ObjectLink_read_only] private context = this.getUIContext().getHostContext() as common.UIAbilityContext; - // [EndExclude variables_decorated_ObjectLink_read_only] build() { Column() { // $r('app.string.value_count')需要替换为开发者所需的资源文件 @@ -64,7 +60,6 @@ struct Parent { } } } - // [End variables_decorated_ObjectLink_read_only] const readOnlyVariableParent = Parent; export default readOnlyVariableParent; diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/RestrictiveConditionsObserved.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/RestrictiveConditionsObserved.ets index 9a556f97d1a21507794e7cc728bb9263e175e3bd..a5070b807def0d168ccb1f5c7d8bf8bd1367210a 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/RestrictiveConditionsObserved.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/main/ets/pages/restrictiveconditions/RestrictiveConditionsObserved.ets @@ -21,15 +21,13 @@ class Info { this.count = count; } } - // [StartExclude Test_Info_Observed] @Component struct TestInfo { - // [EndExclude Test_Info_Observed] - // 正确写法 - @ObjectLink count: Info; - - // [End Test_Info_Observed] +// [EndExclude Test_Info_Observed] +// 正确写法 +@ObjectLink count: Info; +// [End Test_Info_Observed] build() { } @@ -44,15 +42,12 @@ class CountInfo { this.count = count; } } - // [StartExclude Info_Initialization] @Component struct Initialization { - // [EndExclude Info_Initialization] - - // 正确写法 - @ObjectLink count: CountInfo; - +// [EndExclude Info_Initialization] +// 正确写法 +@ObjectLink count: CountInfo; // [End Info_Initialization] build() { diff --git a/ArkUIKit/arktsobservedandobjectlink/entry/src/ohosTest/ets/test/Index.test.ets b/ArkUIKit/arktsobservedandobjectlink/entry/src/ohosTest/ets/test/Index.test.ets index e802b6366dd7f7dfe075fe9ee867bb99947e8b35..5f857eef326c4d5bd948950fefb324e093520c15 100644 --- a/ArkUIKit/arktsobservedandobjectlink/entry/src/ohosTest/ets/test/Index.test.ets +++ b/ArkUIKit/arktsobservedandobjectlink/entry/src/ohosTest/ets/test/Index.test.ets @@ -400,18 +400,6 @@ export default function IndexTest() { expect(targetElement === null).assertFalse(); await targetElement!.click(); await driver.delayMs(2000); - let targetElement2 = await driver.findComponent(ON.text('Parent: reset entire counter', MatchPattern.CONTAINS)); - expect(targetElement2=== null).assertFalse(); - await targetElement2.click(); - await driver.delayMs(1000); - let targetElement3 = await driver.findComponent(ON.text('Parent: incr counter[0].counter', MatchPattern.CONTAINS)); - expect(targetElement3=== null).assertFalse(); - await targetElement3.click(); - await driver.delayMs(1000); - let targetElement4 = await driver.findComponent(ON.text('Parent: set.counter to 10', MatchPattern.CONTAINS)); - expect(targetElement4=== null).assertFalse(); - await targetElement4.click(); - await driver.delayMs(1000); await driver.pressBack(); done(); hilog.info(DOMAIN,TAG,BUNDLE + 'ComplexMethodsNesting_013,end') diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayBig.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayBig.ets index 24a0e8bb5e2b64ace14a6b615cc70002647ec8f9..f1d62208f90e1cf4890fc1c204070c5bd33a222d 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayBig.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayBig.ets @@ -14,6 +14,7 @@ */ // [Start StateArrayBig_start] import { hilog } from '@kit.PerformanceAnalysisKit'; + const DOMAIN_NUMBER: number = 0XFF00; const TAG: string = '[EvtryAblity]'; @@ -39,14 +40,13 @@ class UiStyle3 { @Component struct SpecialImage { @ObjectLink uiStyle: UiStyle3; - private isRenderSpecialImage(): number { // 显示组件是否渲染的函数 hilog.info(DOMAIN_NUMBER, TAG, 'SpecialImage is rendered'); return 1; } build() { - Image($r('app.media.startIcon')) // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 + Image($r('app.media.icon')) // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 .width(this.uiStyle.imageWidth) .height(this.uiStyle.imageHeight) .margin({ top: 20 }) @@ -90,7 +90,7 @@ struct PageChild3 { }) Stack() { Column() { - Image($r('app.media.startIcon')) // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 + Image($r('app.media.icon')) // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 .opacity(this.uiStyle.alpha) .scale({ x: this.uiStyle.scaleX, @@ -122,7 +122,7 @@ struct PageChild3 { .margin({ top: 50 }) .borderRadius(this.uiStyle.borderRadius) .opacity(this.isRenderStack()) - .backgroundColor('FFFFFF') + .backgroundColor('#FFFFFF') .width(this.uiStyle.width) .height(this.uiStyle.height) .translate({ diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayInit.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayInit.ets index 669a0b9fde14e04479ce21cc8235caeb67a08a24..999d364d3d2930958f36eef2b0556c0e75068fc2 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayInit.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayInit.ets @@ -17,7 +17,7 @@ const DOMAIN_NUMBER: number = 0XFF00; const TAG: string = '[EvtryAblity]'; @Observed -class StateArrayInitChild { +class Child8 { public count: number; constructor(count: number) { @@ -26,8 +26,8 @@ class StateArrayInitChild { } @Observed -class StateArrayInitChildList extends Array { - constructor(children?: StateArrayInitChild[]) { +class ChildList8 extends Array { + constructor(children?: Child8[]) { super(); if (children) { this.push(...children); @@ -36,33 +36,32 @@ class StateArrayInitChildList extends Array { } @Observed -class StateArrayInitAncestor { - public childList: StateArrayInitChildList; - - constructor(childList: StateArrayInitChildList) { +class Ancestor8 { + public childList: ChildList8; + constructor(childList: ChildList8) { this.childList = childList; } public loadData() { let tempList = - new StateArrayInitChildList([new StateArrayInitChild(1), new StateArrayInitChild(2), new StateArrayInitChild(3), - new StateArrayInitChild(4), new StateArrayInitChild(5)]); + new ChildList8([new Child8(1), new Child8(2), new Child8(3), + new Child8(4), new Child8(5)]); this.childList = tempList; } public clearData() { - this.childList = new StateArrayInitChildList(); + this.childList = new ChildList8(); } } @Component struct StateArrayInit { - @Link childList: StateArrayInitChildList; - @ObjectLink stateArrayInitchild: StateArrayInitChild; + @Link childList: ChildList8; + @ObjectLink Child8: Child8; build() { Row() { - Text(this.stateArrayInitchild.count + '') + Text(this.Child8.count + '') .height(70) .fontSize(20) .borderRadius({ topLeft: 6, topRight: 6 }) @@ -72,7 +71,7 @@ struct StateArrayInit { .backgroundColor(Color.Red) .onClick(() => { let index = this.childList.findIndex((item) => { - return item.count === this.stateArrayInitchild.count + return item.count === this.Child8.count }) if (index !== -1) { this.childList.splice(index, 1); @@ -93,7 +92,7 @@ struct StateArrayInit { @Component struct StateArrayInitCompList { - @ObjectLink @Watch('changeChildList') stateArrayInitchildList: StateArrayInitChildList; + @ObjectLink @Watch('changeChildList') Child8List: ChildList8; changeChildList() { hilog.info(DOMAIN_NUMBER, TAG, 'CompList ChildList change'); @@ -107,11 +106,11 @@ struct StateArrayInitCompList { build() { Column() { List() { - ForEach(this.stateArrayInitchildList, (item: StateArrayInitChild, index) => { + ForEach(this.Child8List, (item: Child8, index) => { ListItem() { StateArrayInit({ - childList: this.stateArrayInitchildList, - stateArrayInitchild: item + childList: this.Child8List, + Child8: item }) .opacity(this.isRenderCompChild(index)) } @@ -124,21 +123,21 @@ struct StateArrayInitCompList { @Component struct StateArrayInitCompAncestor { - @ObjectLink stateArrayInitancestor: StateArrayInitAncestor; + @ObjectLink Ancestor8: Ancestor8; build() { Column() { - StateArrayInitCompList({ stateArrayInitchildList: this.stateArrayInitancestor.childList }) + StateArrayInitCompList({ Child8List: this.Ancestor8.childList }) Row() { Button('Clear') .onClick(() => { - this.stateArrayInitancestor.clearData() + this.Ancestor8.clearData() }) .width(100) .margin({ right: 50 }) Button('Recover') .onClick(() => { - this.stateArrayInitancestor.loadData() + this.Ancestor8.loadData() }) .width(100) } @@ -150,14 +149,14 @@ struct StateArrayInitCompAncestor { @Component struct StateArrayInitPage { // [Start StateArrayInit_start] - @State childList: StateArrayInitChildList = - new StateArrayInitChildList([new StateArrayInitChild(1), new StateArrayInitChild(2), new StateArrayInitChild(3), - new StateArrayInitChild(4), new StateArrayInitChild(5)]); - @State ancestor: StateArrayInitAncestor = new StateArrayInitAncestor(this.childList) + @State childList: ChildList8 = + new ChildList8([new Child8(1), new Child8(2), new Child8(3), + new Child8(4), new Child8(5)]); + @State ancestor: Ancestor8 = new Ancestor8(this.childList) // [End StateArrayInit_start] build() { Column() { - StateArrayInitCompAncestor({ stateArrayInitancestor: this.ancestor }) + StateArrayInitCompAncestor({ Ancestor8: this.ancestor }) } } } \ No newline at end of file diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy.ets index a5548327c970dd767aa4b481dec27a38afed2eb2..69ad195b154b5105dc2450fe49291dcbbbcabaef 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy.ets @@ -119,7 +119,7 @@ struct MyComponent8 { aboutToAppear() { for (let i = 0; i <= 9; i++) { // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 - this.data.pushData(new StringData2(`Click to add ${i}`, $r('app.media.startIcon'))); + this.data.pushData(new StringData2(`Click to add ${i}`, $r('app.media.icon'))); } } diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy2.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy2.ets index 9f6163854ee757d0740fd4a84bce393f4a7a9cdf..e7ab17e165b2dd0d77b7fa208f4f7299598ef731 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy2.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLazy2.ets @@ -115,7 +115,7 @@ struct MyComponent9 { aboutToAppear() { for (let i = 0; i <= 9; i++) { // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 - this.data.pushData(new StringData(`Click to add ${i}`, $r('app.media.startIcon'))); + this.data.pushData(new StringData(`Click to add ${i}`, $r('app.media.icon'))); } } diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLoadDate.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLoadDate.ets index 1d4cf968d0d178b89fb0a0832a436c4d495abedf..fa78979eb7c7846642696fb66b262983966ffd43 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLoadDate.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayLoadDate.ets @@ -13,6 +13,7 @@ * limitations under the License. */ import { hilog } from '@kit.PerformanceAnalysisKit'; + const DOMAIN_NUMBER: number = 0XFF00; const TAG: string = '[EvtryAblity]'; @@ -44,7 +45,7 @@ class Ancestor7 { // [Start StateArrayLoadDate_start] public loadData() { - const tempList = ChildList7.from([new Child(1), new Child(2), new Child(3), new Child(4), new Child(5)]); + let tempList = ChildList7.from([new Child(1), new Child(2), new Child(3), new Child(4), new Child(5)]); this.childList = tempList; } // [End StateArrayLoadDate_start] diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayObserved.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayObserved.ets index 4a911f383ee36755c282c0e6d834f992ad2b22dd..f15172200123166e9e2ac28c6b14e78fbd3afc3a 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayObserved.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayObserved.ets @@ -20,7 +20,6 @@ const TAG: string = '[EvtryAblity]'; @Observed class Child6 { public count: number; - constructor(count: number) { this.count = count } diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayPrecise.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayPrecise.ets index e9344e8f5a6fde31b158b92e6eb68dcdf6be0b88..1b1b15cab8dc83ba6778cfd3b7fdd3515be9af23 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayPrecise.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayPrecise.ets @@ -14,6 +14,7 @@ */ // [Start StateArrayPrecise_start] import { hilog } from '@kit.PerformanceAnalysisKit'; + const DOMAIN_NUMBER: number = 0XFF00; const TAG: string = '[EvtryAblity]'; @@ -67,14 +68,14 @@ class NeedRenderTranslate { // 在一起使用的属性可以划分为相同的 @Observed class UiStyle4 { // 使用NeedRenderxxx类 - public needRenderTranslate: NeedRenderTranslate = new NeedRenderTranslate(); - public needRenderFontSize: NeedRenderFontSize = new NeedRenderFontSize(); - public needRenderBorderRadius: NeedRenderBorderRadius = new NeedRenderBorderRadius(); - public needRenderPos: NeedRenderPos = new NeedRenderPos(); - public needRenderSize: NeedRenderSize = new NeedRenderSize(); - public needRenderAlpha: NeedRenderAlpha = new NeedRenderAlpha(); - public needRenderScale: NeedRenderScale = new NeedRenderScale(); - public needRenderImage: NeedRenderImage = new NeedRenderImage(); + public needRenderTranslate: NeedRenderTranslate = new NeedRenderTranslate(); + public needRenderFontSize: NeedRenderFontSize = new NeedRenderFontSize(); + public needRenderBorderRadius: NeedRenderBorderRadius = new NeedRenderBorderRadius(); + public needRenderPos: NeedRenderPos = new NeedRenderPos(); + public needRenderSize: NeedRenderSize = new NeedRenderSize(); + public needRenderAlpha: NeedRenderAlpha = new NeedRenderAlpha(); + public needRenderScale: NeedRenderScale = new NeedRenderScale(); + public needRenderImage: NeedRenderImage = new NeedRenderImage(); } @Component @@ -245,4 +246,5 @@ struct Page4 { .backgroundColor('#F1F3F5') } } + // [End StateArrayPrecise_start] \ No newline at end of file diff --git a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayTrack.ets b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayTrack.ets index b0e9f2fd424257cf3d634b1b84e360abd461887a..bd53bc3af6e2a9150cc47f6af8bd04dbf64ffb88 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayTrack.ets +++ b/ArkUIKit/statemanagementproject/entry/src/main/ets/pages/statemanagementguide/StateArrayTrack.ets @@ -39,14 +39,13 @@ class UiStyle5 { @Component struct SpecialImage5 { @ObjectLink uiStyle: UiStyle5; - private isRenderSpecialImage(): number { // 显示组件是否渲染的函数 hilog.info(DOMAIN_NUMBER, TAG, 'SpecialImage is rendered'); return 1; } build() { - Image($r('app.media.startIcon')) // 此处'app.media.icon'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 + Image($r('app.media.foreground')) // 此处'app.media.foreground'仅作示例,请开发者自行替换,否则imageSource创建失败会导致后续无法正常执行。 .width(this.uiStyle.imageWidth) .height(this.uiStyle.imageHeight) .margin({ top: 20 }) diff --git a/ArkUIKit/statemanagementproject/entry/src/main/module.json5 b/ArkUIKit/statemanagementproject/entry/src/main/module.json5 index d6017727d3774aa400c6a205adc8a1f626576a7e..686ef072b96f4d8c7c0bc9de9dbf6a0a0e5ed19c 100644 --- a/ArkUIKit/statemanagementproject/entry/src/main/module.json5 +++ b/ArkUIKit/statemanagementproject/entry/src/main/module.json5 @@ -29,7 +29,7 @@ "description": "$string:EntryAbility_desc", "icon": "$media:layered_image", "label": "$string:EntryAbility_label", - "startWindowIcon": "$media:startIcon", + "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", "exported": true, "skills": [ diff --git a/ArkUIKit/statemanagementproject/entry/src/main/resources/base/media/icon.png b/ArkUIKit/statemanagementproject/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a31c7f86b9157290e9278a80f48ff93b61b5a60d Binary files /dev/null and b/ArkUIKit/statemanagementproject/entry/src/main/resources/base/media/icon.png differ diff --git a/ArkUIKit/wrapbuilder/entry/src/main/ets/pages/PageOne.ets b/ArkUIKit/wrapbuilder/entry/src/main/ets/pages/PageOne.ets index 2de2b6b23d25691d50919892275863cc4016d091..ede7be6ddbe66fb111f743b19b3df2d6b25149a0 100644 --- a/ArkUIKit/wrapbuilder/entry/src/main/ets/pages/PageOne.ets +++ b/ArkUIKit/wrapbuilder/entry/src/main/ets/pages/PageOne.ets @@ -58,21 +58,21 @@ struct WrapBuilderSimplePage { // 1. 标题(子组件,正确嵌套在根 Column 内) Text('wrapBuilder simple example') .fontSize(20) - .fontWeight('bold') // 用字符串避免枚举问题 - .margin({ bottom: 10 }); + .fontWeight('bold') + .margin({ bottom: 10 }) // 2. 包装后的文本展示(子组件,嵌套在根 Column 内) Column() { Text('Display of wrapped text:') .fontSize(14) .fontColor('#666') - .margin({ bottom: 8 }); + .margin({ bottom: 8 }) wrappedText.builder(this.info, this.textSize); } .padding(10) .backgroundColor('#f0f0f0') - .borderRadius(6); + .borderRadius(6) // 3. 交互按钮(子组件,嵌套在根 Column 内) Row({ space: 15 }) { @@ -83,7 +83,7 @@ struct WrapBuilderSimplePage { .onClick(() => { this.info = 'the updated content'; this.textSize = 18; - }); + }) // 按钮2:重置 Column() { @@ -92,13 +92,13 @@ struct WrapBuilderSimplePage { .onClick(() => { this.info = 'initial information'; this.textSize = 16; - }); + }) } } // 根 Column 的属性(紧跟在根容器代码块之后) .width('100%') .height('100%') .padding(20) - } // 闭合 build() 方法 -} // 闭合 struct 组件 + } +} // [End wrapbuilder_page_one] \ No newline at end of file