diff --git a/README.md b/README.md index 88c2849924952576ba3129c20a14e566b5ccae21..de33c9934a16f55900963bfca1b2531832428808 100644 --- a/README.md +++ b/README.md @@ -2,54 +2,4 @@ ### 介绍 -本示例基于List组件,实现待办事项管理、文件管理、备忘录的等场景列表编辑效果。 - -### 效果预览 - -![](./screenshots/device/listitem_edit.gif) - -##### 使用说明 - -- 点击添加按钮,选择需要添加的待办事项。 -- 点击左侧checkbox按钮,待办事项状态变更为已完成。 -- 左滑单个待办事项,点击删除按钮后,当前待办事项被删除。 - -### 工程目录 - -``` - -├──entry/src/main/ets/ -│ ├──common -│ │ └──Constants.ets // 公共常量类 -│ ├──entryability -│ │ └──EntryAbility.ets // 程序入口类 -│ ├──model -│ │ └──ToDo.ets // 待办事项数据 -│ ├──pages -│ │ └──Index.ets // 首页 -│ └──view -│ └──TodoListItem.ets // 待办选项 -└──entry/src/main/resources // 应用静态资源目录 -``` - -### 具体实现 - -1. List组件绑定@State修饰的数组变量toDoData。 - -2. ListItem组件设置左滑动效swipeAction属性,使得单个ListItem可以进行左右滑动,并显示自定义的UIBuilder。 - -3. 新增/删除列表项,更新数组变量toDoData,并同时更新List组件UI。 - -### 相关权限 - -不涉及 - -### 约束与限制 - -1. 本示例仅支持标准系统上运行,支持设备:华为手机。 - -2. HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 - -3. DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 - -4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 \ No newline at end of file +此分支仅供HMOS世界集成使用 \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 index d209fee432db4515940449ca8f4516144ae32cf6..2dfcc01fc991a6ab948341195146e600a881cb1f 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -30,6 +30,10 @@ ] } ] + }, + { + "name": "listitemeditmodule", + "srcPath": "./listitemeditmodule", } ] } \ No newline at end of file diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 248c3b7541a589682a250f86a6d3ecf7414d2d6a..1804390e5f95fbece10e1ca6ede63e2613534126 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -5,6 +5,8 @@ "main": "", "author": "", "license": "", - "dependencies": {} + "dependencies": { + "@ohos_samples/listitemeditmodule": "file:../listitemeditmodule" + } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 90d49517994d351342dc7819e10597c9741b447b..2fa356cf37b385d370547660ebcb5fe97096d93a 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -12,135 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import { promptAction } from '@kit.ArkUI'; -import { ToDo } from '../model/ToDo'; -import { ToDoListItem } from '../view/TodoListItem'; -import { STYLE_CONFIG, Constant } from '../common/Constants'; - -@Extend(Image) -function ImageStyle() { - .width(STYLE_CONFIG.IMAGE_SIZE) - .aspectRatio(1) - .margin(STYLE_CONFIG.IMAGE_MARGIN) -} +import { ToDoList } from '@ohos_samples/listitemeditmodule'; @Entry @Component -struct ToDoList { - @State toDoData: ToDo[] = []; - @State achieveData: ToDo[] = []; - - /** - * Delete a to-do/completed item. - */ - deleteTodoItem(item: ToDo) { - if (item.isCompleted) { - this.achieveData = this.achieveData.filter(todoItem => item.key !== todoItem.key); - } else { - this.toDoData = this.toDoData.filter(todoItem => item.key !== todoItem.key); - } - promptAction.showToast({ message: $r('app.string.deleted') }); - } - - // Item Swipe left to display the toolbar. - @Builder - itemEnd(item: ToDo) { - Row({ space: STYLE_CONFIG.ICON_GUTTER }) { - Image($r('app.media.ic_public_settings_filled')).ImageStyle() - .onClick(() => { - promptAction.showToast({ message: $r('app.string.incomplete') }); - }) - Image($r('app.media.ic_public_detail_filled')).ImageStyle() - .onClick(() => { - promptAction.showToast({ message: $r('app.string.incomplete') }); - }) - Image($r('app.media.ic_public_delete_filled')).ImageStyle() - .onClick(() => { - this.deleteTodoItem(item); - }) - } - .padding(STYLE_CONFIG.OPERATION_BUTTON_PADDING) - .justifyContent(FlexAlign.SpaceEvenly) - } +struct Index { build() { - Column() { - Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { - Text($r('app.string.todo')) - .fontSize($r('sys.float.ohos_id_text_size_headline7')) - Blank() - Image($r('app.media.ic_public_add_filled')) - .width(STYLE_CONFIG.MENU_IMAGE_SIZE) - .aspectRatio(1) - .onClick(() => { - // Adds data to the to-do list array based on the selection result of the text selection. - TextPickerDialog.show({ - range: getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.available_things')), - onAccept: (value: TextPickerResult) => { - this.toDoData.unshift(new ToDo(getContext(this) - .resourceManager - .getStringArrayValueSync($r('app.strarray.available_things'))[Number(value.index)])); - }, - }); - }) - } - .height(Constant.PERCENT_12) - .width(Constant.PERCENT_FULL) - .padding({ - left: $r('sys.float.ohos_id_max_padding_start'), - right: $r('sys.float.ohos_id_max_padding_end'), - }) - .backgroundColor(Color.White) - - // The to-do data display list gadget is bound to the data variable toDoData. - List({ initialIndex: 0, space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { - if (this.toDoData.length !== 0) { - ListItem() { - Text($r('app.string.undo')) - .fontSize($r('sys.float.ohos_id_text_size_headline8')) - } - } - ForEach(this.toDoData, (toDoItem: ToDo) => { - ListItem() { - ToDoListItem({ - toDoItem: toDoItem, - achieveData: this.achieveData, - toDoData: this.toDoData - }) - } - // Set the swipeAction property of the ListItem. When you swipe left, the customized UI view is displayed. - .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) - }, (toDoItem: ToDo) => toDoItem.key) - - if (this.achieveData.length !== 0) { - ListItem() { - Text($r('app.string.done')) - .fontSize($r('sys.float.ohos_id_text_size_headline8')) - } - } - ForEach(this.achieveData, (toDoItem: ToDo) => { - ListItem() { - ToDoListItem({ - toDoItem: toDoItem, - achieveData: this.achieveData, - toDoData: this.toDoData - }) - } - .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) - }, (toDoItem: ToDo) => toDoItem.key) - } - .layoutWeight(1) - .listDirection(Axis.Vertical) - .edgeEffect(EdgeEffect.Spring) - .padding({ - top: $r('sys.float.ohos_id_default_padding_top'), - left: $r('sys.float.ohos_id_default_padding_start'), - right: $r('sys.float.ohos_id_default_padding_end'), - }) + Stack() { + ToDoList() } - .backgroundColor($r('app.color.background_color')) - .height(Constant.PERCENT_FULL) - .width(Constant.PERCENT_FULL) } } \ No newline at end of file diff --git a/listitemeditmodule/.gitignore b/listitemeditmodule/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/listitemeditmodule/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/listitemeditmodule/Index.ets b/listitemeditmodule/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..383d2e073c6137a703b727c5f3808a86a19aa62f --- /dev/null +++ b/listitemeditmodule/Index.ets @@ -0,0 +1 @@ +export { ToDoList } from './src/main/ets/pages/ToDoList' diff --git a/listitemeditmodule/build-profile.json5 b/listitemeditmodule/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e6773f9f5d76a66d6d19fddc9c6ddb3f5621d3b1 --- /dev/null +++ b/listitemeditmodule/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + }, + "consumerFiles": [ + "./consumer-rules.txt" + ] + } + }, + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest" + } + ] +} diff --git a/listitemeditmodule/consumer-rules.txt b/listitemeditmodule/consumer-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/listitemeditmodule/hvigorfile.ts b/listitemeditmodule/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23 --- /dev/null +++ b/listitemeditmodule/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/listitemeditmodule/obfuscation-rules.txt b/listitemeditmodule/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/listitemeditmodule/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/listitemeditmodule/oh-package.json5 b/listitemeditmodule/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9bc0e77f946947c5b3e29699224425e585725a47 --- /dev/null +++ b/listitemeditmodule/oh-package.json5 @@ -0,0 +1,9 @@ +{ + "name": "@ohos_samples/listitemeditmodule", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "Index.ets", + "author": "", + "license": "Apache-2.0", + "dependencies": {} +} diff --git a/entry/src/main/ets/common/Constants.ets b/listitemeditmodule/src/main/ets/common/Constants.ets similarity index 100% rename from entry/src/main/ets/common/Constants.ets rename to listitemeditmodule/src/main/ets/common/Constants.ets diff --git a/entry/src/main/ets/model/ToDo.ets b/listitemeditmodule/src/main/ets/model/ToDo.ets similarity index 100% rename from entry/src/main/ets/model/ToDo.ets rename to listitemeditmodule/src/main/ets/model/ToDo.ets diff --git a/listitemeditmodule/src/main/ets/pages/ToDoList.ets b/listitemeditmodule/src/main/ets/pages/ToDoList.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8715a27f3f49df6a47c42ed66e920c01e13f734 --- /dev/null +++ b/listitemeditmodule/src/main/ets/pages/ToDoList.ets @@ -0,0 +1,146 @@ +/* + * 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 { promptAction } from '@kit.ArkUI'; +import { ToDo } from '../model/ToDo'; +import { ToDoListItem } from '../view/TodoListItem'; +import { STYLE_CONFIG, Constant } from '../common/Constants'; + +@Extend(Image) +function ImageStyle() { + .width(STYLE_CONFIG.IMAGE_SIZE) + .aspectRatio(1) + .margin(STYLE_CONFIG.IMAGE_MARGIN) +} + +@Entry +@Component +export struct ToDoList { + @State toDoData: ToDo[] = []; + @State achieveData: ToDo[] = []; + + /** + * Delete a to-do/completed item. + */ + deleteTodoItem(item: ToDo) { + if (item.isCompleted) { + this.achieveData = this.achieveData.filter(todoItem => item.key !== todoItem.key); + } else { + this.toDoData = this.toDoData.filter(todoItem => item.key !== todoItem.key); + } + promptAction.showToast({ message: $r('app.string.deleted') }); + } + + // Item Swipe left to display the toolbar. + @Builder + itemEnd(item: ToDo) { + Row({ space: STYLE_CONFIG.ICON_GUTTER }) { + Image($r('app.media.ic_public_settings_filled')).ImageStyle() + .onClick(() => { + promptAction.showToast({ message: $r('app.string.incomplete') }); + }) + Image($r('app.media.ic_public_detail_filled')).ImageStyle() + .onClick(() => { + promptAction.showToast({ message: $r('app.string.incomplete') }); + }) + Image($r('app.media.ic_public_delete_filled')).ImageStyle() + .onClick(() => { + this.deleteTodoItem(item); + }) + } + .padding(STYLE_CONFIG.OPERATION_BUTTON_PADDING) + .justifyContent(FlexAlign.SpaceEvenly) + } + + build() { + Column() { + Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { + Text($r('app.string.todo')) + .fontSize($r('sys.float.ohos_id_text_size_headline7')) + Blank() + Image($r('app.media.ic_public_add_filled')) + .width(STYLE_CONFIG.MENU_IMAGE_SIZE) + .aspectRatio(1) + .onClick(() => { + // Adds data to the to-do list array based on the selection result of the text selection. + TextPickerDialog.show({ + range: getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.available_things')), + onAccept: (value: TextPickerResult) => { + this.toDoData.unshift(new ToDo(getContext(this) + .resourceManager + .getStringArrayValueSync($r('app.strarray.available_things'))[Number(value.index)])); + }, + }); + }) + } + .height(Constant.PERCENT_12) + .width(Constant.PERCENT_FULL) + .padding({ + left: $r('sys.float.ohos_id_max_padding_start'), + right: $r('sys.float.ohos_id_max_padding_end'), + }) + .backgroundColor(Color.White) + + // The to-do data display list gadget is bound to the data variable toDoData. + List({ initialIndex: 0, space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { + if (this.toDoData.length !== 0) { + ListItem() { + Text($r('app.string.undo')) + .fontSize($r('sys.float.ohos_id_text_size_headline8')) + } + } + ForEach(this.toDoData, (toDoItem: ToDo) => { + ListItem() { + ToDoListItem({ + toDoItem: toDoItem, + achieveData: this.achieveData, + toDoData: this.toDoData + }) + } + // Set the swipeAction property of the ListItem. When you swipe left, the customized UI view is displayed. + .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) + }, (toDoItem: ToDo) => toDoItem.key) + + if (this.achieveData.length !== 0) { + ListItem() { + Text($r('app.string.done')) + .fontSize($r('sys.float.ohos_id_text_size_headline8')) + } + } + ForEach(this.achieveData, (toDoItem: ToDo) => { + ListItem() { + ToDoListItem({ + toDoItem: toDoItem, + achieveData: this.achieveData, + toDoData: this.toDoData + }) + } + .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) + }, (toDoItem: ToDo) => toDoItem.key) + } + .layoutWeight(1) + .listDirection(Axis.Vertical) + .edgeEffect(EdgeEffect.Spring) + .padding({ + top: $r('sys.float.ohos_id_default_padding_top'), + left: $r('sys.float.ohos_id_default_padding_start'), + right: $r('sys.float.ohos_id_default_padding_end'), + }) + } + .backgroundColor($r('app.color.background_color')) + .height(Constant.PERCENT_FULL) + .width(Constant.PERCENT_FULL) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/view/TodoListItem.ets b/listitemeditmodule/src/main/ets/view/TodoListItem.ets similarity index 100% rename from entry/src/main/ets/view/TodoListItem.ets rename to listitemeditmodule/src/main/ets/view/TodoListItem.ets diff --git a/listitemeditmodule/src/main/module.json5 b/listitemeditmodule/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7f0fad57de74a9acd3fecaa542cde0f0b20ec804 --- /dev/null +++ b/listitemeditmodule/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "listitemeditmodule", + "type": "har", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ] + } +} diff --git a/listitemeditmodule/src/main/resources/base/element/color.json b/listitemeditmodule/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..ab6f86207f76e10081964ee25d8c46d969e8b0d5 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "background_color", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/element/string.json b/listitemeditmodule/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ca49ce42ff02d44e0d25a9a77a242502cc83adb5 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ListItemEdit" + }, + { + "name": "edit", + "value": "Edit" + }, + { + "name": "deleted", + "value": "Successfully deleted" + }, + { + "name": "incomplete", + "value": "Incomplete" + }, + { + "name": "todo", + "value": "To-Do List" + }, + { + "name": "undo", + "value": "Ongoing" + }, + { + "name": "done", + "value": "Completed" + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/element/stringarray.json b/listitemeditmodule/src/main/resources/base/element/stringarray.json new file mode 100644 index 0000000000000000000000000000000000000000..0e8b31a0ffdac4b5fa9c5073e1cf010695aa3bc1 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/element/stringarray.json @@ -0,0 +1,27 @@ +{ + "strarray": [ + { + "name": "available_things", + "value": [ + { + "value": "Read books" + }, + { + "value": "Sports" + }, + { + "value": "Travel" + }, + { + "value": "Listening to music" + }, + { + "value": "Watch movies" + }, + { + "value": "Singing" + } + ] + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/background.png b/listitemeditmodule/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/listitemeditmodule/src/main/resources/base/media/background.png differ diff --git a/listitemeditmodule/src/main/resources/base/media/foreground.png b/listitemeditmodule/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/listitemeditmodule/src/main/resources/base/media/foreground.png differ diff --git a/listitemeditmodule/src/main/resources/base/media/ic_public_add_filled.svg b/listitemeditmodule/src/main/resources/base/media/ic_public_add_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..3a98de76ac370168e3c26c7622e0731b6fa9616a --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/media/ic_public_add_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_add_filled + + + + + + + + + + \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/ic_public_delete_filled.svg b/listitemeditmodule/src/main/resources/base/media/ic_public_delete_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..844ba381c355a0df4475c78692cd6b392f2131c0 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/media/ic_public_delete_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_delete_filled + + + + + + + + + + \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/ic_public_detail_filled.svg b/listitemeditmodule/src/main/resources/base/media/ic_public_detail_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..a19b2c34e37f8214a2305a38cd9d3f19bed40733 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/media/ic_public_detail_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_detail_filled + + + + + + + + + + \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/ic_public_ok_filled.svg b/listitemeditmodule/src/main/resources/base/media/ic_public_ok_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..b9fccf162635b02da08c4346bcf2d75a497449fb --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/media/ic_public_ok_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_ok_filled + + + + + + + + + + \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/ic_public_settings_filled.svg b/listitemeditmodule/src/main/resources/base/media/ic_public_settings_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..64604ea94d085e35aa6dce3c817f1f2f68a73137 --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/media/ic_public_settings_filled.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_settings_filled + + + + + + + + + + \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/base/media/layered_image.json b/listitemeditmodule/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/listitemeditmodule/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/listitemeditmodule/src/main/resources/base/media/startIcon.png b/listitemeditmodule/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/listitemeditmodule/src/main/resources/base/media/startIcon.png differ diff --git a/listitemeditmodule/src/main/resources/base/profile/main_pages.json b/listitemeditmodule/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..58737b12e1296bfbd175fe2b62eaf8d1025c5a3b --- /dev/null +++ b/listitemeditmodule/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/ToDoList" + ] +} diff --git a/listitemeditmodule/src/main/resources/en_US/element/string.json b/listitemeditmodule/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ca49ce42ff02d44e0d25a9a77a242502cc83adb5 --- /dev/null +++ b/listitemeditmodule/src/main/resources/en_US/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ListItemEdit" + }, + { + "name": "edit", + "value": "Edit" + }, + { + "name": "deleted", + "value": "Successfully deleted" + }, + { + "name": "incomplete", + "value": "Incomplete" + }, + { + "name": "todo", + "value": "To-Do List" + }, + { + "name": "undo", + "value": "Ongoing" + }, + { + "name": "done", + "value": "Completed" + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/en_US/element/stringarray.json b/listitemeditmodule/src/main/resources/en_US/element/stringarray.json new file mode 100644 index 0000000000000000000000000000000000000000..0e8b31a0ffdac4b5fa9c5073e1cf010695aa3bc1 --- /dev/null +++ b/listitemeditmodule/src/main/resources/en_US/element/stringarray.json @@ -0,0 +1,27 @@ +{ + "strarray": [ + { + "name": "available_things", + "value": [ + { + "value": "Read books" + }, + { + "value": "Sports" + }, + { + "value": "Travel" + }, + { + "value": "Listening to music" + }, + { + "value": "Watch movies" + }, + { + "value": "Singing" + } + ] + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/zh_CN/element/string.json b/listitemeditmodule/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..32e178ab37616e2ea2394d663a68b0e9ae5e312f --- /dev/null +++ b/listitemeditmodule/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "列表项编辑" + }, + { + "name": "edit", + "value": "编辑" + }, + { + "name": "deleted", + "value": "删除成功" + }, + { + "name": "incomplete", + "value": "功能待完善" + }, + { + "name": "todo", + "value": "待办" + }, + { + "name": "undo", + "value": "未完成" + }, + { + "name": "done", + "value": "已完成" + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/main/resources/zh_CN/element/stringarray.json b/listitemeditmodule/src/main/resources/zh_CN/element/stringarray.json new file mode 100644 index 0000000000000000000000000000000000000000..efd4d7471a65d719458365318c03b0babff8fd42 --- /dev/null +++ b/listitemeditmodule/src/main/resources/zh_CN/element/stringarray.json @@ -0,0 +1,27 @@ +{ + "strarray": [ + { + "name": "available_things", + "value": [ + { + "value": "读书" + }, + { + "value": "运动" + }, + { + "value": "旅游" + }, + { + "value": "听音乐" + }, + { + "value": "看电影" + }, + { + "value": "唱歌" + } + ] + } + ] +} \ No newline at end of file diff --git a/listitemeditmodule/src/ohosTest/ets/test/Ability.test.ets b/listitemeditmodule/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048 --- /dev/null +++ b/listitemeditmodule/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,35 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/listitemeditmodule/src/ohosTest/ets/test/List.test.ets b/listitemeditmodule/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545 --- /dev/null +++ b/listitemeditmodule/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/listitemeditmodule/src/ohosTest/module.json5 b/listitemeditmodule/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9420508f53decd1fa4213b40a0ba510ebd1e99bb --- /dev/null +++ b/listitemeditmodule/src/ohosTest/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "listitemeditmodule_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/listitemeditmodule/src/test/List.test.ets b/listitemeditmodule/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7 --- /dev/null +++ b/listitemeditmodule/src/test/List.test.ets @@ -0,0 +1,5 @@ +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/listitemeditmodule/src/test/LocalUnit.test.ets b/listitemeditmodule/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f --- /dev/null +++ b/listitemeditmodule/src/test/LocalUnit.test.ets @@ -0,0 +1,33 @@ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file