diff --git a/AbilityKit/entry/src/main/module_fullscreen.json5 b/AbilityKit/entry/src/main/module_fullscreen.json5 index 7944299806290696d6588bac64f3d20c3ab5c13d..815fa3c6b81aebbb04117bcb6397ec0a29717079 100644 --- a/AbilityKit/entry/src/main/module_fullscreen.json5 +++ b/AbilityKit/entry/src/main/module_fullscreen.json5 @@ -34,7 +34,7 @@ "entity.system.home" ], "actions": [ - "action.system.home" + "ohos.want.action.home" ] } ] diff --git a/AbilityKit/oh-package-lock.json5 b/AbilityKit/oh-package-lock.json5 index 7fcf818273347b97063c0c0a151bb14770ca1c79..c2f6d1bc9cb330eeb990573aa7e74cbccfb64b61 100644 --- a/AbilityKit/oh-package-lock.json5 +++ b/AbilityKit/oh-package-lock.json5 @@ -1,6 +1,7 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", diff --git a/ArkUI/entry/obfuscation-rules.txt b/ArkUI/entry/obfuscation-rules.txt index 272efb6ca3f240859091bbbfc7c5802d52793b0b..bdfbc8a4955d42d6154704561f9fb50d3499ce7f 100644 --- a/ArkUI/entry/obfuscation-rules.txt +++ b/ArkUI/entry/obfuscation-rules.txt @@ -17,7 +17,11 @@ # -keep-property-name: specifies property names that you want to keep # -keep-global-name: specifies names that you want to keep in the global scope +// [Start confusion_rule] -enable-property-obfuscation -enable-toplevel-obfuscation -enable-filename-obfuscation --enable-export-obfuscation \ No newline at end of file +-enable-export-obfuscation +-keep +./src/main/ets/startup/\*\* +// [End confusion_rule] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/entryability/EntryAbilityGetHeightAndStatus.ets b/ArkUI/entry/src/main/ets/entryability/EntryAbilityGetHeightAndStatus.ets index 86808d7dd55501e7a8bc4b26e73dd23f7e903187..4cbb85c1ecd67b52f49f96d971f3743bd7bc4d91 100644 --- a/ArkUI/entry/src/main/ets/entryability/EntryAbilityGetHeightAndStatus.ets +++ b/ArkUI/entry/src/main/ets/entryability/EntryAbilityGetHeightAndStatus.ets @@ -29,10 +29,14 @@ import { window } from '@kit.ArkUI'; */ async function getWindowAvoidArea(context: common.UIAbilityContext): Promise { try { + // The default area of the system includes the status bar and navigation bar const mainWindow = await window.getLastWindow(context); - const avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM; // The default area of the system includes the status bar and navigation bar + const avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM; const avoidArea = mainWindow.getWindowAvoidArea(avoidAreaType); + const avoidAreaTypeNavigationBar = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; + const avoidAreaNavigationBar = mainWindow.getWindowAvoidArea(avoidAreaTypeNavigationBar); const height = avoidArea.topRect.height; + const heightNavigationBar = avoidAreaNavigationBar.bottomRect.height; return avoidArea } catch (e) { console.log('getWindowAvoidArea fail'); @@ -46,6 +50,8 @@ export default class MainAbility extends UIAbility { getWindowAvoidArea(this.context); windowStage.loadContent('pages/index'); } + // do something } + // [End entry_ability_height_and_status] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/DisablePullDownRefresh.ets b/ArkUI/entry/src/main/ets/pages/DisablePullDownRefresh.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0066c42d48c7a37f471bbe92b095dfa36ef6405 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/DisablePullDownRefresh.ets @@ -0,0 +1,65 @@ +/** + * FAQ:如何禁用Refresh组件的下拉刷新 + */ + +// [Start disable_pull_down_refresh] +@Entry +@Component +struct Index { + @State isRefreshing: boolean = false; + @State arr: String[] = ['0', '1', '2', '3', '4', '5']; + @State downRatio: number = 1; + + build() { + Column() { + Refresh({ refreshing: $$this.isRefreshing }) { + Column() { + Row({ space: 10 }) { + Button('不允许下拉刷新') + .onClick(() => { + this.downRatio = 0; + }) + Button('允许下拉刷新') + .onClick(() => { + this.downRatio = 1; + }) + } + + List() { + ForEach(this.arr, (item: string) => { + ListItem() { + Text('' + item) + .width('70%') + .height(80) + .fontSize(16) + .margin(10) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + }, (item: string) => item) + } + .onScrollIndex((first: number) => { + console.info(first.toString()); + }) + .width('100%') + .height('100%') + .alignListItem(ListItemAlign.Center) + .scrollBar(BarState.Off) + } + } + .onRefreshing(() => { + setTimeout(() => { + this.isRefreshing = false; + }, 2000) + console.info('onRefreshing test'); + }) + .pullDownRatio(this.downRatio) + .backgroundColor(0x89CFF0) + .refreshOffset(64) + .pullToRefresh(true) + } + } +} + +// [End disable_pull_down_refresh] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/FontGradient.ets b/ArkUI/entry/src/main/ets/pages/FontGradient.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a735cd112f95d963b5ba5164c72754f826655dc --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/FontGradient.ets @@ -0,0 +1,29 @@ +/** + * FAQ:如何实现字体渐变效果 + */ + +// [Start font_gradient] +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + RelativeContainer() { + Row() { + Text(this.message) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN) + } + .linearGradient({ + direction: GradientDirection.Right, + colors: [['#ff0631f5', 0.0], ['#ff922626', 1]] + }) + .blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN) + } + .width('100%') + .height('100%') + } +} +// [End font_gradient] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/RenderText_1.ets b/ArkUI/entry/src/main/ets/pages/RenderText_1.ets new file mode 100644 index 0000000000000000000000000000000000000000..63b268f39e7b5beaf9b410644dc5d68778bc75f5 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/RenderText_1.ets @@ -0,0 +1,24 @@ +/** + * FAQ:使用Text嵌套Span或者使用熟悉字符串渲染文本,部分文本颜色显示异常 + */ + +// [Start render_text_1] +@Entry +@Component +struct Index { + build() { + Column() { + Text() { + Span('r') + .fontColor(Color.Blue) + Span('f') + .fontColor(Color.Red) + } + .fontSize(50) + } + .width('100%') + .height('100%') + } +} + +// [End render_text_1] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/RenderText_2.ets b/ArkUI/entry/src/main/ets/pages/RenderText_2.ets new file mode 100644 index 0000000000000000000000000000000000000000..037d0d133cb548e9680cc8e0918442e599ebe2c0 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/RenderText_2.ets @@ -0,0 +1,54 @@ +/** + * FAQ:使用Text嵌套Span或者使用熟悉字符串渲染文本,部分文本颜色显示异常 + */ +import { LengthMetrics } from '@kit.ArkUI'; + +// [Start render_text_2] +@Entry +@Component +struct Index { + textController: TextController = new TextController(); + style1: MutableStyledString = new MutableStyledString(''); + + async onPageShow() { + this.style1.appendStyledString(new StyledString('sr', [{ + start: 0, + length: 2, + styledKey: StyledStringKey.FONT, + styledValue: new TextStyle({ fontColor: Color.Blue, fontSize: LengthMetrics.px(150) }) + }])); + this.style1.appendStyledString(new StyledString('fff', [{ + start: 0, + length: 5, + styledKey: StyledStringKey.FONT, + styledValue: new TextStyle({ fontColor: Color.Orange, fontSize: LengthMetrics.px(150) }) + }])); + this.textController.setStyledString(this.style1); + } + + build() { + Row() { + Column() { + Text(undefined, { controller: this.textController }) + .fontSize(30) + } + .width('100%') + } + .height('100%') + } +} + +// [End render_text_2] + +@Component +struct TextComponent { + build() { + Column() { + // [Start font_feature] + Text() + // ... + .fontFeature("\"liga\" 0") + // [End font_feature] + } + } +} \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/UseRouterJumpAndCrash.ets b/ArkUI/entry/src/main/ets/pages/UseRouterJumpAndCrash.ets new file mode 100644 index 0000000000000000000000000000000000000000..dff41c134c8214122ef6a1cf66a85ad6091a61ec --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/UseRouterJumpAndCrash.ets @@ -0,0 +1,24 @@ +/** + * FAQ:使用Router跳转导致闪退,可能是神马原因,如何排查 + */ + +@Entry +@Component +struct Index { + build() { + Column() { + Button('click') + .onClick(() => { + // [Start use_router_jump_and_crash] + this.getUIContext().getRouter().pushUrl({ + url: 'login/UserNameLoginPage' + }, () => { + this.getUIContext().getRouter().clear(); + }) + // [End use_router_jump_and_crash] + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file