diff --git a/examples/Navigation/.gitignore b/examples/Navigation/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/examples/Navigation/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/examples/Navigation/AppScope/app.json5 b/examples/Navigation/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..71444cd43794123e58289acc48fdbc6df5ea5665 --- /dev/null +++ b/examples/Navigation/AppScope/app.json5 @@ -0,0 +1,24 @@ +/* + * 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. + */ +{ + "app": { + "bundleName": "com.example.navigation", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/examples/Navigation/AppScope/resources/base/element/string.json b/examples/Navigation/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1080233f01384411ec684b58955cb8808746fdd3 --- /dev/null +++ b/examples/Navigation/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/examples/Navigation/AppScope/resources/base/media/background.png b/examples/Navigation/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/examples/Navigation/AppScope/resources/base/media/background.png differ diff --git a/examples/Navigation/AppScope/resources/base/media/foreground.png b/examples/Navigation/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/examples/Navigation/AppScope/resources/base/media/foreground.png differ diff --git a/examples/Navigation/AppScope/resources/base/media/layered_image.json b/examples/Navigation/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/examples/Navigation/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/examples/Navigation/build-profile.json5 b/examples/Navigation/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c4e2327039b5f2be3b108ebb5ac0dc48cfd54895 --- /dev/null +++ b/examples/Navigation/build-profile.json5 @@ -0,0 +1,70 @@ +/* + * 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. + */ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "material": { + "certpath": "C:/Users/luoxi/.ohos/config/openharmony/default_Navigation_hRdFfJREem--ENMTDkSd3_z6LDEgdRv48bsIR_2xCCA=.cer", + "keyAlias": "debugKey", + "keyPassword": "0000001B19D5983604C0A8393870C0D4613D14C573C42369AE6CCE20C174CF6BA3A1E76C8E3D75CA49E3D0", + "profile": "C:/Users/luoxi/.ohos/config/openharmony/default_Navigation_hRdFfJREem--ENMTDkSd3_z6LDEgdRv48bsIR_2xCCA=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:/Users/luoxi/.ohos/config/openharmony/default_Navigation_hRdFfJREem--ENMTDkSd3_z6LDEgdRv48bsIR_2xCCA=.p12", + "storePassword": "0000001B0D0E3525F44B2AE9D526D3683052EA5FD768199CAB908D4FEF1946DCF075C958CC6D0DE17E9ED8" + } + } + ], + "products": [ + { + "name": "default", + "signingConfig": "default", + "targetSdkVersion": 20, + "compatibleSdkVersion": 20, + "compileSdkVersion": 20, + "runtimeOS": "OpenHarmony", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/Navigation/code-linter.json5 b/examples/Navigation/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126 --- /dev/null +++ b/examples/Navigation/code-linter.json5 @@ -0,0 +1,46 @@ +/* + * 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. + */ +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/.gitignore b/examples/Navigation/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/examples/Navigation/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/examples/Navigation/entry/build-profile.json5 b/examples/Navigation/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..982dbb524bd63408e05cfbed7204dd87a31dd681 --- /dev/null +++ b/examples/Navigation/entry/build-profile.json5 @@ -0,0 +1,42 @@ +/* + * 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. + */ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/examples/Navigation/entry/hvigorfile.ts b/examples/Navigation/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..8774588471ede4c1563f09d9a1d22f764bb1fd9e --- /dev/null +++ b/examples/Navigation/entry/hvigorfile.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/examples/Navigation/entry/obfuscation-rules.txt b/examples/Navigation/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/examples/Navigation/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -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 + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/examples/Navigation/entry/oh-package.json5 b/examples/Navigation/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a --- /dev/null +++ b/examples/Navigation/entry/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * 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. + */ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/examples/Navigation/entry/src/main/ets/entryability/EntryAbility.ets b/examples/Navigation/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..435828e62f594c6c3c24b338b324b98af376760c --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,56 @@ +/* + * 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. + */ +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +const DOMAIN = 0x0000; +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); + } + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/examples/Navigation/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1 --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; + +const DOMAIN = 0x0000; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(DOMAIN, 'testTag', 'onBackup ok'); + await Promise.resolve(); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + await Promise.resolve(); + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/pages/Index.ets b/examples/Navigation/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e746265849b1c7315bf18e5384a6a8735eab9d7d --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,45 @@ +/* + * 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. + */ +import router from '@ohos.router'; + +interface ListCategories { + title:string, + url:string +} + +@Entry +@Component +struct Index { + private items : ListCategories[] = [ + {title:'Navigation-title enhanced',url:'pages/titleStyle/Index'}, + {title:'Navigation removePageById',url:'pages/removePageById/Index'}, + ] + + build() { + Column() { + List({space:'10vp'}) { + ForEach(this.items,(item : ListCategories) => { + ListItem() { + Button(item.title) + .fontSize(15) + .onClick(() => { + router.pushUrl({url:item.url}) + }) + } + }) + }.alignListItem(ListItemAlign.Center).margin({top:'10vp'}).width('100%').height('90%') + }.width('100%').height('100%').backgroundColor(0xE0FFFF) + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/pages/removePageById/Index.ets b/examples/Navigation/entry/src/main/ets/pages/removePageById/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..360e3651dd6966c112ffdb4bd2e5402bb25fba09 --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/pages/removePageById/Index.ets @@ -0,0 +1,522 @@ +/* + * 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. + */ +import observer from '@ohos.arkui.observer'; +import { common } from '@kit.AbilityKit'; + +class NavDestinationIdHelper { + private ids: string[] = []; + private static instance: NavDestinationIdHelper = new NavDestinationIdHelper() + + static getInstance() { + return NavDestinationIdHelper.instance + } + + public addId(id: string): number { + this.ids.push(id) + return this.ids.length + } + + public removeId(id: string): boolean { + let index: number = this.ids.findIndex(element => element === id) + if (index === -1) { + return false + } + this.ids.splice(index, 1) + return true + } + + public getIdArray(): string[] { + return this.ids + } +} + +@Entry +@Component +struct Index { + stack: NavPathStack = new NavPathStack() + private context = getContext(this) as common.UIAbilityContext;//新增 + + routerPageUpdateCallback(info: RouterPageInfo) { + if(info){ + console.log(`testTag routerPageUpdateCallback, + index: ${info.index}, + name: ${info.name}, path: ${info.path}, state: ${info.state}, + pageId: ${info.pageId}`); + } + } + + observerOnRouter(){ + observer.on('routerPageUpdate', this.context, this.routerPageUpdateCallback); + }//新增 + + observerOffRouter(){ + observer.off('routerPageUpdate', this.context, this.routerPageUpdateCallback); + }//新增 + + @Builder + pageMap(name: string) { + if (name == 'dest') { + Dest() + }else if(name=='pageOne'){ + pageOneTmp() + }else if(name=='pageTwo'){ + pageTwo() + } + } + + aboutToAppear(): void { + this.stack.pushPath({name: 'dest'}) + } + + onPageShow(): void { + if (this.stack.size() === 0) { + this.stack.pushPath({name: 'dest'}) + } + } + + build() { + Navigation(this.stack) { + Button('push destination').margin(20) + .onClick(() => { + this.stack.pushPath({name: 'dest'}) + }) + } + .hideNavBar(true) + .navDestination(this.pageMap) + } +} + +@Component +struct pageTwo { + build(){ + NavDestination(){ + Text('this is pageTwo') + }.mode(NavDestinationMode.DIALOG) + .backgroundColor('rgba(255,242,22,6)') + } +} +@Component +struct Dest { + stack: NavPathStack = new NavPathStack() + @State curId: string = 'NA' + @State idArray: string[] = NavDestinationIdHelper.getInstance().getIdArray(); + @State editText: string = 'indicate ids to remove, split by space' + @State text2:string = '' + updateIdArray() { + this.idArray = NavDestinationIdHelper.getInstance().getIdArray(); + } + navDesUpdateCallback(info: NavDestinationInfo) { + console.log(JSON.stringify(info)) + } + observerOn(){ + observer.on('navDestinationUpdate', this.navDesUpdateCallback); + } + observerOff(){ + observer.off('navDestinationUpdate', this.navDesUpdateCallback); + } + build() { + NavDestination() { + Text('current page:dest').fontWeight(FontWeight.Bolder) + Column() { + Text('current id: ' + this.curId) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .margin(15) + Text('all id: ' + JSON.stringify(this.idArray)) + .fontSize(18) + .margin(20) + } + .backgroundColor(Color.Pink) + Row({space:5}) { + Button('push*5').margin(3) + .onClick(() => { + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + }) + Button('pop').onClick(()=>this.stack.pop()) + Button('push new dest').margin(3) + .onClick(() => { + this.stack.pushPath({ name: 'dest' }) + }) + } + Row({space:5}){ + Button('remove by invalid id').margin(5) + .onClick(() => { + let ret = this.stack.removeByNavDestinationId('__INVALID__') + console.log('[removeById][demo] remove invalid id\'s return value: ' + ret) + AlertDialog.show({message:'remove invalid id\'s return value: ' + ret}) + }) + Button('remove by currentId').margin(5) + .onClick(() => { + let ret = this.stack.removeByNavDestinationId(this.curId) + console.log('[removeById][demo] remove curId\'s return value: ' + ret) + AlertDialog.show({message:' remove curId\'s return value: ' + ret}) + }) + } + Row(){ + Button('remove by top - 1 id').margin(5).fontSize(15) + .onClick(() => { + let ids = NavDestinationIdHelper.getInstance().getIdArray() + if (ids.length <= 1) { + return; + } + let id = ids[ids.length - 2] + let ret = this.stack.removeByNavDestinationId(id) + console.log('[removeById][demo] remove top - 1 id\'s return value: ' + ret) + + setTimeout(() => { + this.updateIdArray() + }, 200) + }) + Button('push pageOne dest').fontSize(15) + .onClick(()=>{ + this.stack.pushPath({name:'pageOne'}) + }) + } + + Button('removeByName currentPage dest').onClick(()=>{ + this.stack.removeByName('dest') + }) + Row({space:3}){ + Button('removeByCurrentId+pop').onClick(()=>{ + let ret = this.stack.removeByNavDestinationId(this.curId) + AlertDialog.show({message:' remove curId\'s return value: ' + ret}) + this.stack.pop() + }) + Button('removeById:5 *5').onClick(()=>{ + let ret1=this.stack.removeByNavDestinationId('5') + let ret2=this.stack.removeByNavDestinationId('5') + let ret3=this.stack.removeByNavDestinationId('5') + let ret4=this.stack.removeByNavDestinationId('5') + let ret5=this.stack.removeByNavDestinationId('5') + AlertDialog.show({message:' remove curId\'s return value: ' + + ret1+' '+ret2+' '+ret3+' '+ret4+' '+ret5}) + }) + } + Row({space:3}){ + Button('removeByCurrentId:0').onClick(()=>{ + this.stack.removeByNavDestinationId('0') + }) + Button('get', { stateEffect: true, type: ButtonType.Capsule }) + .height(40) + .margin(20) + .onClick(() => { + console.log('getAllPathName:', JSON.stringify(this.stack.getAllPathName())) + console.log('getParamByIndex:', JSON.stringify(this.stack.getParamByIndex(1))) + console.log('getParamByName:', JSON.stringify(this.stack.getParamByName('dest'))) + console.log('getIndexByName:', JSON.stringify(this.stack.getIndexByName('dest'))) + console.log('get stack size:', JSON.stringify(this.stack.size())) + }) + } + Row({space:5}){ + Button('observerOn') + .onClick(() => { + this.observerOn() + }) + + Button('observerOff') + .onClick(() => { + this.observerOff() + }) + } + TextInput({text: this.editText}) + .margin(20) + .width('75%') + .backgroundColor('#ccc') + .fontWeight(200) + .onEditChange((isEditing) => { + this.editText = isEditing ? '' : 'indicate ids to remove, split by space' + }) + .onSubmit((enterKey: EnterKeyType, event: SubmitEvent) => { + let deletedIds = event.text.split(' '); + let removeSuccessIds: string[] = [] + let removeFailedIds: string[] = [] + for (let index = 0; index < deletedIds.length; ++ index) { + let deletedId = deletedIds[index] + if (this.stack.removeByNavDestinationId(deletedId)) { + removeSuccessIds.push(deletedId) + } else { + removeFailedIds.push(deletedId) + } + } + console.log('[removeById][demo] result of remove indicated ids:') + console.log('[removeById][demo] --> remove success: ' + removeSuccessIds) + console.log('[removeById][demo] --> remove failed : ' + removeFailedIds) + setTimeout(() => { + this.updateIdArray() + }, 200) + }) + Text(this.text2).fontWeight(FontWeight.Bold).fontColor('#FFBB00') + Button(`getAllPathName`, { stateEffect: true, type: ButtonType.Capsule }) + .width('80%') + .height(40) + .margin(10) + .onClick(() => { + this.text2 = JSON.stringify(this.stack.getAllPathName()) + }) + } + .onReady((ctx) => { + this.stack = ctx.pathStack + this.curId = ctx.navDestinationId ? ctx.navDestinationId : '__invalid__' + NavDestinationIdHelper.getInstance().addId(this.curId) + }) + .onShown(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onShown') + this.updateIdArray() + }) + .onWillDisappear(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onWillDisAppear') + NavDestinationIdHelper.getInstance().removeId(this.curId) + }) + .onDisAppear(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onDisAppear') + }) + .onWillAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillAppear') + }) + .onAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onAppear') + }) + .onWillShow(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillShow') + }) + .onShown(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onShown') + }) + .onWillHide(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillHide') + }) + .onHidden(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onHidden') + }) + .onWillDisappear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillDisappear') + }) + .onDisAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onDisAppear') + }) + } +} + +@Component +struct pageOneTmp { + stack: NavPathStack = new NavPathStack() + @State curId: string = 'NA' + @State idArray: string[] = NavDestinationIdHelper.getInstance().getIdArray(); + @State editText: string = 'indicate ids to remove, split by space' + @State text2:string = '' + updateIdArray() { + this.idArray = NavDestinationIdHelper.getInstance().getIdArray(); + } + navDesUpdateCallback(info: NavDestinationInfo) { + console.log(JSON.stringify(info)) + } + observerOn(){ + observer.on('navDestinationUpdate', this.navDesUpdateCallback); + } + + observerOff(){ + observer.off('navDestinationUpdate', this.navDesUpdateCallback); + } + build() { + NavDestination() { + Text('current page:dest').fontWeight(FontWeight.Bolder) + Column() { + Text('current id: ' + this.curId) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .margin(15) + Text('all id: ' + JSON.stringify(this.idArray)) + .fontSize(18) + .margin(20) + } + .backgroundColor(Color.Pink) + Row({space:5}) { + Button('push*5').margin(3) + .onClick(() => { + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + this.stack.pushPath({ name: 'dest' }) + }) + Button('pop').onClick(()=>this.stack.pop()) + Button('push new dest').margin(3) + .onClick(() => { + this.stack.pushPath({ name: 'dest' }) + }) + } + Row({space:5}){ + Button('remove by invalid id').margin(5) + .onClick(() => { + let ret = this.stack.removeByNavDestinationId('__INVALID__') + console.log('[removeById][demo] remove invalid id\'s return value: ' + ret) + AlertDialog.show({message:'remove invalid id\'s return value: ' + ret}) + }) + Button('remove by currentId').margin(5) + .onClick(() => { + let ret = this.stack.removeByNavDestinationId(this.curId) + console.log('[removeById][demo] remove curId\'s return value: ' + ret) + AlertDialog.show({message:' remove curId\'s return value: ' + ret}) + }) + } + Row(){ + Button('remove by top - 1 id').margin(5).fontSize(15) + .onClick(() => { + let ids = NavDestinationIdHelper.getInstance().getIdArray() + if (ids.length <= 1) { + return; + } + let id = ids[ids.length - 2] + let ret = this.stack.removeByNavDestinationId(id) + console.log('[removeById][demo] remove top - 1 id\'s return value: ' + ret) + + setTimeout(() => { + this.updateIdArray() + }, 200) + }) + Button('push pageOne dest').fontSize(15) + .onClick(()=>{ + this.stack.pushPath({name:'pageOne'}) + }) + } + Button('removeByName currentPage dest').onClick(()=>{ + this.stack.removeByName('dest') + }) + Row({space:3}){ + Button('removeByCurrentId+pop').onClick(()=>{ + let ret = this.stack.removeByNavDestinationId(this.curId) + AlertDialog.show({message:' remove curId\'s return value: ' + ret}) + this.stack.pop() + }) + Button('removeById:5 *5').onClick(()=>{ + let ret1=this.stack.removeByNavDestinationId('5') + let ret2=this.stack.removeByNavDestinationId('5') + let ret3=this.stack.removeByNavDestinationId('5') + let ret4=this.stack.removeByNavDestinationId('5') + let ret5=this.stack.removeByNavDestinationId('5') + AlertDialog.show({message:' remove curId\'s return value: ' + + ret1+' '+ret2+' '+ret3+' '+ret4+' '+ret5}) + }) + } + Row({space:3}){ + Button('removeByCurrentId:0').onClick(()=>{ + this.stack.removeByNavDestinationId('0') + }) + Button('get', { stateEffect: true, type: ButtonType.Capsule }) + .height(40) + .margin(20) + .onClick(() => { + console.log('getAllPathName:', JSON.stringify(this.stack.getAllPathName())) + console.log('getParamByIndex:', JSON.stringify(this.stack.getParamByIndex(1))) + console.log('getParamByName:', JSON.stringify(this.stack.getParamByName('dest'))) + console.log('getIndexByName:', JSON.stringify(this.stack.getIndexByName('dest'))) + console.log('get stack size:', JSON.stringify(this.stack.size())) + }) + } + Row({space:5}){ + Button('observerOn') + .onClick(() => { + this.observerOn() + }) + + Button('observerOff') + .onClick(() => { + this.observerOff() + }) + } + TextInput({text: this.editText}) + .margin(20) + .width('75%') + .backgroundColor('#ccc') + .fontWeight(200) + .onEditChange((isEditing) => { + this.editText = isEditing ? '' : 'indicate ids to remove, split by space' + }) + .onSubmit((enterKey: EnterKeyType, event: SubmitEvent) => { + let deletedIds = event.text.split(' '); + let removeSuccessIds: string[] = [] + let removeFailedIds: string[] = [] + for (let index = 0; index < deletedIds.length; ++ index) { + let deletedId = deletedIds[index] + if (this.stack.removeByNavDestinationId(deletedId)) { + removeSuccessIds.push(deletedId) + } else { + removeFailedIds.push(deletedId) + } + } + console.log('[removeById][demo] result of remove indicated ids:') + console.log('[removeById][demo] --> remove success: ' + removeSuccessIds) + console.log('[removeById][demo] --> remove failed : ' + removeFailedIds) + + setTimeout(() => { + this.updateIdArray() + }, 200) + }) + Text(this.text2).fontWeight(FontWeight.Bold).fontColor('#FFBB00') + Button(`getAllPathName`, { stateEffect: true, type: ButtonType.Capsule }) + .width('80%') + .height(40) + .margin(10) + .onClick(() => { + this.text2 = JSON.stringify(this.stack.getAllPathName()) + }) + } + .onReady((ctx) => { + this.stack = ctx.pathStack + this.curId = ctx.navDestinationId ? ctx.navDestinationId : '__invalid__' + NavDestinationIdHelper.getInstance().addId(this.curId) + }) + .onShown(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onShown') + this.updateIdArray() + }) + .onWillDisappear(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onWillDisAppear') + NavDestinationIdHelper.getInstance().removeId(this.curId) + }) + .mode(NavDestinationMode.DIALOG) + .onDisAppear(() => { + console.log('[removeById][demo][life] id ' + this.curId + ' onDisAppear') + }) + .onWillAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillAppear') + }) + .onAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onAppear') + }) + .onWillShow(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillShow') + }) + .onShown(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onShown') + }) + .onWillHide(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillHide') + }) + .onHidden(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onHidden') + }) + .onWillDisappear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onWillDisappear') + }) + .onDisAppear(()=>{ + console.log('[removeById][demo][life] id ' + this.curId + ' onDisAppear') + }) + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/pages/titleStyle/Index.ets b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d68dd7a9282fe308cdf4701919964d9270eb2e1b --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Index.ets @@ -0,0 +1,52 @@ +/* + * 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. + */ +import router from '@ohos.router'; + +interface ListCategories { + title:string, + url:string +} + +@Entry +@Component +struct Index { + @State message: string = 'Navigation titleStyle enhanced' + private items : ListCategories[] = [ + {title:'Navigation-title set backgroundColor',url:'pages/titleStyle/Test3'}, + {title:'Navigation-title set blur',url:'pages/titleStyle/Test4'}, + ] + + build() { + Column() { + Text(this.message) + .fontSize(22).fontColor(0xFFFFFF) + .fontWeight(FontWeight.Bold) + .textAlign(TextAlign.Center) + .width('100%').padding(5) + .backgroundColor('#1770b9') + List({space:'10vp'}) { + ForEach(this.items,(item : ListCategories) => { + ListItem() { + Button(item.title) + .fontSize(15) + .onClick(() => { + router.pushUrl({url:item.url}) + }) + } + }) + }.alignListItem(ListItemAlign.Center).margin({top:'10vp'}).width('100%').height('90%') + }.width('100%').height('100%').backgroundColor(0xE0FFFF) + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test3.ets b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test3.ets new file mode 100644 index 0000000000000000000000000000000000000000..4bb7f9db4de9e59306a43ba453635759e3e987f5 --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test3.ets @@ -0,0 +1,162 @@ +/* + * 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. + */ +@Entry +@Component +struct Index71553 { + @State titleModeValue: NavigationTitleMode[] = [ + NavigationTitleMode.Free, + NavigationTitleMode.Mini, + NavigationTitleMode.Full + ] + @State titleModeValueIndex: number = 0 + @State titleModeValueStr: string[] = ['NavigationTitleMode.Free', 'NavigationTitleMode.Mini', 'NavigationTitleMode.Full'] + @State modeValue: NavigationMode[] = [NavigationMode.Stack, NavigationMode.Split, NavigationMode.Auto] + @State modeValueIndex: number = 0 + @State modeValueStr: string[] = ['NavigationMode.Stack', 'NavigationMode.Split', 'NavigationMode.Auto'] + @State barStyleValue: BarStyle[] = [BarStyle.STANDARD, BarStyle.STACK] + @State barStyleIndex: number = 0 + @State barStyleStr: string[] = ['BarStyle.STANDARD', 'BarStyle.STACK'] + @State hideBackButtonValue:boolean = false + private arr: number[] = [0, 1] + @State titleValue: (ResourceStr | NavigationCommonTitle) [] = [ + '主标题', '主标题主标题主标题主标题主标题主标题', '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串' + + '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串', + {main:'主标题', sub:'副标题'}, {main:'主标题主标题主标题主标题主标题主标题', sub:'副标题副标题副标题副标题副标题副标题'}, + {main:'主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串' + + '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串', + sub:'副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串' + + '副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串'}, + 'سۆزلىگقۇبۇل', + 'سۆزلىسۆسۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل', + 'ۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگق' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ', + {main:'سۆزلىگقۇبۇل', sub:'سۆزلىگقۇبۇل'}, + {main:'سۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل', sub:'سۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل'}, + { + main:'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' , + sub:'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + }, + 'བོད་ཀྱ','བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ', 'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག', {main:'བོད་ཀྱ', sub:'བོད་ཀྱ'}, + {main:'བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ', sub:'བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ'}, + {main:'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག', + sub:'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག'}, + ] + @State titleValueStr: string[] = ['主标题-中文-短文本', '主标题-中文-中文本', '主标题-中文-长文本', + '主副标题-中文-短文本','主副标题-中文-中文本', '主副标题-中文-长文本', + '主标题-维吾尔语-短文本', '主标题-维吾尔语-中文本','主标题-维吾尔语-长文本', + '主副标题-维吾尔语-短文本', '主副标题-维吾尔语-中文本','主副标题-维吾尔语-长文本', + '主标题-藏语-短文本', '主标题-藏语-中文本', '主标题-藏语-长文本', + '主副标题-藏语-短文本', '主副标题-藏语-中文本','主副标题-藏语-长文本'] + @State titleValueIndex: number = 0 + @State edgesValue: SafeAreaEdge[][] = [ + [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END], + [ SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END] + ] + @State edgesValueStr: string[] = ['expand to unsafe area','safe area remove TOP'] + @State edgesValueIndex: number = 0 + @State navBarPositionValue:NavBarPosition[] = [NavBarPosition.Start, NavBarPosition.End] + @State navBarPositionValueStr:string[] = ['NavBarPosition.Start', 'NavBarPosition.End'] + @State navBarPositionValueIndex:number = 0 + build() { + Navigation() { + Column({ space: 10 }) { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('' + item) + .width('100%') + .height(150) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Orange) + } + }, (item: string) => item) + } + .scrollBar(BarState.Off) + .width('90%') + .height('30%') + Column({ space: 5 }) { + Button('title:' + this.titleValueStr[this.titleValueIndex]) + .onClick(() => { + this.titleValueIndex++ + if (this.titleValueIndex > this.titleValueStr.length - 1) { + this.titleValueIndex = 0 + } + }) + Button('titleMode:' + this.titleModeValueStr[this.titleModeValueIndex]) + .onClick(() => { + this.titleModeValueIndex++ + if (this.titleModeValueIndex > this.titleModeValue.length - 1) { + this.titleModeValueIndex = 0 + } + }) + Button('mode:' + this.modeValueStr[this.modeValueIndex]) + .onClick(() => { + this.modeValueIndex++ + if (this.modeValueIndex > this.modeValue.length - 1) { + this.modeValueIndex = 0 + } + }) + Button('barStyle:' + this.barStyleStr[this.barStyleIndex]) + .onClick(() => { + this.barStyleIndex++ + if (this.barStyleIndex > this.barStyleValue.length - 1) { + this.barStyleIndex = 0 + } + }) + Button('hideBackButton:' + this.hideBackButtonValue) + .onClick(() => { + this.hideBackButtonValue = !this.hideBackButtonValue + }) + Button('expandSafeArea:' + this.edgesValueStr[this.edgesValueIndex]) + .onClick(() => { + this.edgesValueIndex++ + if (this.edgesValueIndex > this.edgesValue.length - 1) { + this.edgesValueIndex = 0 + } + }) + Button('navBarPosition:' + this.navBarPositionValueStr[this.navBarPositionValueIndex]) + .onClick(() => { + this.navBarPositionValueIndex++ + if (this.navBarPositionValueIndex > this.navBarPositionValue.length - 1) { + this.navBarPositionValueIndex = 0 + } + }) + } + }.height('100%') + } + .title(this.titleValue[this.titleValueIndex], {backgroundColor:Color.Pink, + barStyle:this.barStyleValue[this.barStyleIndex]}) + .titleMode(this.titleModeValue[this.titleModeValueIndex]) + .mode(this.modeValue[this.modeValueIndex]) + .hideBackButton(this.hideBackButtonValue) + .navBarWidthRange(['150vp','432vp']) + .minContentWidth('50vp') + .borderWidth(1) + .expandSafeArea([SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD], + this.edgesValue[this.edgesValueIndex]) + .navBarPosition(this.navBarPositionValue[this.navBarPositionValueIndex]) + .backgroundColor('#ffd5e5fa') + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test4.ets b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test4.ets new file mode 100644 index 0000000000000000000000000000000000000000..6311b97345313542ba7a5ecef5834290e2a47128 --- /dev/null +++ b/examples/Navigation/entry/src/main/ets/pages/titleStyle/Test4.ets @@ -0,0 +1,179 @@ +/* + * 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. + */ +@Entry +@Component +struct Index71554 { + @State titleModeValue: NavigationTitleMode[] = [ + NavigationTitleMode.Free, + NavigationTitleMode.Mini, + NavigationTitleMode.Full + ] + @State titleModeValueIndex: number = 0 + @State titleModeValueStr: string[] = ['NavigationTitleMode.Free', 'NavigationTitleMode.Mini', 'NavigationTitleMode.Full'] + @State modeValue: NavigationMode[] = [ NavigationMode.Stack, NavigationMode.Split, NavigationMode.Auto] + @State modeValueIndex: number = 0 + @State modeValueStr: string[] = ['NavigationMode.Stack', 'NavigationMode.Split', 'NavigationMode.Auto'] + @State barStyleValue: BarStyle[] = [ BarStyle.STANDARD, BarStyle.STACK] + @State barStyleIndex: number = 1 + @State barStyleStr: string[] = ['BarStyle.STANDARD', 'BarStyle.STACK'] + @State hideBackButtonValue:boolean = false + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State titleValue: (ResourceStr | NavigationCommonTitle) [] = [ + '主标题', + '主标题主标题主标题主标题主标题主标题', + '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串' + + '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串', + {main:'主标题', sub:'副标题'}, {main:'主标题主标题主标题主标题主标题主标题', sub:'副标题副标题副标题副标题副标题副标题'}, + {main:'主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串' + + '主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串主标题超长字符串', + sub:'副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串' + + '副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串副标题超长字符串'}, + 'سۆزلىگقۇبۇل', + 'سۆزلىسۆسۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل', + 'ۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگق' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ', + {main:'سۆزلىگقۇبۇل', sub:'سۆزلىگقۇبۇل'}, + {main:'سۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل', sub:'سۆزلىسۆزلىسۆزلىگقۇبۇلسۆزلىگقۇبۇل'}, + { + main:'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' , + sub:'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'سۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆ' + + 'زلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇلسۆزلىگقۇبۇل' + }, + 'བོད་ཀྱ','བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ', 'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག', {main:'བོད་ཀྱ', sub:'བོད་ཀྱ'}, + {main:'བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ', sub:'བོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱབོད་ཀྱ'}, + {main:'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག', + sub:'བོད་ཀྱབོད་ཀྱབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག' + + 'བོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིགབོད་ཀྱི་སྐད་ཡིག'}, + ] + @State titleValueStr: string[] = ['主标题-中文-短文本', '主标题-中文-中文本', '主标题-中文-长文本', + '主副标题-中文-短文本','主副标题-中文-中文本', '主标题-中文-长文本', + '主标题-维吾尔语-短文本', '主标题-维吾尔语-中文本','主标题-维吾尔语-长文本', + '主副标题-维吾尔语-短文本', '主副标题-维吾尔语-中文本','主副标题-维吾尔语-长文本', + '主标题-藏语-短文本', '主标题-藏语-中文本', '主标题-藏语-长文本', + '主副标题-藏语-短文本', '主副标题-藏语-中文本','主副标题-藏语-长文本'] + @State titleValueIndex: number = 0 + + @State edgesValue: SafeAreaEdge[][] = [ + [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END], + [ SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END] + ] + @State edgesValueStr: string[] = ['expand to unsafe area','safe area remove TOP'] + @State edgesValueIndex: number = 0 + + @State navBarPositionValue:NavBarPosition[] = [NavBarPosition.Start, NavBarPosition.End] + @State navBarPositionValueStr:string[] = ['NavBarPosition.Start', 'NavBarPosition.End'] + @State navBarPositionValueIndex:number = 0 + + build() { + Navigation() { + Column({ space: 10 }) { + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('' + item) + .width('100%') + .height(150) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Orange) + } + }, (item: string) => item) + } + .width('90%') + .height('30%') + + Scroll(){ + Column({ space: 5 }) { + Button('title:' + this.titleValueStr[this.titleValueIndex]) + .onClick(() => { + this.titleValueIndex++ + if (this.titleValueIndex > this.titleValueStr.length - 1) { + this.titleValueIndex = 0 + } + }) + + Button('titleMode:' + this.titleModeValueStr[this.titleModeValueIndex]) + .onClick(() => { + this.titleModeValueIndex++ + if (this.titleModeValueIndex > this.titleModeValue.length - 1) { + this.titleModeValueIndex = 0 + } + }) + + Button('mode:' + this.modeValueStr[this.modeValueIndex]) + .onClick(() => { + this.modeValueIndex++ + if (this.modeValueIndex > this.modeValue.length - 1) { + this.modeValueIndex = 0 + } + }) + + Button('barStyle:' + this.barStyleStr[this.barStyleIndex]) + .onClick(() => { + this.barStyleIndex++ + if (this.barStyleIndex > this.barStyleValue.length - 1) { + this.barStyleIndex = 0 + } + }) + + Button('hideBackButton:' + this.hideBackButtonValue) + .onClick(() => { + this.hideBackButtonValue = !this.hideBackButtonValue + }) + + Button('expandSafeArea:' + this.edgesValueStr[this.edgesValueIndex]) + .onClick(() => { + this.edgesValueIndex++ + if (this.edgesValueIndex > this.edgesValue.length - 1) { + this.edgesValueIndex = 0 + } + }) + + Button('navBarPosition:' + this.navBarPositionValueStr[this.navBarPositionValueIndex]) + .onClick(() => { + this.navBarPositionValueIndex++ + if (this.navBarPositionValueIndex > this.navBarPositionValue.length - 1) { + this.navBarPositionValueIndex = 0 + } + }) + } + }.height('60%') + + }.height('100%') + + } + .menus([{value:'menus'}]) + .title(this.titleValue[this.titleValueIndex],{backgroundBlurStyle:BlurStyle.Thin, + barStyle:this.barStyleValue[this.barStyleIndex]}) + .titleMode(this.titleModeValue[this.titleModeValueIndex]) + .mode(this.modeValue[this.modeValueIndex]) + .hideBackButton(this.hideBackButtonValue) + .navBarWidthRange(['150vp','432vp']) + .minContentWidth('50vp') + .borderWidth(1) + .expandSafeArea([SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD], + this.edgesValue[this.edgesValueIndex]) + .navBarPosition(this.navBarPositionValue[this.navBarPositionValueIndex]) + .backgroundColor('#ffd5e5fa') + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/module.json5 b/examples/Navigation/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c75d702e2d350523978ecaf801c22762ce7d40c0 --- /dev/null +++ b/examples/Navigation/entry/src/main/module.json5 @@ -0,0 +1,65 @@ +/* + * 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. + */ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/resources/base/element/color.json b/examples/Navigation/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/resources/base/element/float.json b/examples/Navigation/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/examples/Navigation/entry/src/main/resources/base/element/string.json b/examples/Navigation/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/resources/base/media/background.png b/examples/Navigation/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/examples/Navigation/entry/src/main/resources/base/media/background.png differ diff --git a/examples/Navigation/entry/src/main/resources/base/media/foreground.png b/examples/Navigation/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/examples/Navigation/entry/src/main/resources/base/media/foreground.png differ diff --git a/examples/Navigation/entry/src/main/resources/base/media/layered_image.json b/examples/Navigation/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/resources/base/media/startIcon.png b/examples/Navigation/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/examples/Navigation/entry/src/main/resources/base/media/startIcon.png differ diff --git a/examples/Navigation/entry/src/main/resources/base/profile/backup_config.json b/examples/Navigation/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/main/resources/base/profile/main_pages.json b/examples/Navigation/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..91a3a639326b0f7510fd8fbb226d2060e2dd3ab2 --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,9 @@ +{ + "src": [ + "pages/Index", + "pages/removePageById/Index", + "pages/titleStyle/Index", + "pages/titleStyle/Test3", + "pages/titleStyle/Test4" + ] +} diff --git a/examples/Navigation/entry/src/main/resources/dark/element/color.json b/examples/Navigation/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/examples/Navigation/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/examples/Navigation/entry/src/mock/mock-config.json5 b/examples/Navigation/entry/src/mock/mock-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..323d1d611fecf4ecb751976e3a71500b3712a445 --- /dev/null +++ b/examples/Navigation/entry/src/mock/mock-config.json5 @@ -0,0 +1,16 @@ +/* + * 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. + */ +{ +} \ No newline at end of file diff --git a/examples/Navigation/hvigor/hvigor-config.json5 b/examples/Navigation/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4d435603637cbbfe92ac9865537a0c1051810bb1 --- /dev/null +++ b/examples/Navigation/hvigor/hvigor-config.json5 @@ -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. + */ +{ + "modelVersion": "5.0.5", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/examples/Navigation/hvigorfile.ts b/examples/Navigation/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b365cacd0191d3b1178eb6b9807b1ae0add6271 --- /dev/null +++ b/examples/Navigation/hvigorfile.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/examples/Navigation/oh-package.json5 b/examples/Navigation/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..38abfd099681aeb547cf83a4966111dd5f4f6d13 --- /dev/null +++ b/examples/Navigation/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * 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. + */ +{ + "modelVersion": "5.0.5", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.21", + "@ohos/hamock": "1.0.0" + } +}