diff --git a/AppScope/app.json5 b/AppScope/app.json5 index 14e46d8d2c265a7f7e15bf15fe7210a015871546..f5fe505e51f9ee92ac732fe90923fbb03be8f807 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -19,8 +19,7 @@ "vendor": "samples", "versionCode": 1000000, "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "distributedNotificationEnabled": true + "icon": "$media:layered_image", + "label": "$string:app_name" } } diff --git a/AppScope/resources/base/media/background.png b/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/AppScope/resources/base/media/background.png differ diff --git a/AppScope/resources/base/media/foreground.png b/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/AppScope/resources/base/media/foreground.png differ diff --git a/AppScope/resources/base/media/layered_image.json b/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/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/README.en.md b/README.en.md index ec623a2b16ad8319ad33af3e0c61384400058ea5..313bfc0faf8f712a9276dcb60f03a50f06118232 100644 --- a/README.en.md +++ b/README.en.md @@ -72,19 +72,15 @@ LanguageBaseClassLibrary │ ├──Logger.ets // Logger │ └──ResourceUtil.ets // Resource management util class ├──common/src/main/resources // Directory of resource files -│ ├──entry/src/main/ets // Home page of the language base class library application │ ├──entryability │ │ └──EntryAbility.ets │ └──pages -│ ├──component -│ │ └──Capabilities.ets // Display the corresponding sub-page based on the tapped menu. │ ├──AddInformationView.ets // Page for adding a contact │ ├──AddKeyValuePairView.ets // Page for adding the key-value pair │ ├──AddStringView.ets // Page for add a string │ └──Index.ets // Home page -├──entry/src/main/resources // Directory of resource files -│ +├──entry/src/main/resources // Directory of resource files ├──feature/capabilities/src/main/ets // Function set │ ├──capabilities // Components of each submodule │ │ ├──ArrayListView.ets // ArrayList component @@ -136,8 +132,7 @@ LanguageBaseClassLibrary │ │ ├──RationalNumberUtil.ets │ │ └──UrlUtil.ets │ └──Constant.ts -├──feature/capabilities/src/main/resources // Directory of resource files -│ +├──feature/capabilities/src/main/resources // Directory of resource files ├──feature/menuitems/src/main/ets // Menu │ ├──components // Components │ │ ├──ItemGroup.ets @@ -188,8 +183,8 @@ N/A 1. Device type: Huawei phones -2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. +2. The HarmonyOS version must be HarmonyOS 5.0.2 Release or later. -3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. +3. The DevEco Studio version must be DevEco Studio 5.0.2 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 or later. +4. The HarmonyOS SDK version must be HarmonyOS 5.0.2 Release or later. diff --git a/README.md b/README.md index 0abdc12a27914f4ec42a05cc2b1937eb537afb69..4aa5e6eced25e016bc00b5dc62ee57893cc65b56 100644 --- a/README.md +++ b/README.md @@ -66,91 +66,88 @@ ``` LanguageBaseClassLibrary -├──common/src/main/ets //公共组件及工具类 +├──common/src/main/ets // 公共组件及工具类 │ ├──components -│ │ ├──BaseDataSource.ets //基础DataSource -│ │ ├──CustomDataSource.ets //自定义DataSource,LazyForEach时使用 -│ │ └──EmptyPage.ets //空白页组件 +│ │ ├──BaseDataSource.ets // 基础DataSource +│ │ ├──CustomDataSource.ets // 自定义DataSource,LazyForEach时使用 +│ │ └──EmptyPage.ets // 空白页组件 │ └──util -│ ├──Logger.ets //日志工具类 -│ └──ResourceUtil.ets //资源管理工具类 +│ ├──Logger.ets // 日志工具类 +│ └──ResourceUtil.ets // 资源管理工具类 ├──common/src/main/resources // 资源文件目录 -│ -├──entry/src/main/ets //语言基础类库应用首页 +├──entry/src/main/ets // 语言基础类库应用首页 │ ├──entryability │ │ └──EntryAbility.ets │ └──pages -│ ├──component -│ │ └──Capabilities.ets //根据点击的菜单,展示对应的子界面 -│ ├──AddInformationView.ets //添加联系人页面 -│ ├──AddKeyValuePairView.ets //添加Key/Value页面 -│ ├──AddStringView.ets //添加String页面 -│ └──Index.ets //主页入口 +│ ├──AddInformationView.ets // 添加联系人页面 +│ ├──AddKeyValuePairView.ets // 添加Key/Value页面 +│ ├──AddStringView.ets // 添加String页面 +│ └──Index.ets // 主页入口 ├──entry/src/main/resources // 资源文件目录 │ -├──feature/capabilities/src/main/ets //功能集 -│ ├──capabilities //各个子模块功能组件 -│ │ ├──ArkTSUtil.ets //ArkTSUtil功能组件 -│ │ ├──ArrayListView.ets //ArrayList功能组件 -│ │ ├──ConvertXml.ets //ConvertXml功能组件 -│ │ ├──DequeView.ets //DequeView功能组件 -│ │ ├──HashMapView.ets //HashMapView功能组件 -│ │ ├──HashSetView.ets //HashSetView功能组件 -│ │ ├──LightWeightMapView.ets //LightWeightMapView功能组件 -│ │ ├──LightWeightSetView.ets //LightWeightSetView功能组件 -│ │ ├──LinkedListView.ets //LinkedListView功能组件 -│ │ ├──ListView.ets //ListView功能组件 -│ │ ├──PlainArrayView.ets //PlainArrayView功能组件 -│ │ ├──QueueView.ets //QueueView功能组件 -│ │ ├──StackView.ets //StackView功能组件 -│ │ ├──TaskPool.ets //TaskPool功能组件 -│ │ ├──TreeMapView.ets //TreeMapView功能组件 -│ │ ├──TreeSetView.ets //TreeSetView功能组件 -│ │ ├──Uri.ets //Uri功能组件 -│ │ ├──Url.ets //Url功能组件 +├──feature/capabilities/src/main/ets // 功能集 +│ ├──capabilities // 各个子模块功能组件 +│ │ ├──ArkTSUtil.ets // ArkTSUtil功能组件 +│ │ ├──ArrayListView.ets // ArrayList功能组件 +│ │ ├──ConvertXml.ets // ConvertXml功能组件 +│ │ ├──DequeView.ets // DequeView功能组件 +│ │ ├──HashMapView.ets // HashMapView功能组件 +│ │ ├──HashSetView.ets // HashSetView功能组件 +│ │ ├──LightWeightMapView.ets // LightWeightMapView功能组件 +│ │ ├──LightWeightSetView.ets // LightWeightSetView功能组件 +│ │ ├──LinkedListView.ets // LinkedListView功能组件 +│ │ ├──ListView.ets // ListView功能组件 +│ │ ├──PlainArrayView.ets // PlainArrayView功能组件 +│ │ ├──QueueView.ets // QueueView功能组件 +│ │ ├──StackView.ets // StackView功能组件 +│ │ ├──TaskPool.ets // TaskPool功能组件 +│ │ ├──TreeMapView.ets // TreeMapView功能组件 +│ │ ├──TreeSetView.ets // TreeSetView功能组件 +│ │ ├──Uri.ets // Uri功能组件 +│ │ ├──Url.ets // Url功能组件 │ │ └──Util.ets │ ├──components -│ │ ├──arraylistcomponents //arraylist相关组件 -│ │ ├──dequecomponents //deque相关组件 -│ │ ├──hashmapcomponents //hashmap相关组件 -│ │ ├──hashsetcomponents //hashset相关组件 -│ │ ├──lightweightmapcomponents //lightweightmap相关组件 -│ │ ├──lightweightsetcomponents //lightweightset相关组件 -│ │ ├──linkedlistcomponents //linkedlist相关组件 -│ │ ├──listcomponents //list相关组件 -│ │ ├──plainarraycomponents //plainarray相关组件 -│ │ ├──queuecomponents //queue相关组件 -│ │ ├──stackcomponents //stack相关组件 -│ │ ├──treemapcomponents //treemap相关组件 -│ │ ├──treesetcomponents //treeset相关组件 -│ │ ├──utilcomponents //util相关组件 -│ │ ├──ColumnOperation.ets //展示一列功能按钮的组件 -│ │ ├──DeleteView.ets //删除按钮的组件 -│ │ ├──GridOperation.ets //根据窗口大小展示不同列的功能按钮的组件 -│ │ ├──InformationItemView.ets //联系人Item的组件 -│ │ ├──KeyValueItemView.ets //Key/Value Item的组件 -│ │ └──ValueItemView.ets //Value Item的组件 -│ ├──model //相关数据模型 +│ │ ├──arraylistcomponents // arraylist相关组件 +│ │ ├──dequecomponents // deque相关组件 +│ │ ├──hashmapcomponents // hashmap相关组件 +│ │ ├──hashsetcomponents // hashset相关组件 +│ │ ├──lightweightmapcomponents // lightweightmap相关组件 +│ │ ├──lightweightsetcomponents // lightweightset相关组件 +│ │ ├──linkedlistcomponents // linkedlist相关组件 +│ │ ├──listcomponents // list相关组件 +│ │ ├──plainarraycomponents // plainarray相关组件 +│ │ ├──queuecomponents // queue相关组件 +│ │ ├──stackcomponents // stack相关组件 +│ │ ├──treemapcomponents // treemap相关组件 +│ │ ├──treesetcomponents // treeset相关组件 +│ │ ├──utilcomponents // util相关组件 +│ │ ├──ColumnOperation.ets // 展示一列功能按钮的组件 +│ │ ├──DeleteView.ets // 删除按钮的组件 +│ │ ├──GridOperation.ets // 根据窗口大小展示不同列的功能按钮的组件 +│ │ ├──InformationItemView.ets // 联系人Item的组件 +│ │ ├──KeyValueItemView.ets // Key/Value Item的组件 +│ │ └──ValueItemView.ets // Value Item的组件 +│ ├──model // 相关数据模型 │ │ ├──Information.ets │ │ ├──KeyValuePair.ets │ │ └──ScopeNumber.ets -│ ├──utils //相关工具类 +│ ├──utils // 相关工具类 │ │ ├──ConvertXmlUtil.ets │ │ ├──JsonUtil.ets │ │ ├──LRUCacheUtil.ets │ │ ├──RationalNumberUtil.ets │ │ └──UrlUtil.ets │ └──Constant.ts -├──feature/capabilities/src/main/resources //资源文件目录 +├──feature/capabilities/src/main/resources // 资源文件目录 │ -├──feature/menuitems/src/main/ets //菜单 -│ ├──components //菜单相关自定义组件 +├──feature/menuitems/src/main/ets // 菜单 +│ ├──components // 菜单相关自定义组件 │ │ ├──ItemGroup.ets │ │ ├──MainItem.ets │ │ └──MenuNavRouter.ets │ └──menulist -│ └──MenuList.ets //菜单相关自定义组件 -└──feature/menuitems/src/main/resources //资源文件目录 +│ └──MenuList.ets // 菜单相关自定义组件 +└──feature/menuitems/src/main/resources // 资源文件目录 ``` ### 具体实现 @@ -195,8 +192,8 @@ LanguageBaseClassLibrary 1.设备类型:华为手机。 -2.HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 +2.HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。 -3.DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 +3.DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。 -4.HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 +4.HarmonyOS SDK版本:HarmonyOS 5.0.2 Release SDK及以上。 diff --git a/build-profile.json5 b/build-profile.json5 index 8a1ed641aad25106ee94a8a763b0bd43859f87e8..0947a2b77a77b9a30d4d1ff6b2dbaceae76b3f05 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,7 +5,7 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.2(14)", "runtimeOS": "HarmonyOS" } ] diff --git a/common/Index.ets b/common/Index.ets index 7130fbb344b68b9e9c0a808c3000e1f25a63d08b..7b7c8d2fa30e67add79347be6ff47de8b467355c 100644 --- a/common/Index.ets +++ b/common/Index.ets @@ -22,3 +22,5 @@ export { getString, getStringArray } from './src/main/ets/util/ResourceUtil'; export { BaseDataSource } from './src/main/ets/components/BaseDataSource'; export { EmptyPage } from './src/main/ets/components/EmptyPage'; + +export { customTitle } from './src/main/ets/util/ResourceUtil' diff --git a/common/src/main/ets/util/ResourceUtil.ets b/common/src/main/ets/util/ResourceUtil.ets index a515646db65f2ba3390ddd3a7a447e30eafb1871..4fad3578fba0f563053708dfd8a4fdb40dc3ef98 100644 --- a/common/src/main/ets/util/ResourceUtil.ets +++ b/common/src/main/ets/util/ResourceUtil.ets @@ -14,6 +14,7 @@ */ import { common } from '@kit.AbilityKit'; +import { router } from '@kit.ArkUI'; export async function getStringArray(resource: Resource): Promise> { let context = getContext() as common.UIAbilityContext; @@ -25,3 +26,81 @@ export function getString(resource: Resource): string { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getStringSync(resource); } + +@Builder +export function customTitle(title: string) { + Row() { + Text(title) + .fontColor($r('sys.color.black')) + .fontSize(16) + .fontWeight(FontWeight.Bold) + + Row() { + Image($r('app.media.ic_public_add')) + .height(24) + .aspectRatio(1) + .objectFit(ImageFit.Contain) + } + .id('add') + .height('100%') + .aspectRatio(1) + .visibility(showAddButton(title) ? Visibility.Visible : Visibility.None) + .onClick(() => { + addAction(title); + }) + } + .width('85%') + .height(56) + .margin({ left: 5 }) + .justifyContent(FlexAlign.SpaceBetween) +} + +function showAddButton(title: string) { + let ret = false + switch (title) { + case getString($r('app.string.deque')): + case getString($r('app.string.hash_map')): + case getString($r('app.string.hash_set')): + case getString($r('app.string.light_weight_map')): + case getString($r('app.string.light_weight_set')): + case getString($r('app.string.linked_list')): + case getString($r('app.string.list')): + case getString($r('app.string.array_list')): + case getString($r('app.string.plain_array')): + case getString($r('app.string.queue')): + case getString($r('app.string.stack')): + case getString($r('app.string.tree_map')): + case getString($r('app.string.tree_set')): + ret = true + break; + default: + break; + } + return ret +} + +function addAction(title: string) { + switch (title) { + case getString($r('app.string.deque')): + case getString($r('app.string.linked_list')): + case getString($r('app.string.list')): + case getString($r('app.string.queue')): + case getString($r('app.string.stack')): + case getString($r('app.string.array_list')): + router.pushUrl({ url: 'pages/AddInformationView', params: { 'title': title } }) + break; + case getString($r('app.string.hash_map')): + case getString($r('app.string.light_weight_map')): + case getString($r('app.string.plain_array')): + case getString($r('app.string.tree_map')): + router.pushUrl({ url: 'pages/AddKeyValuePairView', params: { 'title': title } }) + break; + case getString($r('app.string.hash_set')): + case getString($r('app.string.light_weight_set')): + case getString($r('app.string.tree_set')): + router.pushUrl({ url: 'pages/AddStringView', params: { 'title': title } }) + break; + default: + break; + } +} diff --git a/common/src/main/resources/base/element/string.json b/common/src/main/resources/base/element/string.json index 2097585e2d01a75d8b2e6985ce8f30feba7d38e7..c9c317f3463c4291505ca32eab4da9e57c27beb6 100644 --- a/common/src/main/resources/base/element/string.json +++ b/common/src/main/resources/base/element/string.json @@ -59,6 +59,62 @@ { "name": "tree_set", "value": "TreeSet (NonLinear Container)" + }, + { + "name": "xml", + "value": "Xml & ConvertXml (XML Parsing, Generation and convert)" + }, + { + "name": "url", + "value": "Url (URL String Parsing)" + }, + { + "name": "uri", + "value": "Uri (URI String Parsing)" + }, + { + "name": "util", + "value": "Util (util)" + }, + { + "name": "task_pool", + "value": "TaskPool (Starting the TaskPool)" + }, + { + "name": "arkts_util", + "value": "ArkTSUtil (ArkTSUtil)" + }, + { + "name": "lru_cache", + "value": "LRUCache (Lru cache)" + }, + { + "name": "base64", + "value": "Base64Helper (Base64 codec)" + }, + { + "name": "string_code", + "value": "StringCode (String encoding and decoding)" + }, + { + "name": "rational_number", + "value": "RationalNumber (RationalNumber)" + }, + { + "name": "type_check", + "value": "TypeCheck (Type check)" + }, + { + "name": "json_function", + "value": "JsonFunction (Json function)" + }, + { + "name": "scope_helper", + "value": "ScopeHelper (Scope judgment)" + }, + { + "name": "ason_function", + "value": "AsonFunction (Ason function)" } ] } diff --git a/common/src/main/resources/base/media/ic_public_add.svg b/common/src/main/resources/base/media/ic_public_add.svg new file mode 100644 index 0000000000000000000000000000000000000000..7408e5cf30864de089f352778f38594de0ce87da --- /dev/null +++ b/common/src/main/resources/base/media/ic_public_add.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/common/src/main/resources/en_US/element/string.json b/common/src/main/resources/en_US/element/string.json index 2097585e2d01a75d8b2e6985ce8f30feba7d38e7..7d79abd878d21d278273601d9d843e88dd44329e 100644 --- a/common/src/main/resources/en_US/element/string.json +++ b/common/src/main/resources/en_US/element/string.json @@ -59,6 +59,62 @@ { "name": "tree_set", "value": "TreeSet (NonLinear Container)" + }, + { + "name": "xml", + "value": "Xml & ConvertXml (XML Parsing, Generation and convert)" + }, + { + "name": "url", + "value": "Url (URL String Parsing)" + }, + { + "name": "uri", + "value": "Uri (URI String Parsing)" + }, + { + "name": "util", + "value": "Util (util)" + }, + { + "name": "arkts_util", + "value": "ArkTSUtil (ArkTSUtil)" + }, + { + "name": "task_pool", + "value": "TaskPool (Starting the TaskPool)" + }, + { + "name": "lru_cache", + "value": "LRUCache (Lru cache)" + }, + { + "name": "base64", + "value": "Base64Helper (Base64 codec)" + }, + { + "name": "string_code", + "value": "StringCode (String encoding and decoding)" + }, + { + "name": "rational_number", + "value": "RationalNumber (RationalNumber)" + }, + { + "name": "type_check", + "value": "TypeCheck (Type check)" + }, + { + "name": "json_function", + "value": "JsonFunction (Json function)" + }, + { + "name": "scope_helper", + "value": "ScopeHelper (Scope judgment)" + }, + { + "name": "ason_function", + "value": "AsonFunction (Ason function)" } ] } diff --git a/common/src/main/resources/zh_CN/element/string.json b/common/src/main/resources/zh_CN/element/string.json index 2011dc665f2806020a3e124b3c12cff2111e4fae..cb38e918829ebaec16dfa188c30250b133f167c2 100644 --- a/common/src/main/resources/zh_CN/element/string.json +++ b/common/src/main/resources/zh_CN/element/string.json @@ -59,6 +59,61 @@ { "name": "tree_set", "value": "TreeSet (非线性容器TreeSet)" + }, { + "name": "xml", + "value": "Xml & ConvertXml (XML解析,生成与转换)" + }, + { + "name": "url", + "value": "Url (Url字符串解析)" + }, + { + "name": "uri", + "value": "Uri (Uri字符串解析)" + }, + { + "name": "util", + "value": "Util (util工具函数)" + }, + { + "name": "arkts_util", + "value": "ArkTSUtil (ArkTSUtil工具函数)" + }, + { + "name": "task_pool", + "value": "TaskPool (启动任务池)" + }, + { + "name": "base64", + "value": "Base64Helper (Base64编解码)" + }, + { + "name": "string_code", + "value": "StringCode (字符串编解码)" + }, + { + "name": "rational_number", + "value": "RationalNumber (有理数)" + }, + { + "name": "type_check", + "value": "TypeCheck (类型检查)" + }, + { + "name": "json_function", + "value": "JsonFunction (Json方法)" + }, + { + "name": "scope_helper", + "value": "ScopeHelper (范围判断)" + }, + { + "name": "ason_function", + "value": "AsonFunction (Ason方法)" + }, + { + "name": "lru_cache", + "value": "LRUCache (缓冲区)" } ] } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index add3c5adf0f97f2cc8bb5ae7ab680e135c444688..1d208a5d11025747081a31fd50101073503cab08 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -14,7 +14,6 @@ */ import { router } from '@kit.ArkUI'; -import { Capabilities } from './components/Capabilities'; import { MenuList } from '@ohos/menuitems'; import { getString, logger } from '@ohos/common'; @@ -25,6 +24,7 @@ const TAG: string = 'Index'; struct Index { @StorageProp('windowWidth') windowWidth: number = 300; @StorageProp('isSplitMode') isSplitMode: boolean = false; + @StorageLink('pathStack') pathStack: NavPathStack = new NavPathStack(); @State title: string = ''; aboutToAppear() { @@ -32,7 +32,7 @@ struct Index { } build() { - Navigation() { + Navigation(this.pathStack) { Divider() .strokeWidth('1px') .color($r('sys.color.ohos_id_color_list_separator')) @@ -62,9 +62,7 @@ struct Index { break; } } - }) { - Capabilities() - } + }) } .title(this.CustomTitle()) .mode(this.isSplitMode ? NavigationMode.Split : NavigationMode.Stack) diff --git a/entry/src/main/ets/pages/components/Capabilities.ets b/entry/src/main/ets/pages/components/Capabilities.ets deleted file mode 100644 index 7ebc8bd22ff94236677899e90e9c1046b699b6f8..0000000000000000000000000000000000000000 --- a/entry/src/main/ets/pages/components/Capabilities.ets +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) 2024 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 { getString } from '@ohos/common'; - -import { - ArrayListView, - ConvertXml, - Url, - Uri, - Util, - ArkTSUtil, - TaskPool, - DequeView, - HashMapView, - HashSetView, - LightWeightMapView, - LightWeightSetView, - LinkedListView, - ListView, - PlainArrayView, - QueueView, - StackView, - TreeMapView, - TreeSetView -} from '@ohos/capabilities'; - -@Component -export struct Capabilities { - @StorageLink('selectedLabel') selectedLabel: string = ''; - - build() { - Column() { - Divider() - .strokeWidth('1px') - .color($r('sys.color.ohos_id_color_list_separator')) - Column() { - // The page content is displayed according to the selected menu. - if (this.selectedLabel === getString($r('app.string.xml'))) { - ConvertXml() - } else if (this.selectedLabel === getString($r('app.string.url'))) { - Url() - } else if (this.selectedLabel === getString($r('app.string.uri'))) { - Uri() - } else if (this.selectedLabel === getString($r('app.string.array_list'))) { - ArrayListView() - } else if (this.selectedLabel === getString($r('app.string.task_pool'))) { - TaskPool() - } else if (this.selectedLabel === getString($r('app.string.deque'))) { - DequeView() - } else if (this.selectedLabel === getString($r('app.string.hash_map'))) { - HashMapView() - } else if (this.selectedLabel === getString($r('app.string.hash_set'))) { - HashSetView() - } else if (this.selectedLabel === getString($r('app.string.light_weight_map'))) { - LightWeightMapView() - } else if (this.selectedLabel === getString($r('app.string.light_weight_set'))) { - LightWeightSetView() - } else if (this.selectedLabel === getString($r('app.string.linked_list'))) { - LinkedListView() - } else if (this.selectedLabel === getString($r('app.string.list'))) { - ListView() - } else if (this.selectedLabel === getString($r('app.string.plain_array'))) { - PlainArrayView() - } else if (this.selectedLabel === getString($r('app.string.queue'))) { - QueueView() - } else if (this.selectedLabel === getString($r('app.string.stack'))) { - StackView() - } else if (this.selectedLabel === getString($r('app.string.tree_map'))) { - TreeMapView() - } else if (this.selectedLabel === getString($r('app.string.tree_set'))) { - TreeSetView() - } else if (this.selectedLabel === getString($r('app.string.util'))) { - Util() - } else { - ArkTSUtil() - } - } - .padding({ left: 12, right: 12 }) - } - } -} \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 1aa920cdf3b91770d9e1ab816e5b22312483bfe9..071819704c3990ea2460536ba973ce878ab156d8 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -20,8 +20,7 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone", - "tablet" + "phone" ], "deliveryWithInstall": true, "installationFree": false, @@ -31,9 +30,9 @@ "name": "EntryAbility", "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", - "icon": "$media:icon", + "icon": "$media:layered_image", "label": "$string:lable_name", - "startWindowIcon": "$media:icon", + "startWindowIcon": "$media:startIcon", "startWindowBackground": "$color:start_window_background", "exported": true, "skills": [ diff --git a/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/entry/src/main/resources/base/media/background.png differ diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/entry/src/main/resources/base/media/layered_image.json b/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/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/entry/src/main/resources/base/media/startIcon.png b/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/entry/src/main/resources/base/media/startIcon.png differ diff --git a/feature/capabilities/src/main/ets/capabilities/ArkTSUtil.ets b/feature/capabilities/src/main/ets/capabilities/ArkTSUtil.ets index a657c03390fa37042a8fb7a3cb1d5c06d9d2ca51..d527f85f608f5f58c4414b49072220f5d573f590 100644 --- a/feature/capabilities/src/main/ets/capabilities/ArkTSUtil.ets +++ b/feature/capabilities/src/main/ets/capabilities/ArkTSUtil.ets @@ -13,32 +13,31 @@ * limitations under the License. */ -import { getString } from '@ohos/common'; +import { customTitle, getString } from '@ohos/common'; import { MenuList } from '@ohos/menuitems'; import { AsonFunction } from '../components/arkTSUtilcomponents/AsonFunction'; +@Builder +export function ArkTSUtilBuilder() { + ArkTSUtil() +} + @Component export struct ArkTSUtil { - @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; - - @Builder - ArkTSUtilCapabilities() { - if (this.selectedSecondLabel === getString($r('app.string.ason_function'))) { - AsonFunction() - } - } + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Column() { - MenuList({ menuList: $r('app.strarray.arkTs_util_menu'), secondLabel: true }) { - Column() { - Divider() - .strokeWidth('1px') - .color($r('sys.color.ohos_id_color_list_separator')) - this.ArkTSUtilCapabilities() - } + NavDestination() { + Column() { + MenuList({ menuList: $r('app.strarray.arkTs_util_menu'), secondLabel: true }) } + .margin({ left: -12, right: -12 }) } - .margin({ left: -12, right: -12 }) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/ArrayListView.ets b/feature/capabilities/src/main/ets/capabilities/ArrayListView.ets index 607d2fc729c57b0a66939cfb680952c5dfcf8291..e7bce1ab80e7593153e0fcfca25dff88ab1318f2 100644 --- a/feature/capabilities/src/main/ets/capabilities/ArrayListView.ets +++ b/feature/capabilities/src/main/ets/capabilities/ArrayListView.ets @@ -16,17 +16,24 @@ import { Information } from '../model/Information'; import { Constant } from '../Constant'; import { InformationItemView } from '../components/InformationItemView'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { emitter } from '@kit.BasicServicesKit'; import { ArrayListDataSource } from '../components/arraylistcomponents/ArrayListDataSource'; const MIN_LENGTH = 0; +@Builder +export function ArrayListViewBuilder() { + ArrayListView() +} + @Preview @Component export struct ArrayListView { @State dataSource: ArrayListDataSource = new ArrayListDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_ARRAY_LIST }, (eventData) => { @@ -40,28 +47,35 @@ export struct ArrayListView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ index: index, information: item, deleteAction: () => { - this.dataSource.deleteData(index); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ index: index, information: item, deleteAction: () => { + this.dataSource.deleteData(index); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/ConvertXml.ets b/feature/capabilities/src/main/ets/capabilities/ConvertXml.ets index dc62ff5a00c92ca2b2172a9baf94175fd4ff3610..81a857b08ba1dba171cc75bb48087401d87abb1e 100644 --- a/feature/capabilities/src/main/ets/capabilities/ConvertXml.ets +++ b/feature/capabilities/src/main/ets/capabilities/ConvertXml.ets @@ -13,11 +13,17 @@ * limitations under the License. */ +import { customTitle } from '@ohos/common' import { ColumnOperation } from '../components/ColumnOperation'; import { serializerNode, parserNode, convertNode } from '../util/ConvertXmlUtil'; const FULL_PERCENT: string = '100%'; +@Builder +export function ConvertXmlBuilder() { + ConvertXml() +} + @Component export struct ConvertXml { @State output: string = `eTSXmlTextConvert`; @@ -32,31 +38,40 @@ export struct ConvertXml { Work Play `; + @StorageLink('selectedLabel') selectedLabel: string = ''; + pathStack: NavPathStack = new NavPathStack(); build() { - Column() { - Scroll() { - Column() { - Text(this.output) - .width(FULL_PERCENT) - .fontSize($r('app.float.title_font_size')) - .padding($r('app.float.text_padding')) + NavDestination() { + Column() { + Scroll() { + Column() { + Text(this.output) + .width(FULL_PERCENT) + .fontSize($r('app.float.title_font_size')) + .padding($r('app.float.text_padding')) + } } - } - .border({ - width: $r('app.float.border_width'), - radius: $r('app.float.border_radius'), - color: Color.Gray - }) - .layoutWeight(1) - .scrollBar(BarState.Off) - .align(Alignment.Start) + .border({ + width: $r('app.float.border_width'), + radius: $r('app.float.border_radius'), + color: Color.Gray + }) + .layoutWeight(1) + .scrollBar(BarState.Off) + .align(Alignment.Start) - ColumnOperation({ operationRes: $r('app.strarray.convert_xml_operations'), doOperation: this.doOperation }) + ColumnOperation({ operationRes: $r('app.strarray.convert_xml_operations'), doOperation: this.doOperation }) + } + .width(FULL_PERCENT) + .height(FULL_PERCENT) + .padding($r('app.float.large_padding')) } - .width(FULL_PERCENT) - .height(FULL_PERCENT) - .padding($r('app.float.large_padding')) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } doOperation = (index: number) => { diff --git a/feature/capabilities/src/main/ets/capabilities/DequeView.ets b/feature/capabilities/src/main/ets/capabilities/DequeView.ets index b786ed584068cc14341fe1ecc2b81fc9970bdcac..2ea34250a9b91431c74183db47ebad5a5e338ea2 100644 --- a/feature/capabilities/src/main/ets/capabilities/DequeView.ets +++ b/feature/capabilities/src/main/ets/capabilities/DequeView.ets @@ -14,7 +14,7 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { Information } from '../model/Information' import { InformationItemView } from '../components/InformationItemView'; import { DequeDataSource } from '../components/dequecomponents/DequeDataSource'; @@ -22,10 +22,17 @@ import { Constant } from "../Constant"; const TAG = 'DequeView'; +@Builder +export function DequeViewBuilder() { + DequeView() +} + @Component export struct DequeView { @State totalCount: number = 0; @State dataSource: DequeDataSource = new DequeDataSource(); + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_DEQUE }, (eventData) => { @@ -40,38 +47,45 @@ export struct DequeView { } build() { - Column() { - if (this.totalCount != 0) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ - index: index, - information: item, - deleteAction: () => { - logger.info(TAG, `deleteAction: ${JSON.stringify(item)}`); - if (index === 0) { - this.dataSource.deleteFront(); - this.totalCount = this.dataSource.totalCount(); - } else if (index === this.totalCount - 1) { - this.dataSource.deleteEnd(); - this.totalCount = this.dataSource.totalCount(); + NavDestination() { + Column() { + if (this.totalCount != 0) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ + index: index, + information: item, + deleteAction: () => { + logger.info(TAG, `deleteAction: ${JSON.stringify(item)}`); + if (index === 0) { + this.dataSource.deleteFront(); + this.totalCount = this.dataSource.totalCount(); + } else if (index === this.totalCount - 1) { + this.dataSource.deleteEnd(); + this.totalCount = this.dataSource.totalCount(); + } } - } - }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) + }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/HashMapView.ets b/feature/capabilities/src/main/ets/capabilities/HashMapView.ets index 09f1471128fc042e51314ec3fe92b431b7484aa4..75caf17e4c964881d47a61c43302a4c899521de3 100644 --- a/feature/capabilities/src/main/ets/capabilities/HashMapView.ets +++ b/feature/capabilities/src/main/ets/capabilities/HashMapView.ets @@ -15,7 +15,7 @@ import { HashMap } from '@kit.ArkTS'; import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { KeyValueItemView } from '../components/KeyValueItemView'; import { KeyValuePair } from '../model/KeyValuePair'; import { HashMapDataSource } from '../components/hashmapcomponents/HashMapDataSource'; @@ -23,11 +23,18 @@ import { Constant } from '../Constant'; const TAG = 'HashMapView'; +@Builder +export function HashMapViewBuilder() { + HashMapView() +} + @Component export struct HashMapView { @State totalCount: number = 0; - private hashMap: HashMap = new HashMap(); @State dataSource: HashMapDataSource = new HashMapDataSource(); + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); + private hashMap: HashMap = new HashMap(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_HASH_MAP }, (eventData) => { @@ -43,33 +50,40 @@ export struct HashMapView { } build() { - Column() { - if (this.totalCount != 0) { - List({ space: 12 }) { - LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { - ListItem() { - KeyValueItemView({ - index: index, - keyValuePair: item, - deleteAction: () => { - logger.info(TAG, `item = ${JSON.stringify(item)}`) - this.dataSource.deleteData(item, index); - this.totalCount = this.dataSource.totalCount(); - this.hashMap.remove(item.key); - } - }) - } - .height(72) - .width('100%') - }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + NavDestination() { + Column() { + if (this.totalCount != 0) { + List({ space: 12 }) { + LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { + ListItem() { + KeyValueItemView({ + index: index, + keyValuePair: item, + deleteAction: () => { + logger.info(TAG, `item = ${JSON.stringify(item)}`) + this.dataSource.deleteData(item, index); + this.totalCount = this.dataSource.totalCount(); + this.hashMap.remove(item.key); + } + }) + } + .height(72) + .width('100%') + }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/HashSetView.ets b/feature/capabilities/src/main/ets/capabilities/HashSetView.ets index 5d531eda58f83712a250427d3873ae8abcace528..0867aa90d8b03af81112eeb40900852acd54f8c8 100644 --- a/feature/capabilities/src/main/ets/capabilities/HashSetView.ets +++ b/feature/capabilities/src/main/ets/capabilities/HashSetView.ets @@ -15,16 +15,23 @@ import { HashSet } from '@kit.ArkTS'; import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { ValueItemView } from '../components/ValueItemView'; import { HashSetDataSource } from '../components/hashsetcomponents/HashSetDataSource'; import { Constant } from '../Constant'; -const TAG = 'HashSetView' +const TAG = 'HashSetView'; + +@Builder +export function HashSetViewBuilder() { + HashSetView() +} @Component export struct HashSetView { @State totalCount: number = 0; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); private hashSet: HashSet = new HashSet(); private dataSource: HashSetDataSource = new HashSetDataSource(); @@ -45,33 +52,40 @@ export struct HashSetView { } build() { - Column() { - if (this.totalCount != 0) { - List({ space: 12 }) { - LazyForEach(this.dataSource, (item: string, index: number) => { - ListItem() { - ValueItemView({ - index: index, - value: item, - deleteAction: () => { - logger.info(TAG, `item = ${JSON.stringify(item)}`) - this.dataSource.deleteData(item, index); - this.totalCount = this.dataSource.totalCount(); - this.hashSet.remove(item); - } - }) - } - .height(72) - .width('100%') - }, (item: string, index: number) => JSON.stringify(item) + index) + NavDestination() { + Column() { + if (this.totalCount != 0) { + List({ space: 12 }) { + LazyForEach(this.dataSource, (item: string, index: number) => { + ListItem() { + ValueItemView({ + index: index, + value: item, + deleteAction: () => { + logger.info(TAG, `item = ${JSON.stringify(item)}`) + this.dataSource.deleteData(item, index); + this.totalCount = this.dataSource.totalCount(); + this.hashSet.remove(item); + } + }) + } + .height(72) + .width('100%') + }, (item: string, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/LightWeightMapView.ets b/feature/capabilities/src/main/ets/capabilities/LightWeightMapView.ets index 92d568123d41dd7b4eb9430cd934eacf4d22bfc8..ed56f42a9ca9a977cde9b57bc86c748d1d046db4 100644 --- a/feature/capabilities/src/main/ets/capabilities/LightWeightMapView.ets +++ b/feature/capabilities/src/main/ets/capabilities/LightWeightMapView.ets @@ -15,7 +15,7 @@ import { LightWeightMap } from '@kit.ArkTS'; import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { KeyValueItemView } from '../components/KeyValueItemView'; import { KeyValuePair } from '../model/KeyValuePair'; import { LightWeightMapDataSource } from '../components/lightweightmapcomponents/LightWeightMapDataSource'; @@ -24,11 +24,18 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; const TAG = 'LightWeightMapView'; +@Builder +export function LightWeightMapViewBuilder() { + LightWeightMapView() +} + @Component export struct LightWeightMapView { @State totalCount: number = 0; - private lightWeightMap: LightWeightMap = new LightWeightMap(); @State dataSource: LightWeightMapDataSource = new LightWeightMapDataSource(); + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); + private lightWeightMap: LightWeightMap = new LightWeightMap(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_LIGHT_WEIGHT_MAP }, (eventData: emitter.EventData) => { @@ -47,33 +54,40 @@ export struct LightWeightMapView { } build() { - Column() { - if (this.totalCount != 0) { - List({ space: 12 }) { - LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { - ListItem() { - KeyValueItemView({ - index: index, - keyValuePair: item, - deleteAction: () => { - logger.info(TAG, `item = ${JSON.stringify(item)}`) - this.dataSource.deleteData(item, index); - this.totalCount = this.dataSource.totalCount(); - this.lightWeightMap.remove(item.key); - } - }) - } - .height(72) - .width('100%') - }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + NavDestination() { + Column() { + if (this.totalCount != 0) { + List({ space: 12 }) { + LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { + ListItem() { + KeyValueItemView({ + index: index, + keyValuePair: item, + deleteAction: () => { + logger.info(TAG, `item = ${JSON.stringify(item)}`) + this.dataSource.deleteData(item, index); + this.totalCount = this.dataSource.totalCount(); + this.lightWeightMap.remove(item.key); + } + }) + } + .height(72) + .width('100%') + }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/LightWeightSetView.ets b/feature/capabilities/src/main/ets/capabilities/LightWeightSetView.ets index b34f8920d9c40b49e3690d84128768ef292d142e..6b3d50bcf09408b514d0c619320e070e7b7daf65 100644 --- a/feature/capabilities/src/main/ets/capabilities/LightWeightSetView.ets +++ b/feature/capabilities/src/main/ets/capabilities/LightWeightSetView.ets @@ -15,17 +15,24 @@ import { LightWeightSet } from '@kit.ArkTS'; import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { ValueItemView } from '../components/ValueItemView'; import { LightWeightSetDataSource } from '../components/lightweightsetcomponents/LightWeightSetDataSource'; import { Constant } from '../Constant'; const TAG = 'LightWeightSetView'; +@Builder +export function LightWeightSetViewViewBuilder() { + LightWeightSetView() +} + @Component export struct LightWeightSetView { @State totalCount: number = 0; @State lightWeightSet: LightWeightSet = new LightWeightSet(); + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); private dataSource: LightWeightSetDataSource = new LightWeightSetDataSource(); aboutToAppear() { @@ -45,33 +52,40 @@ export struct LightWeightSetView { } build() { - Column() { - if (this.totalCount != 0) { - List({ space: 12 }) { - LazyForEach(this.dataSource, (item: string, index: number) => { - ListItem() { - ValueItemView({ - index: index, - value: item, - deleteAction: () => { - logger.info(TAG, `item = ${JSON.stringify(item)}`) - this.dataSource.deleteData(item, index); - this.totalCount = this.dataSource.totalCount(); - this.lightWeightSet.remove(item); - } - }) - } - .height(72) - .width('100%') - }, (item: string, index: number) => JSON.stringify(item) + index) + NavDestination() { + Column() { + if (this.totalCount != 0) { + List({ space: 12 }) { + LazyForEach(this.dataSource, (item: string, index: number) => { + ListItem() { + ValueItemView({ + index: index, + value: item, + deleteAction: () => { + logger.info(TAG, `item = ${JSON.stringify(item)}`) + this.dataSource.deleteData(item, index); + this.totalCount = this.dataSource.totalCount(); + this.lightWeightSet.remove(item); + } + }) + } + .height(72) + .width('100%') + }, (item: string, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/LinkedListView.ets b/feature/capabilities/src/main/ets/capabilities/LinkedListView.ets index b7389134ece1739b5682b499e688e097a95234ce..a32440be586b1831ef49e573fd28c62519da2b4c 100644 --- a/feature/capabilities/src/main/ets/capabilities/LinkedListView.ets +++ b/feature/capabilities/src/main/ets/capabilities/LinkedListView.ets @@ -14,18 +14,25 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage, logger } from '@ohos/common'; +import { customTitle, EmptyPage, logger } from '@ohos/common'; import { Information } from '../model/Information' import { InformationItemView } from '../components/InformationItemView'; import { LinkedListDataSource } from '../components/linkedlistcomponents/LinkedListDataSource' import { Constant } from '../Constant'; -const TAG = 'LinkedListView' +const TAG = 'LinkedListView'; + +@Builder +export function LinkedListViewBuilder() { + LinkedListView() +} @Component export struct LinkedListView { @State totalCount: number = 0; @State dataSource: LinkedListDataSource = new LinkedListDataSource(); + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_LINKED_LIST }, (eventData) => { @@ -40,41 +47,48 @@ export struct LinkedListView { } build() { - Column() { - if (this.totalCount != 0) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ - index: index, - information: item, - deleteAction: () => { - logger.info(TAG, `deleteAction: ${JSON.stringify(item)}`); - if (index === 0) { - this.dataSource.deleteFirst(); - this.totalCount = this.dataSource.totalCount(); - } else if (index === this.totalCount - 1) { - this.dataSource.deleteLast(); - this.totalCount = this.dataSource.totalCount(); - } else { - this.dataSource.deleteData(index); - this.totalCount = this.dataSource.totalCount(); + NavDestination() { + Column() { + if (this.totalCount != 0) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ + index: index, + information: item, + deleteAction: () => { + logger.info(TAG, `deleteAction: ${JSON.stringify(item)}`); + if (index === 0) { + this.dataSource.deleteFirst(); + this.totalCount = this.dataSource.totalCount(); + } else if (index === this.totalCount - 1) { + this.dataSource.deleteLast(); + this.totalCount = this.dataSource.totalCount(); + } else { + this.dataSource.deleteData(index); + this.totalCount = this.dataSource.totalCount(); + } } - } - }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) + }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .height('100%') + .padding({ top: 8, left: 12, right: 12 }) + } else { + EmptyPage() } - .width('100%') - .height('100%') - .padding({ top: 8, left: 12, right: 12 }) - } else { - EmptyPage() } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/ListView.ets b/feature/capabilities/src/main/ets/capabilities/ListView.ets index 09e8d10c212774f866ea161b52ff06991e347073..700b53456f7943c8a88486f277edb6b51c250961 100644 --- a/feature/capabilities/src/main/ets/capabilities/ListView.ets +++ b/feature/capabilities/src/main/ets/capabilities/ListView.ets @@ -14,7 +14,7 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { Information } from '../model/Information'; import { ListDateSource } from '../components/listcomponents/ListDataSource'; import { InformationItemView } from '../components/InformationItemView'; @@ -22,11 +22,17 @@ import { Constant } from '../Constant'; const MIN_LENGTH = 0; -@Entry +@Builder +export function ListViewBuilder() { + ListView() +} + @Component export struct ListView { @State dataSource: ListDateSource = new ListDateSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_LIST }, (eventData) => { @@ -40,28 +46,35 @@ export struct ListView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ index: index, information: item, deleteAction: () => { - this.dataSource.deleteData(index); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ index: index, information: item, deleteAction: () => { + this.dataSource.deleteData(index); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/PlainArrayView.ets b/feature/capabilities/src/main/ets/capabilities/PlainArrayView.ets index 79de75ef13a57994f656576a59f95c2d1b65b0ac..13ce1733649e2a000940c1a4a4bad93f7b1c008c 100644 --- a/feature/capabilities/src/main/ets/capabilities/PlainArrayView.ets +++ b/feature/capabilities/src/main/ets/capabilities/PlainArrayView.ets @@ -15,7 +15,7 @@ import { emitter } from '@kit.BasicServicesKit'; import { promptAction } from '@kit.ArkUI'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { KeyValuePair } from '../model/KeyValuePair'; import { PlainArrayDataSource } from '../components/plainarraycomponents/PlainArrayDataSource'; import { KeyValueItemView } from '../components/KeyValueItemView'; @@ -27,10 +27,17 @@ const isNaturalNumber = (str: string): boolean => { return regExp.test(str); }; +@Builder +export function PlainArrayViewBuilder() { + PlainArrayView() +} + @Component export struct PlainArrayView { @State dataSource: PlainArrayDataSource = new PlainArrayDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_PLAIN_ARRAY }, (eventData) => { @@ -49,28 +56,35 @@ export struct PlainArrayView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { - ListItem() { - KeyValueItemView({ index: index, keyValuePair: item, deleteAction: () => { - this.dataSource.deleteData(index); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { + ListItem() { + KeyValueItemView({ index: index, keyValuePair: item, deleteAction: () => { + this.dataSource.deleteData(index); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/QueueView.ets b/feature/capabilities/src/main/ets/capabilities/QueueView.ets index 224d107c5a9467db7eb383765023dec801cc647d..a5b777c42b77b52879af382b85bb307b9f9032d9 100644 --- a/feature/capabilities/src/main/ets/capabilities/QueueView.ets +++ b/feature/capabilities/src/main/ets/capabilities/QueueView.ets @@ -14,7 +14,7 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { Information } from '../model/Information'; import { QueueDataSource } from '../components/queuecomponents/QueueDataSource'; import { InformationItemView } from '../components/InformationItemView'; @@ -22,10 +22,17 @@ import { Constant } from '../Constant'; const MIN_LENGTH = 0; +@Builder +export function QueueViewBuilder() { + QueueView() +} + @Component export struct QueueView { @State dataSource: QueueDataSource = new QueueDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_QUEUE }, (eventData) => { @@ -39,28 +46,35 @@ export struct QueueView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ index: index, information: item, deleteAction: () => { - this.dataSource.deleteData(); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ index: index, information: item, deleteAction: () => { + this.dataSource.deleteData(); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/StackView.ets b/feature/capabilities/src/main/ets/capabilities/StackView.ets index 24013fd46bd0efd87730e7dc6709a4ab327d4989..87dafefee0505cb9e00bbaef5710084596640c57 100644 --- a/feature/capabilities/src/main/ets/capabilities/StackView.ets +++ b/feature/capabilities/src/main/ets/capabilities/StackView.ets @@ -14,7 +14,7 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { Information } from '../model/Information'; import { StackDataSource } from '../components/stackcomponents/StackDataSource'; import { InformationItemView } from '../components/InformationItemView'; @@ -22,10 +22,17 @@ import { Constant } from '../Constant'; const MIN_LENGTH = 0; +@Builder +export function StackViewBuilder() { + StackView() +} + @Component export struct StackView { @State dataSource: StackDataSource = new StackDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_STACK }, (eventData) => { @@ -39,32 +46,39 @@ export struct StackView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: Information, index: number) => { - ListItem() { - InformationItemView({ - index: index, - information: item, - deleteAction: () => { - this.dataSource.deleteData(); - this.totalCount = this.dataSource.totalCount(); - } - }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: Information, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: Information, index: number) => { + ListItem() { + InformationItemView({ + index: index, + information: item, + deleteAction: () => { + this.dataSource.deleteData(); + this.totalCount = this.dataSource.totalCount(); + } + }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: Information, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/TaskPool.ets b/feature/capabilities/src/main/ets/capabilities/TaskPool.ets index 1f706c80d62a931d07dd5aae5e31a18e08ec9e21..2acbe2048985e2f7c4ba576625916df8655f5db2 100644 --- a/feature/capabilities/src/main/ets/capabilities/TaskPool.ets +++ b/feature/capabilities/src/main/ets/capabilities/TaskPool.ets @@ -14,101 +14,117 @@ */ import { taskpool } from '@kit.ArkTS' +import { customTitle } from '@ohos/common' function functionForTasks(numberOfExecutions: number) { "use concurrent" return numberOfExecutions + 1 } +@Builder +export function TaskPoolBuilder() { + TaskPool() +} + @Component export struct TaskPool { @State numberOfExecutions: number = 0; - private isExecute = true; - private clickAble = true; @State task: taskpool.Task | null = null; @State msg: string = 'task ready'; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); + private isExecute = true; + private clickAble = true; build() { - Column() { - Row() { - Text($r('app.string.click_exec_add_one')) - .margin({ top: 22 }) - } - .width('90%') - + NavDestination() { Column() { Row() { - Text('numberOfExecutions:') - .fontColor($r('sys.color.ohos_id_color_text_primary')) - Text(this.numberOfExecutions.toString()) - .fontColor($r('sys.color.ohos_id_color_text_primary')) + Text($r('app.string.click_exec_add_one')) + .margin({ top: 22 }) } - .width('100%') + .width('90%') - Row() { - Text('task status:') - .fontColor($r('sys.color.ohos_id_color_text_primary')) - Text(this.msg) - .fontColor($r('sys.color.ohos_id_color_text_primary')) + Column() { + Row() { + Text('numberOfExecutions:') + .fontColor($r('sys.color.ohos_id_color_text_primary')) + Text(this.numberOfExecutions.toString()) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + } + .width('100%') + + Row() { + Text('task status:') + .fontColor($r('sys.color.ohos_id_color_text_primary')) + Text(this.msg) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + } + .width('100%') } - .width('100%') - } - .height(160) - .margin({ top: 12 }) - .padding(16) - .borderRadius(16) - .backgroundColor($r('app.color.bg_white')) + .height(160) + .margin({ top: 12 }) + .padding(16) + .borderRadius(16) + .backgroundColor($r('app.color.bg_white')) - Blank() - .layoutWeight(1) + Blank() + .layoutWeight(1) - Row({ space: 20 }) { - Button('Execute task') - .id('execute_task') - .type(ButtonType.Capsule) - .width('45%') - .fontColor($r('app.color.text_color_accent')) - .backgroundColor($r('app.color.bg_btn_grey')) - .onClick(async () => { - if (!this.clickAble) { - return; - } - for (let i = 0; i > -1; i++) { - this.task = new taskpool.Task(functionForTasks, i); - if (!this.isExecute) { - this.isExecute = true; - taskpool.cancel(this.task); - } else { - this.clickAble = false; - this.msg = 'task is running'; - await taskpool.execute(this.task) - .then((res: ESObject) => { - this.numberOfExecutions = Number(JSON.parse(JSON.stringify(res))); - }); + Row({ space: 20 }) { + Button('Execute task') + .id('execute_task') + .type(ButtonType.Capsule) + .width('45%') + .fontColor($r('app.color.text_color_accent')) + .backgroundColor($r('app.color.bg_btn_grey')) + .onClick(async () => { + if (!this.clickAble) { + return; + } + for (let i = 0; i > -1; i++) { + this.task = new taskpool.Task(functionForTasks, i); + if (!this.isExecute) { + this.isExecute = true; + taskpool.cancel(this.task); + } else { + this.clickAble = false; + this.msg = 'task is running'; + await taskpool.execute(this.task) + .then((res: ESObject) => { + this.numberOfExecutions = Number(JSON.parse(JSON.stringify(res))); + }); + } } - } - }) + }) - Button('Cancel task') - .id('cancel_task') - .type(ButtonType.Capsule) - .width('45%') - .fontColor($r('app.color.text_color_red')) - .backgroundColor($r('app.color.bg_btn_grey')) - .onClick(() => { - if (!this.clickAble) { - this.msg = 'task cancel'; - this.clickAble = true; - this.isExecute = !this.isExecute; - } - }) + Button('Cancel task') + .id('cancel_task') + .type(ButtonType.Capsule) + .width('45%') + .fontColor($r('app.color.text_color_red')) + .backgroundColor($r('app.color.bg_btn_grey')) + .onClick(() => { + if (!this.clickAble) { + this.msg = 'task cancel'; + this.clickAble = true; + this.isExecute = !this.isExecute; + } + }) + } + .width('100%') + .margin({ top: 12, bottom: 16 }) + .justifyContent(FlexAlign.Center) } .width('100%') - .margin({ top: 12, bottom: 16 }) - .justifyContent(FlexAlign.Center) + .height('100%') + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } - .width('100%') - .height('100%') - .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) + } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/TreeMapView.ets b/feature/capabilities/src/main/ets/capabilities/TreeMapView.ets index 6050d515229fa1c60f19d071bcd1ab792f95ed71..7396afc607b3d5286345f30bb3f26e274863828d 100644 --- a/feature/capabilities/src/main/ets/capabilities/TreeMapView.ets +++ b/feature/capabilities/src/main/ets/capabilities/TreeMapView.ets @@ -14,7 +14,7 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { KeyValuePair } from '../model/KeyValuePair'; import { TreeMapDataSource } from '../components/treemapcomponents/TreeMapDataSource'; import { KeyValueItemView } from '../components/KeyValueItemView'; @@ -22,10 +22,17 @@ import { Constant } from '../Constant'; const MIN_LENGTH = 0; +@Builder +export function TreeMapViewBuilder() { + TreeMapView() +} + @Component export struct TreeMapView { @State dataSource: TreeMapDataSource = new TreeMapDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_TREE_MAP }, (eventData) => { @@ -39,28 +46,35 @@ export struct TreeMapView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { - ListItem() { - KeyValueItemView({ index: index, keyValuePair: item, deleteAction: () => { - this.dataSource.deleteData(item.key); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: KeyValuePair, index: number) => { + ListItem() { + KeyValueItemView({ index: index, keyValuePair: item, deleteAction: () => { + this.dataSource.deleteData(item.key); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: KeyValuePair, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/TreeSetView.ets b/feature/capabilities/src/main/ets/capabilities/TreeSetView.ets index f6f0b50538f438ecdd1d018ebfcdaa47b06fda43..5910ffec94ec2201c215110c1ddcb9cd56333f17 100644 --- a/feature/capabilities/src/main/ets/capabilities/TreeSetView.ets +++ b/feature/capabilities/src/main/ets/capabilities/TreeSetView.ets @@ -14,17 +14,24 @@ */ import { emitter } from '@kit.BasicServicesKit'; -import { EmptyPage } from '@ohos/common'; +import { customTitle, EmptyPage } from '@ohos/common'; import { TreeSetDataSource } from '../components/treesetcomponents/TreeSetDataSource'; import { ValueItemView } from '../components/ValueItemView'; import { Constant } from '../Constant'; const MIN_LENGTH = 0; +@Builder +export function TreeSetViewBuilder() { + TreeSetView() +} + @Component export struct TreeSetView { private dataSource: TreeSetDataSource = new TreeSetDataSource(); @State totalCount: number = MIN_LENGTH; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); aboutToAppear() { emitter.on({ eventId: Constant.EMITTER_ID_TREE_SET }, (eventData) => { @@ -38,28 +45,35 @@ export struct TreeSetView { } build() { - Column() { - if (this.totalCount > MIN_LENGTH) { - List() { - LazyForEach(this.dataSource, (item: string, index: number) => { - ListItem() { - ValueItemView({ index: index, value: item, deleteAction: () => { - this.dataSource.deleteData(item, index); - this.totalCount = this.dataSource.totalCount(); - } }) - } - .height(72) - .width('100%') - .margin({ bottom: 20 }) - }, (item: string, index: number) => JSON.stringify(item) + index) - } - .width('100%') - .layoutWeight(1) + NavDestination() { + Column() { + if (this.totalCount > MIN_LENGTH) { + List() { + LazyForEach(this.dataSource, (item: string, index: number) => { + ListItem() { + ValueItemView({ index: index, value: item, deleteAction: () => { + this.dataSource.deleteData(item, index); + this.totalCount = this.dataSource.totalCount(); + } }) + } + .height(72) + .width('100%') + .margin({ bottom: 20 }) + }, (item: string, index: number) => JSON.stringify(item) + index) + } + .width('100%') + .layoutWeight(1) - } else { - EmptyPage() + } else { + EmptyPage() + } } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) } + .title(customTitle(this.selectedLabel)) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/capabilities/Uri.ets b/feature/capabilities/src/main/ets/capabilities/Uri.ets index 11b5d2314bae9aa074ca4c1049c89e5286ffdd9d..855b8ea64b53403ad3241d194336ab3a93d3491e 100644 --- a/feature/capabilities/src/main/ets/capabilities/Uri.ets +++ b/feature/capabilities/src/main/ets/capabilities/Uri.ets @@ -15,8 +15,14 @@ import { uri } from '@kit.ArkTS'; import { promptAction } from '@kit.ArkUI'; +import { customTitle } from '@ohos/common'; import { ColumnOperation } from '../components/ColumnOperation'; +@Builder +export function UriBuilder() { + Uri() +} + @Component export struct Uri { @State output: string = 'https://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; @@ -27,6 +33,8 @@ export struct Uri { @State scheme: string = ''; @State userInfo: string = ''; @State query: string = ''; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); UriResolution() { if (this.output.indexOf('://') === -1) { @@ -45,92 +53,99 @@ export struct Uri { } build() { - Scroll() { - Column() { + NavDestination() { + Scroll() { Column() { - TextArea({ text: this.output }) - .onChange(value => { - if (value !== '') { - this.output = value; - this.URI = new uri.URI(value); - } - }) - .height(124) - .fontColor($r('app.color.textarea_color')) - .backgroundColor(Color.White) - - Row() { - Text($r('app.string.parsed_data')) - } - .width('100%') - .margin({ top: 16 }) - .justifyContent(FlexAlign.Start) - Column() { - Row() { - Text('host:') - Text(this.host) - } - .width('100%') - .justifyContent(FlexAlign.Start) + TextArea({ text: this.output }) + .onChange(value => { + if (value !== '') { + this.output = value; + this.URI = new uri.URI(value); + } + }) + .height(124) + .fontColor($r('app.color.textarea_color')) + .backgroundColor(Color.White) Row() { - Text('fragment:') - Text(this.fragment) + Text($r('app.string.parsed_data')) } .width('100%') + .margin({ top: 16 }) .justifyContent(FlexAlign.Start) - .margin({ top: 8 }) - Row() { - Text('path:') - Text(this.path) - } - .width('100%') - .justifyContent(FlexAlign.Start) - .margin({ top: 8 }) + Column() { + Row() { + Text('host:') + Text(this.host) + } + .width('100%') + .justifyContent(FlexAlign.Start) - Row() { - Text('scheme:') - Text(this.scheme) - } - .width('100%') - .justifyContent(FlexAlign.Start) - .margin({ top: 8 }) + Row() { + Text('fragment:') + Text(this.fragment) + } + .width('100%') + .justifyContent(FlexAlign.Start) + .margin({ top: 8 }) - Row() { - Text('userInfo:') - Text(this.userInfo) - } - .width('100%') - .justifyContent(FlexAlign.Start) - .margin({ top: 8 }) + Row() { + Text('path:') + Text(this.path) + } + .width('100%') + .justifyContent(FlexAlign.Start) + .margin({ top: 8 }) - Row() { - Text('query:') - Text(this.query) + Row() { + Text('scheme:') + Text(this.scheme) + } + .width('100%') + .justifyContent(FlexAlign.Start) + .margin({ top: 8 }) + + Row() { + Text('userInfo:') + Text(this.userInfo) + } + .width('100%') + .justifyContent(FlexAlign.Start) + .margin({ top: 8 }) + + Row() { + Text('query:') + Text(this.query) + } + .width('100%') + .justifyContent(FlexAlign.Start) + .margin({ top: 8 }) } - .width('100%') - .justifyContent(FlexAlign.Start) - .margin({ top: 8 }) + .borderRadius(16) + .backgroundColor(Color.White) + .margin({ top: 16 }) + .padding(16) } - .borderRadius(16) - .backgroundColor(Color.White) - .margin({ top: 16 }) - .padding(16) - } - Column() { - ColumnOperation({ operationRes: $r('app.strarray.uri_operations'), doOperation: this.doOperation }) + Column() { + ColumnOperation({ operationRes: $r('app.strarray.uri_operations'), doOperation: this.doOperation }) + } } + .width('100%') + .height('100%') + .padding(16) + .justifyContent(FlexAlign.SpaceBetween) } - .width('100%') - .height('100%') - .padding(16) - .justifyContent(FlexAlign.SpaceBetween) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } doOperation = (index: number) => { diff --git a/feature/capabilities/src/main/ets/capabilities/Url.ets b/feature/capabilities/src/main/ets/capabilities/Url.ets index e61d7bb630e463108890c94b39a59524e1966cf2..7f37e5c2b2aaab1f6b7c4d3ba33d7738f8f73194 100644 --- a/feature/capabilities/src/main/ets/capabilities/Url.ets +++ b/feature/capabilities/src/main/ets/capabilities/Url.ets @@ -13,38 +13,53 @@ * limitations under the License. */ +import { customTitle } from '@ohos/common'; import { ColumnOperation } from '../components/ColumnOperation'; import { changeValue, deleteNode, getFirstNode, insertNode } from '../util/UrlUtil'; const URL_NET: string = 'https://gitee.com/harmonyos/'; +@Builder +export function UrlBuilder() { + Url() +} + @Preview @Component export struct Url { @State output: string = URL_NET; + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column() { - Text(this.output) - .id('output') - .width('95%') - .height('30%') - .fontSize(15) - .padding(10) - .margin({ left: 10, right: 10, top: 10 }) - .border({ width: 2, radius: 5, color: Color.Gray }) - Text(URL_NET) - .fontSize(15) - .margin({ top: 15 }) - .fontWeight(FontWeight.Bold) - ColumnOperation({ operationRes: $r('app.strarray.url_operations'), doOperation: this.doOperation }) + NavDestination() { + Scroll() { + Column() { + Text(this.output) + .id('output') + .width('95%') + .height('30%') + .fontSize(15) + .padding(10) + .margin({ left: 10, right: 10, top: 10 }) + .border({ width: 2, radius: 5, color: Color.Gray }) + Text(URL_NET) + .fontSize(15) + .margin({ top: 15 }) + .fontWeight(FontWeight.Bold) + ColumnOperation({ operationRes: $r('app.strarray.url_operations'), doOperation: this.doOperation }) + } + .width('100%') + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } doOperation = (index: number) => { diff --git a/feature/capabilities/src/main/ets/capabilities/Util.ets b/feature/capabilities/src/main/ets/capabilities/Util.ets index 910ee40b8ae7636c23da6f9896a828c364026f7e..1fcfb7c92829342d40e625b33eccf795166f7b43 100644 --- a/feature/capabilities/src/main/ets/capabilities/Util.ets +++ b/feature/capabilities/src/main/ets/capabilities/Util.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { getString } from '@ohos/common'; +import { customTitle, getString } from '@ohos/common'; import { LRUCache } from '../components/utilcomponents/LRUCache'; import { Base64Helper } from '../components/utilcomponents/Base64Helper'; import { MenuList } from '@ohos/menuitems'; @@ -23,46 +23,30 @@ import { StringCode } from '../components/utilcomponents/StringCode'; import { TypeCheck } from '../components/utilcomponents/TypeCheck'; import { JsonFunction } from '../components/utilcomponents/JsonFunction'; +@Builder +export function UtilBuilder() { + Util() +} + @Component export struct Util { - @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; - - @Builder - UtilCapabilities() { - if (this.selectedSecondLabel === getString($r('app.string.lru_cache'))) { - LRUCache() - } - if (this.selectedSecondLabel === getString($r('app.string.base64'))) { - Base64Helper() - } - if (this.selectedSecondLabel === getString($r('app.string.string_code'))) { - StringCode() - } - if (this.selectedSecondLabel === getString($r('app.string.rational_number'))) { - RationalNumber() - } - if (this.selectedSecondLabel === getString($r('app.string.type_check'))) { - TypeCheck() - } - if (this.selectedSecondLabel === getString($r('app.string.json_function'))) { - JsonFunction() - } - if (this.selectedSecondLabel === getString($r('app.string.scope_helper'))) { - ScopeHelper() - } - } + @StorageLink('selectedLabel') selectedLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Column() { - MenuList({ menuList: $r('app.strarray.util_menu'), secondLabel: true }) { - Column() { - Divider() - .strokeWidth('1px') - .color($r('sys.color.ohos_id_color_list_separator')) - this.UtilCapabilities() - } + NavDestination() { + Column() { + Divider() + .strokeWidth('1px') + .color($r('sys.color.ohos_id_color_list_separator')) + MenuList({ menuList: $r('app.strarray.util_menu'), secondLabel: true }) } + .margin({ left: -12, right: -12 }) } - .margin({ left: -12, right: -12 }) + .title(customTitle(this.selectedLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/components/ColumnOperation.ets b/feature/capabilities/src/main/ets/components/ColumnOperation.ets index 53cf28aec1d5686eddd4d65e823d971c6a560963..8477daa2693b527157a10277c59457465cf097a9 100644 --- a/feature/capabilities/src/main/ets/components/ColumnOperation.ets +++ b/feature/capabilities/src/main/ets/components/ColumnOperation.ets @@ -17,9 +17,9 @@ import { getStringArray } from '@ohos/common'; @Component export struct ColumnOperation { - private operationRes: Resource | undefined = undefined; @State operationSource: string[] = []; - private doOperation: (index: number) => void = () => {}; + public operationRes: Resource | undefined = undefined; + public doOperation: (index: number) => void = () => {}; build() { Column() { diff --git a/feature/capabilities/src/main/ets/components/GridOperation.ets b/feature/capabilities/src/main/ets/components/GridOperation.ets index 3d11831fbaf45ea7cbcac0498d54f6ca2b0f09af..7281bf6bb080abaa541e46303d8435096244b543 100644 --- a/feature/capabilities/src/main/ets/components/GridOperation.ets +++ b/feature/capabilities/src/main/ets/components/GridOperation.ets @@ -17,9 +17,9 @@ import { getStringArray } from '@ohos/common'; @Component export struct GridOperation { - private operationRes: Resource | undefined = undefined; @State operationSource: string[] = []; - private doOperation: (index: number) => void = () => {}; + public operationRes: Resource | undefined = undefined; + public doOperation: (index: number) => void = () => {}; build() { Column() { diff --git a/feature/capabilities/src/main/ets/components/InformationItemView.ets b/feature/capabilities/src/main/ets/components/InformationItemView.ets index 11b4e252dc78c58e71cfcd3ab87a19c439e55ce0..4065d421566ccf0c9af73a7997bb489de04861eb 100644 --- a/feature/capabilities/src/main/ets/components/InformationItemView.ets +++ b/feature/capabilities/src/main/ets/components/InformationItemView.ets @@ -20,8 +20,8 @@ import { getString } from '@ohos/common'; @Component export struct InformationItemView { @ObjectLink information: Information; - private deleteAction: (event?: ClickEvent) => void = () => {}; - private index: number = 0; + public deleteAction: (event?: ClickEvent) => void = () => {}; + public index: number = 0; build() { Row() { diff --git a/feature/capabilities/src/main/ets/components/KeyValueItemView.ets b/feature/capabilities/src/main/ets/components/KeyValueItemView.ets index 09444ecd679fb0b92bf3b07ec720023a5967f586..06b2f9f30745360904a0e1905d34f103d3d1177a 100644 --- a/feature/capabilities/src/main/ets/components/KeyValueItemView.ets +++ b/feature/capabilities/src/main/ets/components/KeyValueItemView.ets @@ -20,9 +20,9 @@ import { DeleteView } from './DeleteView'; export struct KeyValueItemView { @ObjectLink keyValuePair: KeyValuePair; @State deleteEnabled: boolean = true; - private deleteAction: (event?: ClickEvent) => void = () => { + public deleteAction: (event?: ClickEvent) => void = () => { }; - private index: number = 0; + public index: number = 0; build() { Row() { diff --git a/feature/capabilities/src/main/ets/components/ValueItemView.ets b/feature/capabilities/src/main/ets/components/ValueItemView.ets index 2c198eb73838ce6bca3f738e0571512bb03b7ef2..75c66a506f03f8748e55827dd104de5b70e5b8d6 100644 --- a/feature/capabilities/src/main/ets/components/ValueItemView.ets +++ b/feature/capabilities/src/main/ets/components/ValueItemView.ets @@ -18,9 +18,10 @@ import { DeleteView } from './DeleteView'; @Component export struct ValueItemView { @State deleteEnabled: boolean = true; - private value: string = ''; - private deleteAction: (event?: ClickEvent) => void = () => {}; - private index: number = 0; + public value: string = ''; + public deleteAction: (event?: ClickEvent) => void = () => { + }; + public index: number = 0; build() { Row() { @@ -31,7 +32,12 @@ export struct ValueItemView { } .height('100%') .layoutWeight(1) - .padding({ left: 16, right: 16, top: 12, bottom: 12 }) + .padding({ + left: 16, + right: 16, + top: 12, + bottom: 12 + }) .borderRadius(16) .backgroundColor($r('app.color.bg_white')) .justifyContent(FlexAlign.Center) diff --git a/feature/capabilities/src/main/ets/components/arkTSUtilcomponents/AsonFunction.ets b/feature/capabilities/src/main/ets/components/arkTSUtilcomponents/AsonFunction.ets index 85af42ac3212ce71262b8c07a1028f04490a1c5c..dc18b32d55ef3c3efe3611f084321a223202c6a4 100644 --- a/feature/capabilities/src/main/ets/components/arkTSUtilcomponents/AsonFunction.ets +++ b/feature/capabilities/src/main/ets/components/arkTSUtilcomponents/AsonFunction.ets @@ -14,6 +14,7 @@ */ import { ArkTSUtils, lang } from '@kit.ArkTS'; +import { customTitle } from '@ohos/common'; import { ColumnOperation } from '../ColumnOperation'; // Construct a custom Sendable data structure. @@ -30,37 +31,51 @@ class CustomData implements lang.ISendable { } } +@Builder +export function AsonFunctionBuilder() { + AsonFunction() +} + @Component export struct AsonFunction { @State jsonText: string = '{"name": "John", "age": 30, "city": "Chongqing"}'; @State resulText: string = ''; @State actionSheets: Array = []; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column() { + NavDestination() { + Scroll() { Column() { - Row() { - Text(this.resulText) + Column() { + Row() { + Text(this.resulText) + } + .width('91%') + .height(124) + .padding(16) + .backgroundColor(Color.White) + .borderRadius(16) + .alignItems(VerticalAlign.Top) } - .width('91%') - .height(124) - .padding(16) - .backgroundColor(Color.White) - .borderRadius(16) - .alignItems(VerticalAlign.Top) - } - ColumnOperation({ operationRes: $r('app.strarray.ason_operations'), doOperation: this.doOperation }) + ColumnOperation({ operationRes: $r('app.strarray.ason_operations'), doOperation: this.doOperation }) + } + .height($r('app.string.text_width_full')) + .width($r('app.string.text_width_full')) + .padding(16) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor($r('app.color.page_bg')) } - .height($r('app.string.text_width_full')) - .width($r('app.string.text_width_full')) - .padding(16) - .justifyContent(FlexAlign.SpaceBetween) - .backgroundColor($r('app.color.page_bg')) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } doOperation = (index: number) => { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/Base64Helper.ets b/feature/capabilities/src/main/ets/components/utilcomponents/Base64Helper.ets index 79cb2ee08ca5c39e9a43204012a2cf99841ebe31..5261b117819c27c328255826a9e3d8715eb9c793 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/Base64Helper.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/Base64Helper.ets @@ -14,78 +14,93 @@ */ import { util } from '@kit.ArkTS'; +import { customTitle } from '@ohos/common'; + +@Builder +export function Base64HelperBuilder() { + Base64Helper() +} @Component export struct Base64Helper { @State resultEncode: string = ''; @State resultDecode: string = ''; @State input: string = 'harmony'; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column({ space: 12 }) { - Row() { - Text($r('app.string.change_str')) - .fontSize(20) - .fontWeight(FontWeight.Bold) - .textAlign(TextAlign.End) + NavDestination() { + Scroll() { + Column({ space: 12 }) { + Row() { + Text($r('app.string.change_str')) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .textAlign(TextAlign.End) + + Text(this.input) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .textAlign(TextAlign.Start) + } + .width('100%') + .height('10%') - Text(this.input) + Text(this.resultEncode) + .width('100%') + .height('10%') + .padding({ left: 10 }) .fontSize(20) .fontWeight(FontWeight.Bold) - .textAlign(TextAlign.Start) - } - .width('100%') - .height('10%') + .border({ width: 2, radius: 10, color: Color.Black }) - Text(this.resultEncode) + Button() { + Text($r("app.string.encode")) + .fontSize(25) + .fontColor(Color.White) + } + .id('encodeBtn') .width('100%') - .height('10%') - .padding({ left: 10 }) - .fontSize(20) - .fontWeight(FontWeight.Bold) - .border({ width: 2, radius: 10, color: Color.Black }) + .height(50) + .type(ButtonType.Capsule) + .onClick(() => { + this.encode(); + }) - Button() { - Text($r("app.string.encode")) - .fontSize(25) - .fontColor(Color.White) - } - .key('encodeBtn') - .width('100%') - .height(50) - .type(ButtonType.Capsule) - .onClick(() => { - this.encode(); - }) + Text(this.resultDecode) + .width('100%') + .height('10%') + .fontSize(20) + .padding({ left: 10 }) + .fontWeight(FontWeight.Bold) + .border({ width: 2, radius: 10, color: Color.Black }) + .margin({ top: 50 }) - Text(this.resultDecode) + Button() { + Text($r("app.string.decode")) + .fontSize(25) + .fontColor(Color.White) + } + .id('decodeBtn') .width('100%') - .height('10%') - .fontSize(20) - .padding({ left: 10 }) - .fontWeight(FontWeight.Bold) - .border({ width: 2, radius: 10, color: Color.Black }) - .margin({ top: 50 }) - - Button() { - Text($r("app.string.decode")) - .fontSize(25) - .fontColor(Color.White) + .height(50) + .type(ButtonType.Capsule) + .onClick(() => { + this.decode(); + }) } - .key('decodeBtn') .width('100%') - .height(50) - .type(ButtonType.Capsule) - .onClick(() => { - this.decode(); - }) + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } encode() { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/JsonFunction.ets b/feature/capabilities/src/main/ets/components/utilcomponents/JsonFunction.ets index 2971e0a3dab984c9ec4be1b157c1e9da6ca84665..75154a7b72f2c5c1e88fc212903c48fc27392c13 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/JsonFunction.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/JsonFunction.ets @@ -23,6 +23,12 @@ import { funMapToJson, deserializationLargeNum } from '../../util/JsonUtil'; +import { customTitle } from '@ohos/common'; + +@Builder +export function JsonFunctionBuilder() { + JsonFunction() +} @Component export struct JsonFunction { @@ -31,39 +37,48 @@ export struct JsonFunction { @State jsonText: string = '{"name":"John","age":30,"city":"Chongqing"}'; @State actionSheets: Array = []; @State flag: boolean = true; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column() { + NavDestination() { + Scroll() { Column() { - Row() { - Text(this.resulText) - } - .width('91%') - .height(124) - .padding(16) - .backgroundColor(Color.White) - .borderRadius(16) - .alignItems(VerticalAlign.Top) + Column() { + Row() { + Text(this.resulText) + } + .width('91%') + .height(124) + .padding(16) + .backgroundColor(Color.White) + .borderRadius(16) + .alignItems(VerticalAlign.Top) - Row() { - Text(this.flag ? this.jsonText : this.numberText) - .margin({ top: 12 }) + Row() { + Text(this.flag ? this.jsonText : this.numberText) + .margin({ top: 12 }) + } + .width('91%') + .alignItems(VerticalAlign.Top) } - .width('91%') - .alignItems(VerticalAlign.Top) - } - ColumnOperation({ operationRes: $r('app.strarray.json_operations'), doOperation: this.doOperation }) + ColumnOperation({ operationRes: $r('app.strarray.json_operations'), doOperation: this.doOperation }) + } + .height($r('app.string.text_width_full')) + .width($r('app.string.text_width_full')) + .padding(16) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor($r('app.color.page_bg')) } - .height($r('app.string.text_width_full')) - .width($r('app.string.text_width_full')) - .padding(16) - .justifyContent(FlexAlign.SpaceBetween) - .backgroundColor($r('app.color.page_bg')) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } doOperation = (index: number) => { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/LRUCache.ets b/feature/capabilities/src/main/ets/components/utilcomponents/LRUCache.ets index fb213dfa49ebd34523b2ed45926f99d944c54b02..260261721868f168ac2cb551aaf7b9583b0128c6 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/LRUCache.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/LRUCache.ets @@ -26,35 +26,50 @@ import { putKeyValue, updateCapacity } from '../../util/LRUCacheUtil'; +import { customTitle } from '@ohos/common'; + +@Builder +export function LRUCacheBuilder() { + LRUCache() +} @Component export struct LRUCache { @State resultText: string = ''; @State actionSheets: Array = []; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); private isGet: boolean = true; build() { - Scroll() { - Column() { - Scroll() { - Text(this.resultText) - .width('100%') - .fontSize(16) - } - .width('90%') - .height(240) - .margin({ top: 10 }) - .border({ width: 1, color: Color.Gray, radius: 15 }) - .scrollBar(BarState.Off) - .padding(15) + NavDestination() { + Scroll() { + Column() { + Scroll() { + Text(this.resultText) + .width('100%') + .fontSize(16) + } + .width('90%') + .height(240) + .margin({ top: 10 }) + .border({ width: 1, color: Color.Gray, radius: 15 }) + .scrollBar(BarState.Off) + .padding(15) - GridOperation({ operationRes: $r('app.strarray.lru_cache_operations'), doOperation: this.doOperation }) + GridOperation({ operationRes: $r('app.strarray.lru_cache_operations'), doOperation: this.doOperation }) + } + .width('100%') + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } action = (key: string) => { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/RationalNumber.ets b/feature/capabilities/src/main/ets/components/utilcomponents/RationalNumber.ets index 79e0a3ab54b796fa27b409a3a3299beae9e9a234..b4e57ba154776aa27d50e7cdcb85b6a830a73828 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/RationalNumber.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/RationalNumber.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import { customTitle } from '@ohos/common'; import { compareTo, getDenominator, getValueOf, isFinite, isNaN, isZero } from '../../util/RationalNumberUtil'; import { GridOperation } from '../GridOperation'; @@ -27,35 +28,49 @@ const DENOMINATOR2: number = 4; .textAlign(TextAlign.Center) } +@Builder +export function RationalNumberBuilder() { + RationalNumber() +} + @Preview @Component export struct RationalNumber { @State resultText: string = ''; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column({ space: 12 }) { - Text($r('app.string.first_rational_number')) - .width('100%') - .fontSize(24) - .textAlign(TextAlign.Start) - this.Texts(NUMERATOR1, DENOMINATOR1) - Text($r('app.string.second_rational_number')) - .width('100%') - .fontSize(24) - .textAlign(TextAlign.Start) - this.Texts(NUMERATOR2, DENOMINATOR2) - Text(this.resultText) - .textStyle() - .width('100%') - .height(150) - GridOperation({ operationRes: $r('app.strarray.rational_number_operations'), doOperation: this.doOperation }) + NavDestination() { + Scroll() { + Column({ space: 12 }) { + Text($r('app.string.first_rational_number')) + .width('100%') + .fontSize(24) + .textAlign(TextAlign.Start) + this.Texts(NUMERATOR1, DENOMINATOR1) + Text($r('app.string.second_rational_number')) + .width('100%') + .fontSize(24) + .textAlign(TextAlign.Start) + this.Texts(NUMERATOR2, DENOMINATOR2) + Text(this.resultText) + .textStyle() + .width('100%') + .height(150) + GridOperation({ operationRes: $r('app.strarray.rational_number_operations'), doOperation: this.doOperation }) + } + .width('100%') + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } @Builder diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/ScopeHelper.ets b/feature/capabilities/src/main/ets/components/utilcomponents/ScopeHelper.ets index 315957ff6f7ccc6f91cb35c169e06799b6ba5b02..0c9e1300e840fe4050e87e582d76d12ccaeba37e 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/ScopeHelper.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/ScopeHelper.ets @@ -17,10 +17,16 @@ import { util } from '@kit.ArkTS'; import { ScopeNumber } from '../../model/ScopeNumber'; import { TempView } from './scopehelper/TempView'; import { SleepView } from './scopehelper/SleepView'; +import { customTitle } from '@ohos/common'; const AGE_MIN: number = 16; const AGE_MAX: number = 62; +@Builder +export function ScopeHelperBuilder() { + ScopeHelper() +} + @Preview @Component export struct ScopeHelper { @@ -30,53 +36,62 @@ export struct ScopeHelper { @State tempNight: number = 2; @State shortTime: number = 0; @State longTime: number = 0; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column({ space: 12 }) { - Text($r('app.string.judge_age')) - .fontSize(20) - .fontColor(Color.White) - .backgroundColor(Color.Gray) - .textAlign(TextAlign.Start) - Row({ space: 5 }) { - TextInput({ placeholder: $r('app.string.age_placeholder') }) - .key('inputAge') - .height('100%') - .layoutWeight(6) - .type(InputType.Number) - .fontSize(24) - .fontStyle(FontStyle.Italic) - .maxLength(20) - .fontWeight(FontWeight.Bold) - .placeholderFont({ size: 24, weight: FontWeight.Normal }) - .enterKeyType(EnterKeyType.Go) - .onChange((value: string) => { - this.age = Number(value); - }) + NavDestination() { + Scroll() { + Column({ space: 12 }) { + Text($r('app.string.judge_age')) + .fontSize(20) + .fontColor(Color.White) + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Start) + Row({ space: 5 }) { + TextInput({ placeholder: $r('app.string.age_placeholder') }) + .id('inputAge') + .height('100%') + .layoutWeight(6) + .type(InputType.Number) + .fontSize(24) + .fontStyle(FontStyle.Italic) + .maxLength(20) + .fontWeight(FontWeight.Bold) + .placeholderFont({ size: 24, weight: FontWeight.Normal }) + .enterKeyType(EnterKeyType.Go) + .onChange((value: string) => { + this.age = Number(value); + }) - Button() { - Text($r('app.string.age_analyse')) - .fontColor(Color.White) - .fontSize(16) + Button() { + Text($r('app.string.age_analyse')) + .fontColor(Color.White) + .fontSize(16) + } + .id('ageAnalysis') + .layoutWeight(4) + .height(40) + .type(ButtonType.Capsule) + .onClick(() => { + this.ageRange(); + }) } - .key('ageAnalysis') - .layoutWeight(4) - .height(40) - .type(ButtonType.Capsule) - .onClick(() => { - this.ageRange(); - }) + .height(50) + TempView() + SleepView() } - .height(50) - TempView() - SleepView() + .width('100%') + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } dialog(title: ResourceStr, message: ResourceStr, value: ResourceStr) { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/StringCode.ets b/feature/capabilities/src/main/ets/components/utilcomponents/StringCode.ets index 3be676b66cfb23457b6a7198cd924968a7bf2314..b8d25969222bb3750ee9349a4f8141c6f62d634a 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/StringCode.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/StringCode.ets @@ -14,9 +14,14 @@ */ import { util } from '@kit.ArkTS'; -import { getString } from '@ohos/common'; +import { customTitle, getString } from '@ohos/common'; import { SpecInput } from './stringcode/SpecInput'; +@Builder +export function StringCodeBuilder() { + StringCode() +} + @Preview @Component export struct StringCode { @@ -28,148 +33,157 @@ export struct StringCode { @State resdec: string = ''; @State read: string = ''; @State write: string = ''; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); private resArray: Uint8Array | undefined = undefined; build() { - Scroll() { - Column({ space: 12 }) { - Row() { - Text($r('app.string.SpecString')) - .fontSize(15) - .textAlign(TextAlign.Start) - Text($r('app.string.SpecString_info')) - .fontSize(15) - .textAlign(TextAlign.Start) - } + NavDestination() { + Scroll() { + Column({ space: 12 }) { + Row() { + Text($r('app.string.SpecString')) + .fontSize(15) + .textAlign(TextAlign.Start) + Text($r('app.string.SpecString_info')) + .fontSize(15) + .textAlign(TextAlign.Start) + } - SpecInput({ result_str: $r('app.string.result_f'), specStrInput: $specStrInput_f }) - SpecInput({ result_str: $r('app.string.result_i'), specStrInput: $specStrInput_i }) - SpecInput({ result_str: $r('app.string.result_d'), specStrInput: $specStrInput_d }) - SpecInput({ result_str: $r('app.string.result_s'), specStrInput: $specStrInput_s }) - Button() { - Text($r('app.string.SpecFormOutput')) - .fontSize(15) - .fontWeight(FontWeight.Bold) - .fontColor(Color.White) - } - .id('specFormatOutput') - .width('100%') - .height(40) - .onClick(() => { - this.specStrInput_f = util.format("%f", "HarmonyOS") - this.specStrInput_i = util.format("%i", "HarmonyOS") - this.specStrInput_d = util.format("%d", "HarmonyOS") - this.specStrInput_s = util.format("%s", "HarmonyOS") - }) + SpecInput({ result_str: $r('app.string.result_f'), specStrInput: $specStrInput_f }) + SpecInput({ result_str: $r('app.string.result_i'), specStrInput: $specStrInput_i }) + SpecInput({ result_str: $r('app.string.result_d'), specStrInput: $specStrInput_d }) + SpecInput({ result_str: $r('app.string.result_s'), specStrInput: $specStrInput_s }) + Button() { + Text($r('app.string.SpecFormOutput')) + .fontSize(15) + .fontWeight(FontWeight.Bold) + .fontColor(Color.White) + } + .id('specFormatOutput') + .width('100%') + .height(40) + .onClick(() => { + this.specStrInput_f = util.format("%f", "HarmonyOS") + this.specStrInput_i = util.format("%i", "HarmonyOS") + this.specStrInput_d = util.format("%d", "HarmonyOS") + this.specStrInput_s = util.format("%s", "HarmonyOS") + }) - Divider() - .strokeWidth(4) - .color($r('sys.color.ohos_id_color_floating_button_shadow_end')) + Divider() + .strokeWidth(4) + .color($r('sys.color.ohos_id_color_floating_button_shadow_end')) - Row() { - Text($r('app.string.SpecString')) - .fontSize(15) - .textAlign(TextAlign.Start) - Text($r('app.string.StringCodec_info')) - .fontSize(15) - .margin({ left: 5 }) - .textAlign(TextAlign.Start) - } + Row() { + Text($r('app.string.SpecString')) + .fontSize(15) + .textAlign(TextAlign.Start) + Text($r('app.string.StringCodec_info')) + .fontSize(15) + .margin({ left: 5 }) + .textAlign(TextAlign.Start) + } - Row() { - Text($r('app.string.result')) - .width('20%') - .height(30) - .fontSize(15) - .textAlign(TextAlign.Start) - Text(this.resen) - .height(60) - .fontSize(15) - .layoutWeight(1) - .maxLines(2) - .textAlign(TextAlign.Start) - .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) - } - .margin({ top: 20 }) - .width('100%') + Row() { + Text($r('app.string.result')) + .width('20%') + .height(30) + .fontSize(15) + .textAlign(TextAlign.Start) + Text(this.resen) + .height(60) + .fontSize(15) + .layoutWeight(1) + .maxLines(2) + .textAlign(TextAlign.Start) + .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) + } + .margin({ top: 20 }) + .width('100%') - Row() { - Text($r('app.string.read')) - .width('20%') - .fontSize(15) - .textAlign(TextAlign.Start) - Text(this.read) - .id('read') - .width('30%') - .fontSize(15) - .height(30) - .textAlign(TextAlign.Start) - .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) - Text($r('app.string.write')) - .width('20%') - .fontSize(15) - .textAlign(TextAlign.Center) - Text(this.write) - .id('write') - .width('30%') - .fontSize(15) - .height(30) - .textAlign(TextAlign.Start) - .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) - } - .width('100%') + Row() { + Text($r('app.string.read')) + .width('20%') + .fontSize(15) + .textAlign(TextAlign.Start) + Text(this.read) + .id('read') + .width('30%') + .fontSize(15) + .height(30) + .textAlign(TextAlign.Start) + .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) + Text($r('app.string.write')) + .width('20%') + .fontSize(15) + .textAlign(TextAlign.Center) + Text(this.write) + .id('write') + .width('30%') + .fontSize(15) + .height(30) + .textAlign(TextAlign.Start) + .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) + } + .width('100%') - Button() { - Text($r('app.string.Text_encoder')) - .fontColor(Color.White) - .fontSize(15) - .fontWeight(FontWeight.Bold) - } - .id('textEncoder') - .width('100%') - .height(40) - .onClick(() => { - this.textEncode(); - }) + Button() { + Text($r('app.string.Text_encoder')) + .fontColor(Color.White) + .fontSize(15) + .fontWeight(FontWeight.Bold) + } + .id('textEncoder') + .width('100%') + .height(40) + .onClick(() => { + this.textEncode(); + }) - Row() { - Text($r('app.string.result')) - .width('20%') - .height(30) - .fontSize(15) - .textAlign(TextAlign.Start) - .fontColor(Color.Black) - Text(this.resdec) - .id('decRes') - .width('80%') - .height(60) - .fontSize(15) - .textAlign(TextAlign.Start) - .maxLines(2) - .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) - } - .margin({ top: 20 }) - .width(300) + Row() { + Text($r('app.string.result')) + .width('20%') + .height(30) + .fontSize(15) + .textAlign(TextAlign.Start) + .fontColor(Color.Black) + Text(this.resdec) + .id('decRes') + .width('80%') + .height(60) + .fontSize(15) + .textAlign(TextAlign.Start) + .maxLines(2) + .border({ width: 2, radius: 5, color: $r('app.color.text_color') }) + } + .margin({ top: 20 }) + .width(300) - Button() { - Text($r('app.string.Text_decoder')) - .fontColor(Color.White) - .fontSize(15) - .fontWeight(FontWeight.Bold) + Button() { + Text($r('app.string.Text_decoder')) + .fontColor(Color.White) + .fontSize(15) + .fontWeight(FontWeight.Bold) + } + .id('textDecoder') + .width('100%') + .height(40) + .margin({ bottom: 50 }) + .onClick(() => { + this.textDecode(); + }) } - .id('textDecoder') .width('100%') - .height(40) - .margin({ bottom: 50 }) - .onClick(() => { - this.textDecode(); - }) + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } textEncode() { @@ -188,7 +202,7 @@ export struct StringCode { if (this.resArray === undefined) { return; } - this.resdec = textDecoder.decodeWithStream(this.resArray, { stream: false }); + this.resdec = textDecoder.decodeToString(this.resArray, { stream: false }); } } diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/TypeCheck.ets b/feature/capabilities/src/main/ets/components/utilcomponents/TypeCheck.ets index 476e8efeda1c59ae38df3b88267ecce298fb0340..c461ce61b04ebba30372abb71a71107093ef7c71 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/TypeCheck.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/TypeCheck.ets @@ -15,40 +15,53 @@ import { ShowKey } from './typecheck/ShowKey'; import { CheckType } from './typecheck/CheckType'; - +import { customTitle } from '@ohos/common'; let int8Array: Int8Array = new Int8Array(new ArrayBuffer(8)); let numVal: Number = new Number(55); let strVal: String = new String('zhangsan'); let boolVal: Boolean = new Boolean(true); -; for (let i = 0; i < int8Array.length; i++) { int8Array[i] = i; } +@Builder +export function TypeCheckBuilder() { + TypeCheck() +} + @Preview @Component export struct TypeCheck { @State checkResult: string = ''; @State presetValue: Array = [numVal, strVal, boolVal, int8Array]; + @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; + public pathStack: NavPathStack = new NavPathStack(); build() { - Scroll() { - Column() { - Text(this.checkResult) - .width('100%') - .height(200) - .fontSize(20) - .margin(20) - .padding({ left: 5, right: 5 }) - .border({ width: 2, radius: 15, color: Color.Gray }) - ShowKey({ presetValue: $presetValue, checkResult: $checkResult }) - CheckType({ presetValue: $presetValue, checkResult: $checkResult }) + NavDestination() { + Scroll() { + Column() { + Text(this.checkResult) + .width('100%') + .height(200) + .fontSize(20) + .margin(20) + .padding({ left: 5, right: 5 }) + .border({ width: 2, radius: 15, color: Color.Gray }) + ShowKey({ presetValue: $presetValue, checkResult: $checkResult }) + CheckType({ presetValue: $presetValue, checkResult: $checkResult }) + } + .width('100%') + .padding(16) } - .width('100%') - .padding(16) + .scrollBar(BarState.Off) + .align(Alignment.Start) } - .scrollBar(BarState.Off) - .align(Alignment.Start) + .title(customTitle(this.selectedSecondLabel)) + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } \ No newline at end of file diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/lrucache/ActionSheetDialog.ets b/feature/capabilities/src/main/ets/components/utilcomponents/lrucache/ActionSheetDialog.ets index aa14e8c615fbfacf855a327292fa8691c2d542da..f233fde440bc4fefdfaec0267d69d3bf186f728d 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/lrucache/ActionSheetDialog.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/lrucache/ActionSheetDialog.ets @@ -16,9 +16,9 @@ @CustomDialog export struct ActionSheetDialog { private controller?: CustomDialogController; - private title: string = ''; - private sheets: string[] = []; - private action: (key: string) => void = () => {}; + public title: string = ''; + public sheets: string[] = []; + public action: (key: string) => void = () => {}; build() { Column() { @@ -39,7 +39,7 @@ export struct ActionSheetDialog { .fontSize(18) .fontColor(Color.Gray) } - .key('getValueOfTheKey') + .id('getValueOfTheKey') .width('100%') .margin(10) } diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets index 4c1119221dce64a5205c2e46bbd017ff8b406bc3..35596fef3d8a696ffced0e48840841957e7ff51e 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets @@ -16,8 +16,8 @@ @Component export struct InputItem { @Link value: number; - private textValue: Resource = $r('app.string.short_sleep'); - private placeHolder: Resource = $r('app.string.enter_sleep_time'); + public textValue: Resource = $r('app.string.short_sleep'); + public placeHolder: Resource = $r('app.string.enter_sleep_time'); build() { Row() { @@ -25,7 +25,7 @@ export struct InputItem { .layoutWeight(1) .fontSize(20) TextInput({ placeholder: this.placeHolder }) - .key('shortestSleepTime') + .id('shortestSleepTime') .layoutWeight(1) .type(InputType.Normal) .fontSize(20) diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/SleepView.ets b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/SleepView.ets index 51f2fcf742753b70caa6d43a9cfea528ed5fdf8c..1bd7523e100c4c0ca82832d12da717bedf0fd015 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/SleepView.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/SleepView.ets @@ -58,7 +58,7 @@ export struct SleepView { .fontSize(16) .textAlign(TextAlign.Center) } - .key('sleepAnalysis') + .id('sleepAnalysis') .type(ButtonType.Capsule) .width('100%') .height(45) diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/TempView.ets b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/TempView.ets index 05f098af8f23cb2167c422e6110fb2dc14cab7eb..ac56c895f3bbad1dc1bb32bff1b0e6d5c0a50941 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/TempView.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/TempView.ets @@ -57,7 +57,7 @@ export struct TempView { .fontColor(Color.White) .fontSize(16) } - .key('temperatureAnalysis') + .id('temperatureAnalysis') .type(ButtonType.Capsule) .width('100%') .height(45) diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets b/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets index bff12fae56571440fd4c14f2c3a43442c5e1c06b..6de5b90a0b980718c39e84c3469b765f93a11779 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets @@ -15,8 +15,8 @@ @Component export struct SpecInput { - private result_str: Resource = $r('app.string.result_f'); @Link specStrInput: string; + public result_str: Resource = $r('app.string.result_f'); build() { Row() { diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/CheckType.ets b/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/CheckType.ets index 06e4a126ac42167478b10a1737ddf25cba4fef6a..48b5ad10408ac540a2db6288118ec26f1767ac28 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/CheckType.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/CheckType.ets @@ -26,9 +26,9 @@ export struct CheckType { let utilData: Map | null = new Map([ ['ArrayBuffer', utilType.isAnyArrayBuffer(value)], ['Int8Array', utilType.isInt8Array(value)], - ['Number', utilType.isNumberObject(value)], - ['String', utilType.isStringObject(value)], - ['Boolean', utilType.isBooleanObject(value)], + ['Number', value instanceof Number], + ['String', value instanceof String], + ['Boolean', value instanceof Boolean], ['ArrayBuffer', utilType.isAnyArrayBuffer(value)], ['DataView', utilType.isDataView(value)], ['Arguments', utilType.isArgumentsObject(value)], @@ -63,7 +63,7 @@ export struct CheckType { .textAlign(TextAlign.Center) .width('85%') } - .key('checkPresetValue') + .id('checkPresetValue') .type(ButtonType.Capsule) .backgroundColor('#0D9FFB') .padding(5) diff --git a/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/ShowKey.ets b/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/ShowKey.ets index 641f065c1dac3fcb7245957552a1d3fcddbc5d7b..c761b371cda0b02abfa6269b26293ad75fa88534 100644 --- a/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/ShowKey.ets +++ b/feature/capabilities/src/main/ets/components/utilcomponents/typecheck/ShowKey.ets @@ -27,7 +27,7 @@ export struct ShowKey { .textAlign(TextAlign.Center) .width('85%') } - .key('displayPresetValue') + .id('displayPresetValue') .type(ButtonType.Capsule) .backgroundColor('#0D9FFB') .padding(5) diff --git a/feature/capabilities/src/main/ets/util/ConvertXmlUtil.ets b/feature/capabilities/src/main/ets/util/ConvertXmlUtil.ets index 659a1988d6b54e1754a73c98aaefd57e06c3fc03..8fed6083a9dd81adcdd8c1025da0d5038ebe6b56 100644 --- a/feature/capabilities/src/main/ets/util/ConvertXmlUtil.ets +++ b/feature/capabilities/src/main/ets/util/ConvertXmlUtil.ets @@ -37,7 +37,7 @@ export function serializerNode(): string { serializer.endElement(); let view: Uint8Array = new Uint8Array(arrayBuffer); // Use Uint8Array to read data in the array buffer. let textDecoder: util.TextDecoder = util.TextDecoder.create(); // Invoke the TextDecoder class of the util module. - let res: string = textDecoder.decodeWithStream(view); // Decode the view. + let res: string = textDecoder.decodeToString(view); // Decode the view. return res; } @@ -73,7 +73,7 @@ export function parserNode(strXml: string): string { attributeValueCallbackFunction: attFunc, tokenValueCallbackFunction: tokenFunc }; - parser.parse(options); + parser.parseXml(options); return str; } @@ -95,7 +95,7 @@ export function convertNode(input: string): string { }; let conv = new convertxml.ConvertXML(); logger.info(TAG, 'convertNode new ConvertXML'); - let result = JSON.stringify(conv.convertToJSObject(input, options)); + let result = JSON.stringify(conv.fastConvertToJSObject(input, options)); logger.info(TAG, `convertNode conv.convert result = ${result}`); return result; } \ No newline at end of file diff --git a/feature/capabilities/src/main/module.json5 b/feature/capabilities/src/main/module.json5 index 22ac1f3851c872acb499e70df4e08f35a98ce9ab..5ba7a5eea74bbec1d287110f7c047fc86041c989 100644 --- a/feature/capabilities/src/main/module.json5 +++ b/feature/capabilities/src/main/module.json5 @@ -20,6 +20,7 @@ "deviceTypes": [ "phone", "tablet" - ] + ], + "routerMap": "$profile:route_map" } } \ No newline at end of file diff --git a/feature/capabilities/src/main/resources/base/profile/route_map.json b/feature/capabilities/src/main/resources/base/profile/route_map.json new file mode 100644 index 0000000000000000000000000000000000000000..d1de1a769630d3d6c20226889270a497a28519ef --- /dev/null +++ b/feature/capabilities/src/main/resources/base/profile/route_map.json @@ -0,0 +1,220 @@ +{ + "routerMap": [ + { + "name": "ConvertXml", + "pageSourceFile": "src/main/ets/capabilities/ConvertXml.ets", + "buildFunction": "ConvertXmlBuilder", + "data": { + "description": "this is ConvertXml" + } + }, + { + "name": "TaskPool", + "pageSourceFile": "src/main/ets/capabilities/TaskPool.ets", + "buildFunction": "TaskPoolBuilder", + "data": { + "description": "this is TaskPool" + } + }, + { + "name": "Url", + "pageSourceFile": "src/main/ets/capabilities/Url.ets", + "buildFunction": "UrlBuilder", + "data": { + "description": "this is Url" + } + }, + { + "name": "Uri", + "pageSourceFile": "src/main/ets/capabilities/Uri.ets", + "buildFunction": "UriBuilder", + "data": { + "description": "this is Uri" + } + }, + { + "name": "Util", + "pageSourceFile": "src/main/ets/capabilities/Util.ets", + "buildFunction": "UtilBuilder", + "data": { + "description": "this is Util" + } + }, + { + "name": "LRUCache", + "pageSourceFile": "src/main/ets/components/utilcomponents/LRUCache.ets", + "buildFunction": "LRUCacheBuilder", + "data": { + "description": "this is LRUCache" + } + }, + { + "name": "StringCode", + "pageSourceFile": "src/main/ets/components/utilcomponents/StringCode.ets", + "buildFunction": "StringCodeBuilder", + "data": { + "description": "this is StringCode" + } + }, + { + "name": "RationalNumber", + "pageSourceFile": "src/main/ets/components/utilcomponents/RationalNumber.ets", + "buildFunction": "RationalNumberBuilder", + "data": { + "description": "this is RationalNumber" + } + }, + { + "name": "ScopeHelper", + "pageSourceFile": "src/main/ets/components/utilcomponents/ScopeHelper.ets", + "buildFunction": "ScopeHelperBuilder", + "data": { + "description": "this is ScopeHelper" + } + }, + { + "name": "Base64Helper", + "pageSourceFile": "src/main/ets/components/utilcomponents/Base64Helper.ets", + "buildFunction": "Base64HelperBuilder", + "data": { + "description": "this is Base64Helper" + } + }, + { + "name": "TypeCheck", + "pageSourceFile": "src/main/ets/components/utilcomponents/TypeCheck.ets", + "buildFunction": "TypeCheckBuilder", + "data": { + "description": "this is TypeCheck" + } + }, + { + "name": "JsonFunction", + "pageSourceFile": "src/main/ets/components/utilcomponents/JsonFunction.ets", + "buildFunction": "JsonFunctionBuilder", + "data": { + "description": "this is JsonFunction" + } + }, + { + "name": "ArkTSUtil", + "pageSourceFile": "src/main/ets/capabilities/ArkTSUtil.ets", + "buildFunction": "ArkTSUtilBuilder", + "data": { + "description": "this is ArkTSUtil" + } + }, + { + "name": "AsonFunction", + "pageSourceFile": "src/main/ets/components/arkTSUtilcomponents/AsonFunction.ets", + "buildFunction": "AsonFunctionBuilder", + "data": { + "description": "this is AsonFunction" + } + }, + { + "name": "ArrayListView", + "pageSourceFile": "src/main/ets/capabilities/ArrayListView.ets", + "buildFunction": "ArrayListViewBuilder", + "data": { + "description": "this is ArrayListView" + } + }, + { + "name": "DequeView", + "pageSourceFile": "src/main/ets/capabilities/DequeView.ets", + "buildFunction": "DequeViewBuilder", + "data": { + "description": "this is DequeView" + } + }, + { + "name": "HashMapView", + "pageSourceFile": "src/main/ets/capabilities/HashMapView.ets", + "buildFunction": "HashMapViewBuilder", + "data": { + "description": "this is HashMapView" + } + }, + { + "name": "HashSetView", + "pageSourceFile": "src/main/ets/capabilities/HashSetView.ets", + "buildFunction": "HashSetViewBuilder", + "data": { + "description": "this is HashSetView" + } + }, + { + "name": "LightWeightMapView", + "pageSourceFile": "src/main/ets/capabilities/LightWeightMapView.ets", + "buildFunction": "LightWeightMapViewBuilder", + "data": { + "description": "this is LightWeightMapView" + } + }, + { + "name": "LightWeightSetView", + "pageSourceFile": "src/main/ets/capabilities/LightWeightSetView.ets", + "buildFunction": "LightWeightSetViewViewBuilder", + "data": { + "description": "this is LightWeightSetView" + } + }, + { + "name": "LinkedListView", + "pageSourceFile": "src/main/ets/capabilities/LinkedListView.ets", + "buildFunction": "LinkedListViewBuilder", + "data": { + "description": "this is LinkedListView" + } + }, + { + "name": "ListView", + "pageSourceFile": "src/main/ets/capabilities/ListView.ets", + "buildFunction": "ListViewBuilder", + "data": { + "description": "this is ListView" + } + }, + { + "name": "PlainArrayView", + "pageSourceFile": "src/main/ets/capabilities/PlainArrayView.ets", + "buildFunction": "PlainArrayViewBuilder", + "data": { + "description": "this is PlainArrayView" + } + }, + { + "name": "QueueView", + "pageSourceFile": "src/main/ets/capabilities/QueueView.ets", + "buildFunction": "QueueViewBuilder", + "data": { + "description": "this is QueueView" + } + }, + { + "name": "StackView", + "pageSourceFile": "src/main/ets/capabilities/StackView.ets", + "buildFunction": "StackViewBuilder", + "data": { + "description": "this is StackView" + } + }, + { + "name": "TreeMapView", + "pageSourceFile": "src/main/ets/capabilities/TreeMapView.ets", + "buildFunction": "TreeMapViewBuilder", + "data": { + "description": "this is TreeMapView" + } + }, + { + "name": "TreeSetView", + "pageSourceFile": "src/main/ets/capabilities/TreeSetView.ets", + "buildFunction": "TreeSetViewBuilder", + "data": { + "description": "this is TreeSetView" + } + } + ] +} \ No newline at end of file diff --git a/feature/menuitems/src/main/ets/components/MainItem.ets b/feature/menuitems/src/main/ets/components/MainItem.ets index 2af77ee27d4445850a0b6650baff5571f2b735ad..e3959d65583613df93eddf3c8b01e33b7139f3b3 100644 --- a/feature/menuitems/src/main/ets/components/MainItem.ets +++ b/feature/menuitems/src/main/ets/components/MainItem.ets @@ -15,9 +15,9 @@ @Component export struct MainItem { - private title: string | Resource = ''; @LocalStorageProp('isSplitMode') isSplitMode: boolean = false; @State isTouched: boolean = false; + public title: string | Resource = ''; build() { Row() { diff --git a/feature/menuitems/src/main/ets/components/MenuNavRouter.ets b/feature/menuitems/src/main/ets/components/MenuNavRouter.ets index 4b6d9bb6d01c911c376d0185e162ae8094511cda..7b1fc21da1ac6df84815e6817091d7bdf40f3051 100644 --- a/feature/menuitems/src/main/ets/components/MenuNavRouter.ets +++ b/feature/menuitems/src/main/ets/components/MenuNavRouter.ets @@ -13,21 +13,18 @@ * limitations under the License. */ -import { common } from '@kit.AbilityKit'; import { ItemGroup } from './ItemGroup'; -import { getString, logger } from '@ohos/common'; +import { getString } from '@ohos/common'; import { MainItem } from './MainItem'; -const TAG: string = 'MenuNavRouter'; - @Component export struct MenuNavRouter { @StorageLink('selectedLabel') selectedLabel: string = ''; @StorageLink('selectedSecondLabel') selectedSecondLabel: string = ''; - @BuilderParam navDestination: () => void; - private childList: Array = []; - private addAction?: (title: string) => void; - private secondLabel?: boolean; + @StorageLink('pathStack') pathStack: NavPathStack = new NavPathStack(); + public childList: Array = []; + public addAction?: (title: string) => void; + public secondLabel?: boolean; @Builder CustomDivider() { @@ -44,88 +41,83 @@ export struct MenuNavRouter { if (index > 0) { this.CustomDivider() } - NavRouter() { - MainItem({ - title: item - }) - NavDestination() { - this.navDestination() - } - .title(this.CustomTitle(item)) - .backgroundColor($r('sys.color.ohos_id_color_sub_background')) - } - .onStateChange((isActivated: boolean) => { - if (isActivated) { + MainItem({ + title: item + }) + .onClick(()=>{ if (this.secondLabel) { this.selectedSecondLabel = item; + if (this.selectedSecondLabel === getString($r('app.string.lru_cache'))) { + this.pathStack.pushPathByName('LRUCache', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.base64'))) { + this.pathStack.pushPathByName('Base64Helper', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.string_code'))) { + this.pathStack.pushPathByName('StringCode', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.rational_number'))) { + this.pathStack.pushPathByName('RationalNumber', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.type_check'))) { + this.pathStack.pushPathByName('TypeCheck', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.json_function'))) { + this.pathStack.pushPathByName('JsonFunction', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.scope_helper'))) { + this.pathStack.pushPathByName('ScopeHelper', null, null); + } + if (this.selectedSecondLabel === getString($r('app.string.ason_function'))) { + this.pathStack.pushPathByName('AsonFunction', null, null); + } } else { this.selectedLabel = item; + // The page content is displayed according to the selected menu. + if (this.selectedLabel === getString($r('app.string.xml'))) { + this.pathStack.pushPathByName('ConvertXml', null, null); + } else if (this.selectedLabel === getString($r('app.string.url'))) { + this.pathStack.pushPathByName('Url', null, null); + } else if (this.selectedLabel === getString($r('app.string.uri'))) { + this.pathStack.pushPathByName('Uri', null, null); + } else if (this.selectedLabel === getString($r('app.string.array_list'))) { + this.pathStack.pushPathByName('ArrayListView', null, null); + } else if (this.selectedLabel === getString($r('app.string.task_pool'))) { + this.pathStack.pushPathByName('TaskPool', null, null); + } else if (this.selectedLabel === getString($r('app.string.deque'))) { + this.pathStack.pushPathByName('DequeView', null, null); + } else if (this.selectedLabel === getString($r('app.string.hash_map'))) { + this.pathStack.pushPathByName('HashMapView', null, null); + } else if (this.selectedLabel === getString($r('app.string.hash_set'))) { + this.pathStack.pushPathByName('HashSetView', null, null); + } else if (this.selectedLabel === getString($r('app.string.light_weight_map'))) { + this.pathStack.pushPathByName('LightWeightMapView', null, null); + } else if (this.selectedLabel === getString($r('app.string.light_weight_set'))) { + this.pathStack.pushPathByName('LightWeightSetView', null, null); + } else if (this.selectedLabel === getString($r('app.string.linked_list'))) { + this.pathStack.pushPathByName('LinkedListView', null, null); + } else if (this.selectedLabel === getString($r('app.string.list'))) { + this.pathStack.pushPathByName('ListView', null, null); + } else if (this.selectedLabel === getString($r('app.string.plain_array'))) { + this.pathStack.pushPathByName('PlainArrayView', null, null); + } else if (this.selectedLabel === getString($r('app.string.queue'))) { + this.pathStack.pushPathByName('QueueView', null, null); + } else if (this.selectedLabel === getString($r('app.string.stack'))) { + this.pathStack.pushPathByName('StackView', null, null); + } else if (this.selectedLabel === getString($r('app.string.tree_map'))) { + this.pathStack.pushPathByName('TreeMapView', null, null); + } else if (this.selectedLabel === getString($r('app.string.tree_set'))) { + this.pathStack.pushPathByName('TreeSetView', null, null); + } else if (this.selectedLabel === getString($r('app.string.util'))) { + this.pathStack.pushPathByName('Util', null, null); + } else { + this.pathStack.pushPathByName('ArkTSUtil', null, null); + } } - logger.info(TAG, `NavRouter isActivated= ${isActivated}, selectedLabel=${item}`); - } - }) - }, (item: string) => JSON.stringify(item)) - } - } - } - - @Builder - CustomTitle(title: string) { - Row() { - Text(title) - .fontColor($r('app.color.black')) - .fontSize(16) - .fontWeight(FontWeight.Bold) + }) - Row() { - Image($r('app.media.ic_public_add')) - .height(24) - .aspectRatio(1) - .objectFit(ImageFit.Contain) + }, (item: string) => JSON.stringify(item)) } - .id('add') - .height('100%') - .aspectRatio(1) - .visibility(this.showAddButton(title) ? Visibility.Visible : Visibility.None) - .onClick(() => { - logger.info(TAG, 'addAction') - if (this.addAction) { - this.addAction(title) - } - }) } - .width('85%') - .height(56) - .margin({ left: 5 }) - .justifyContent(FlexAlign.SpaceBetween) - } - - showAddButton(title: string) { - let ret = false - switch (title) { - case getString($r('app.string.deque')): - case getString($r('app.string.hash_map')): - case getString($r('app.string.hash_set')): - case getString($r('app.string.light_weight_map')): - case getString($r('app.string.light_weight_set')): - case getString($r('app.string.linked_list')): - case getString($r('app.string.list')): - case getString($r('app.string.array_list')): - case getString($r('app.string.plain_array')): - case getString($r('app.string.queue')): - case getString($r('app.string.stack')): - case getString($r('app.string.tree_map')): - case getString($r('app.string.tree_set')): - ret = true - break; - } - return ret - } - - getString(resource: Resource) { - let context = getContext(this) as common.UIAbilityContext; - let resultStr = context.resourceManager.getStringSync(resource); - logger.info(TAG, `getString = ${resultStr}`); - return resultStr; } } \ No newline at end of file diff --git a/feature/menuitems/src/main/ets/menulist/MenuList.ets b/feature/menuitems/src/main/ets/menulist/MenuList.ets index 76bfaa779bd4c15bd5481f77fb06feff1a47ba55..dcedb1548650cfe7e6579ea2c6d7fe7b4c613239 100644 --- a/feature/menuitems/src/main/ets/menulist/MenuList.ets +++ b/feature/menuitems/src/main/ets/menulist/MenuList.ets @@ -19,18 +19,15 @@ import { MenuNavRouter } from '../components/MenuNavRouter'; @Component export struct MenuList { @State menuListData: Array = []; - @BuilderParam childNavDestination: () => void; - private menuList: Resource | undefined = undefined; - private addAction?: (title: string) => void; - private secondLabel?: boolean; + public menuList: Resource | undefined = undefined; + public addAction?: (title: string) => void; + public secondLabel?: boolean; build() { List({ space: 12 }) { ListItem() { if (this.menuListData.length > 0) { - MenuNavRouter({ childList: this.menuListData, secondLabel: this.secondLabel, addAction: this.addAction }) { - this.childNavDestination() - } + MenuNavRouter({ childList: this.menuListData, secondLabel: this.secondLabel, addAction: this.addAction }) } } } diff --git a/oh-package.json5 b/oh-package.json5 index 98842c689cd4a64df670a10f3fe313485b926a2c..63b7e70f30e15cce7101472f034a9819aeb81c1a 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -2,7 +2,6 @@ "modelVersion": "5.0.0", "license": "ISC", "devDependencies": { - "@ohos/hypium": "1.0.15" }, "name": "devicemanagementcollection", "description": "example description",