diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityFocusUnresponsive.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityFocusUnresponsive.ets index a02544def7c3c870f994788c5b5976db68d6e22a..1f772599d09a7edeaa64681b6f7853f9bac0c54d 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityFocusUnresponsive.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityFocusUnresponsive.ets @@ -43,6 +43,7 @@ export default class EntryAbility extends UIAbility { windowClass = data; windowClass.setUIContent('pages/Index'); let enabled = true; + // Enable response to back gesture event let promise = windowClass.setDialogBackGestureEnabled(enabled); promise.then(() => { console.info('Succeeded in setting dialog window to respond back gesture.'); diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityForHideBar.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityForHideBar.ets index bfbbad96d4b29150c0e7acba9e6153b458d936bb..2c3bb77ee6c1f2b960f08604ebb2438360e10592 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityForHideBar.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityForHideBar.ets @@ -32,8 +32,8 @@ export default class EntryAbility extends UIAbility { hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); const context = windowStage.getMainWindowSync().getUIContext(); AppStorage.setOrCreate("context", context); - // [EndExclude hide_bar] }); + // [EndExclude hide_bar] } // [End hide_bar] diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityForWindow.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityForWindow.ets index a8684cfcd1d3d2090a4df8c4667c79429368770a..942ef89a65eb9b6e91bfebf2802d81b49570f099 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityForWindow.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityForWindow.ets @@ -40,7 +40,7 @@ export default class EntryAbility extends UIAbility { let windowClass: window.Window | undefined = undefined; try { let promise = window.getLastWindow(this.context); - promise.then((data)=> { + promise.then((data) => { //Get window object windowClass = data; try { @@ -52,9 +52,10 @@ export default class EntryAbility extends UIAbility { console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception)); } console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); - }).catch((err: BusinessError)=>{ + }).catch((err: BusinessError) => { console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); - });} catch (exception) { + }); + } catch (exception) { console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception)); } // [End entry_ability_for_window] diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersiveStatusBar.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersiveStatusBar.ets index dac00268ec1e1e18c6b682cead52110371c95b2a..751f879c28cc3176e271bb289b90b8be51197655 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersiveStatusBar.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityImmersiveStatusBar.ets @@ -40,11 +40,15 @@ export default class EntryAbility extends UIAbility { let names = []; windowClass.setWindowSystemBarEnable(names).then(() => { console.info('Succeeded in setting the system bar to be visible.'); + }).catch((err: BusinessError) => { + console.error('Failed to setting the system bar to be visible. Cause: ' + JSON.stringify(err)); }); // 2.Realize immersive effects. Method 2: Set the window to a full screen layout, and coordinate with the transparency, background/text color, and highlighted icons of the navigation bar and status bar to maintain consistency with the main window display. let isLayoutFullScreen = true; windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => { console.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + console.error('Failed to setting the window layout. Cause: ' + JSON.stringify(err)); }); let sysBarProps: window.SystemBarProperties = { statusBarColor: '#ff00ff', @@ -55,6 +59,8 @@ export default class EntryAbility extends UIAbility { }; windowClass.setWindowSystemBarProperties(sysBarProps).then(() => { console.info('Succeeded in setting the system bar properties.'); + }).catch((err: BusinessError) => { + console.error('Failed to setting the system bar properties. Cause: ' + JSON.stringify(err)); }); }) // 3.Load the corresponding target page for the immersive window. diff --git a/ArkUI/entry/src/main/ets/pages/DoesWidthSupportSettingVariables.ets b/ArkUI/entry/src/main/ets/pages/DoesWidthSupportSettingVariables.ets index 0c6bad08d2c0183abd51a8a34e5d156bf5117e35..aa5167c72b6b47389af1b83e17aba557d494fad3 100644 --- a/ArkUI/entry/src/main/ets/pages/DoesWidthSupportSettingVariables.ets +++ b/ArkUI/entry/src/main/ets/pages/DoesWidthSupportSettingVariables.ets @@ -22,7 +22,7 @@ @Component struct Page1 { @State message: string = 'Hello'; - @State widNum: number = 300; + @State widthNum: number = 300; build() { Row() { @@ -30,7 +30,7 @@ struct Page1 { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) - .width(this.widNum) + .width(this.widthNum) .backgroundColor(Color.Blue) } .width('100%') diff --git a/ArkUI/entry/src/main/ets/pages/DynamicallyControlKeyboardBinding.ets b/ArkUI/entry/src/main/ets/pages/DynamicallyControlKeyboardBinding.ets index af565985c17c4164b9a68f05fdd469391699d6b4..8730ac0226df1da5d1e06aedda6c9b7521395ee2 100644 --- a/ArkUI/entry/src/main/ets/pages/DynamicallyControlKeyboardBinding.ets +++ b/ArkUI/entry/src/main/ets/pages/DynamicallyControlKeyboardBinding.ets @@ -21,9 +21,10 @@ @Entry @Component struct DynamicControlKeyboard { + // Whether focus is on "key1" TextInput private flag: boolean = true; @Builder - Kb() { + customKeyboardBuilder() { Row() { Text('Customize keyboard') } @@ -42,7 +43,7 @@ struct DynamicControlKeyboard { .defaultFocus(true) TextInput() .key('key2') - .customKeyboard(this.Kb()) + .customKeyboard(this.customKeyboardBuilder()) Button('Switch TextInput') .onClick(() => { if (this.flag) { diff --git a/ArkUI/entry/src/main/ets/pages/GetHorizontalAndVerticalScreenStatusWindowRotation.ets b/ArkUI/entry/src/main/ets/pages/GetHorizontalAndVerticalScreenStatusWindowRotation.ets index 7b6af205383b4673a1d9bece1b4a157f7b5faba1..a1a04bbe2e5a3e6c59a040972348c16dddc378c5 100644 --- a/ArkUI/entry/src/main/ets/pages/GetHorizontalAndVerticalScreenStatusWindowRotation.ets +++ b/ArkUI/entry/src/main/ets/pages/GetHorizontalAndVerticalScreenStatusWindowRotation.ets @@ -22,7 +22,7 @@ import { display, window } from '@kit.ArkUI'; @Entry @Component -struct windowRotation { +struct WindowRotation { build() { Text("Scroll Area") .width("100%") @@ -49,5 +49,6 @@ struct windowRotation { } }) }) - }} + } +} // [End get_window_rotation] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/GradientTransparencyVaries.ets b/ArkUI/entry/src/main/ets/pages/GradientTransparencyVaries.ets index 28cf4db7b8a9bbefcb459b4b0fe6efa214b4b4f1..896c7b005d63ab8a43df486045613b81f817fd6c 100644 --- a/ArkUI/entry/src/main/ets/pages/GradientTransparencyVaries.ets +++ b/ArkUI/entry/src/main/ets/pages/GradientTransparencyVaries.ets @@ -22,7 +22,7 @@ @Component struct ColorGradientExample { @State transparent: number | string = '#00333333'; - bool: boolean = true; + private bool: boolean = true; build() { Column({ space: 5 }) { diff --git a/ArkUI/entry/src/main/ets/pages/ImplementingPageLoading.ets b/ArkUI/entry/src/main/ets/pages/ImplementingPageLoading.ets index 4be3734c304ca71bae4e4ea9b1602f121339ce8d..53388acf6e2cca5c199e690e8618a9421bd2bdc5 100644 --- a/ArkUI/entry/src/main/ets/pages/ImplementingPageLoading.ets +++ b/ArkUI/entry/src/main/ets/pages/ImplementingPageLoading.ets @@ -21,7 +21,7 @@ @Entry @Component struct PageLoading { - @State isLoading: Boolean = true; + @State isLoading: boolean = true; aboutToAppear(): void { // Simulate network request operation, request data from the network 3 seconds later, notify the component, and change the list data diff --git a/ArkUI/entry/src/main/ets/pages/ListItemPlaceholderAnimation.ets b/ArkUI/entry/src/main/ets/pages/ListItemPlaceholderAnimation.ets index 212252590e44b1255ae353b67f29cd008708215e..ca9f4dfac365c7a8801f3b0aa30f748a053a5bd9 100644 --- a/ArkUI/entry/src/main/ets/pages/ListItemPlaceholderAnimation.ets +++ b/ArkUI/entry/src/main/ets/pages/ListItemPlaceholderAnimation.ets @@ -21,7 +21,7 @@ @Entry @Component struct GridExample { - @State numbers: String[] = []; + @State numbers: string[] = []; scroller: Scroller = new Scroller(); @State text: string = 'drag'; diff --git a/ArkUI/entry/src/main/ets/pages/RealizeTransparentTransmissionOfEvents.ets b/ArkUI/entry/src/main/ets/pages/RealizeTransparentTransmissionOfEvents.ets index d23e9c22cc489ef6969fe9afcd1ffa160043d6b9..d2210dfa0c57799a96737a7be27a00e09e90f49c 100644 --- a/ArkUI/entry/src/main/ets/pages/RealizeTransparentTransmissionOfEvents.ets +++ b/ArkUI/entry/src/main/ets/pages/RealizeTransparentTransmissionOfEvents.ets @@ -29,7 +29,7 @@ struct StackExample { .backgroundColor(0xd2cab3) .align(Alignment.Top) .onClick(() => { - console.log('11111') + console.log('TextA click') }) Text('B') .width('70%') @@ -38,9 +38,12 @@ struct StackExample { .align(Alignment.Top) .hitTestBehavior(HitTestMode.None) .onClick(() => { - console.log('1111122222') + console.log('TextB click') }) - }.width('100%').height(150).margin({ top: 5 }) + } + .width('100%') + .height(150) + .margin({ top: 5 }) } } // [End realize_transparent_transmission_of_events] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/SetDifferentAttributes.ets b/ArkUI/entry/src/main/ets/pages/SetDifferentAttributes.ets index 2583e63f74ec921782c97b7df7f35044743518e1..8908cf95172a7f65492373dd35e2ba04073049b4 100644 --- a/ArkUI/entry/src/main/ets/pages/SetDifferentAttributes.ets +++ b/ArkUI/entry/src/main/ets/pages/SetDifferentAttributes.ets @@ -24,7 +24,7 @@ struct TestHeightPage { @State message: string = 'Hello World'; @State myHeight1: number = 30; @State myHeight2: number = 60; - @State flag: Boolean = false + @State flag: boolean = false build() { Column() { diff --git a/ArkUI/entry/src/main/ets/pages/SetWindowPrivacyModeInPage.ets b/ArkUI/entry/src/main/ets/pages/SetWindowPrivacyModeInPage.ets index 2c9e738ab7d4ebb001d0883b670e4e0720a2845f..b205f501095a2c21e2ffd73331560b0ff9fc8c5c 100644 --- a/ArkUI/entry/src/main/ets/pages/SetWindowPrivacyModeInPage.ets +++ b/ArkUI/entry/src/main/ets/pages/SetWindowPrivacyModeInPage.ets @@ -22,7 +22,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; -class windowUtils { +class WindowUtils { static setWindowPrivacyModeInPage(context: common.UIAbilityContext, isFlag: boolean) { window.getLastWindow(context).then((lastWindow) => { lastWindow.setWindowPrivacyMode(isFlag, (err: BusinessError) => { @@ -69,7 +69,7 @@ struct Index { .onNavBarStateChange((isVisible: boolean) => { // Callback triggered when navigation bar display state changes console.info('------>isVisible:' + isVisible) - windowUtils.setWindowPrivacyModeInPage(this.context.getHostContext() as common.UIAbilityContext, isVisible); + WindowUtils.setWindowPrivacyModeInPage(this.context.getHostContext() as common.UIAbilityContext, isVisible); }) } } diff --git a/ArkUI/entry/src/main/ets/pages/SimilarKeyFramesEffect.ets b/ArkUI/entry/src/main/ets/pages/SimilarKeyFramesEffect.ets index 754c76bd3459738cf251b0a7099023e05cdf4cb6..c1a2affe503e0b6bae79bae56f9a027d94b72fa9 100644 --- a/ArkUI/entry/src/main/ets/pages/SimilarKeyFramesEffect.ets +++ b/ArkUI/entry/src/main/ets/pages/SimilarKeyFramesEffect.ets @@ -36,6 +36,7 @@ struct AnimateToExample { .opacity(this.opacityValue) .onClick(() => { if (this.flag) { + // Implement multi-stage animations by animateTo this.getUIContext().animateTo({ duration: 2000, curve: Curve.EaseOut, @@ -50,10 +51,12 @@ struct AnimateToExample { onFinish: () => { } }, () => { + // Second stage, opacityValue becomes 0.2 this.opacityValue = 0.2; }) } }, () => { + // First stage, opacityValue becomes 0.5 this.opacityValue = 0.5; }) } diff --git a/ArkUI/entry/src/main/ets/pages/SoftKeyboardPopsUp.ets b/ArkUI/entry/src/main/ets/pages/SoftKeyboardPopsUp.ets index 15fa5ca695623a96d5c167516a6e19017b338133..c2a5b5006c9b28eb0ddacd6b33eeba39a3e474f1 100644 --- a/ArkUI/entry/src/main/ets/pages/SoftKeyboardPopsUp.ets +++ b/ArkUI/entry/src/main/ets/pages/SoftKeyboardPopsUp.ets @@ -23,7 +23,7 @@ @Component struct TextInputExample { scroller: Scroller = new Scroller(); - @State Text: string = ''; + @State text: string = ''; build() { Scroll(this.scroller) { @@ -35,15 +35,15 @@ struct TextInputExample { TextInput({ placeholder: 'Please enter the content.' }) .expandSafeArea([SafeAreaType.KEYBOARD]) .margin({ top: 200 }) - Text(`UserName:${this.Text}`) + Text(`UserName:${this.text}`) .expandSafeArea([SafeAreaType.KEYBOARD]) .width('80%') .margin({ top: 200 }) - TextInput({ placeholder: 'Please enter a user name.', text: this.Text }) + TextInput({ placeholder: 'Please enter a user name.', text: this.text }) .expandSafeArea([SafeAreaType.KEYBOARD]) .margin({ top: 200 }) .onChange((value: string) => { - this.Text = value; + this.text = value; }) } .width('100%') diff --git a/ArkUI/entry/src/main/ets/pages/WidthNotExceedingTheParentComponent.ets b/ArkUI/entry/src/main/ets/pages/WidthNotExceedingTheParentComponent.ets index b949246734b64cd2c5c9a9cb30093bcd15c8266f..208dfed2fd7cc644f77de63bfd2a637609eb7407 100644 --- a/ArkUI/entry/src/main/ets/pages/WidthNotExceedingTheParentComponent.ets +++ b/ArkUI/entry/src/main/ets/pages/WidthNotExceedingTheParentComponent.ets @@ -30,7 +30,7 @@ struct SizeExample { .fontWeight(FontWeight.Bold) .backgroundColor(0xFFFAF0) .textAlign(TextAlign.Center) - .margin( 10) + .margin(10) .size({ width: this.flag ? 60 : 80 }) .onClick(()=>{ this.flag = !this.flag @@ -40,7 +40,9 @@ struct SizeExample { .fontWeight(FontWeight.Bold) .backgroundColor(0xFFFAF0) .size({width: this.flag ? 'calc(100% - 60vp)' : 'calc(100% - 80vp)'}) - }.width(500).margin({ top: 5 }) + } + .width(500) + .margin({ top: 5 }) } } // [End width_not_exceeding_the_parent_component] \ No newline at end of file