diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/.DS_Store differ diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100755 index 0000000000000000000000000000000000000000..709eb7bd598716c56ee583fb6e6e45b0b67b49f2 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.multipicturebeautification", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..a4d9f4b53004f5ababb4506b67896174c8a06a1e --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiPictureBeautification" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 27d17067f0095ba4cc4bf60af03da6667f35163a..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# MultiPictureBeautification - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 7fd83b94e5280b60ae2c740435a1d2eff1571404..ed693173db354c121af46e5126c3e36afea41393 --- a/README.md +++ b/README.md @@ -1,39 +1,48 @@ -# MultiPictureBeautification - -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +# 一多开发实例-图片美化 + +### 简介 + +基于自适应和响应式布局,实现一次开发,多端部署-图片美化。 + +#### 介绍 + +本篇Codelab基于自适应布局和响应式布局,实现一次开发,多端部署的即时通讯页面。通过“三层工程架构”实现代码复用,并根据手机、折叠屏以及2in1不同的设备尺寸设计对应页面。 +手机效果如图所示: + +![](screenshots/device/phone.png) + +折叠屏展开态效果如图所示: + +![](screenshots/device/foldable.png) + +平板,2in1效果如图所示: + +![](screenshots/device/pad.png) + +#### 相关概念 + +- 一次开发,多端部署:一套代码工程,一次开发上架,多端按需部署。支撑开发者快速高效的开发支持多种终端设备形态的应用,实现对不同设备兼容的同时,提供跨设备的流转、迁移和协同的分布式体验。 +- 组件区域变化事件:组件区域变化事件指组件显示的尺寸、位置等发生变化时触发的事件。 +- 双指缩放:用于触发捏合手势,触发捏合手势的最少手指为2指,最大为5指,最小识别距离为5vp。 + +#### 相关权限 + +不涉及。 + +#### 使用说明 + +- 分别在手机、折叠屏、平板、2in1安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +- 点击编辑、相册图标将分别进入图片编辑页面,相册页面。 + +#### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 +2. HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 +3. DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 +4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 + +### 注意 + +运行时需设置引用所有HSP模块。点击Run > Edit Configurations,选择Deploy Multi Hap标签页,勾选Deploy Multi Hap Packages, 选择使用方模块(phone)和所有HSP模块,点击OK。单击Run > Run "模块名称"(如Run "phone")或![](screenshots/device/run.png)来启动应用/服务的编译构建。 + +![](screenshots/device/config.png) diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..043a19ec8dea963447c3c82ba61e851af968ed64 --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,83 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./product/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "base", + "srcPath": "./commons/base", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "pictureView", + "srcPath": "./features/pictureView", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "albumView", + "srcPath": "./features/albumView", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "pictureEdit", + "srcPath": "./features/pictureEdit", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/commons/base/Index.ets b/commons/base/Index.ets new file mode 100755 index 0000000000000000000000000000000000000000..8b77360bb1fbff1426536103f2faafc391b42c5f --- /dev/null +++ b/commons/base/Index.ets @@ -0,0 +1,3 @@ +export { BaseConstants } from './src/main/ets/constants/BaseConstants' +export { BreakpointConstants } from './src/main/ets/constants/BreakpointConstants' +export { BreakpointType } from './src/main/ets/utils/BreakpointType' \ No newline at end of file diff --git a/commons/base/build-profile.json5 b/commons/base/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..78a5a3f1f587ddd84cd8f23ea0f6a818d6d25676 --- /dev/null +++ b/commons/base/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/commons/base/hvigorfile.ts b/commons/base/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..64fa6f97b15f9d477f14026c181352882b94a21b --- /dev/null +++ b/commons/base/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/commons/base/obfuscation-rules.txt b/commons/base/obfuscation-rules.txt new file mode 100755 index 0000000000000000000000000000000000000000..3ae3d22892781d9b4f8833eb1b19d819c3032d58 --- /dev/null +++ b/commons/base/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# 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://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# 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 \ No newline at end of file diff --git a/commons/base/oh-package.json5 b/commons/base/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..81d451765529810444b3a7b804658100d0613afe --- /dev/null +++ b/commons/base/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "base", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": {} +} diff --git a/commons/base/src/main/ets/constants/BaseConstants.ets b/commons/base/src/main/ets/constants/BaseConstants.ets new file mode 100755 index 0000000000000000000000000000000000000000..def1d485ec5bfaec75dce6b5faa9d2ca9a5aa219 --- /dev/null +++ b/commons/base/src/main/ets/constants/BaseConstants.ets @@ -0,0 +1,139 @@ +/* + * 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. + */ + +export class BaseConstants { + /** + * Component size. + */ + static readonly FULL_PERCENT: string = '100%'; + static readonly FULL_SIZE: string = '100%'; + static readonly FULL_HEIGHT: string = '100%'; + static readonly FULL_WIDTH: string = '100%'; + static readonly NINETY_WIDTH_PERCENT: string = '90%'; + static readonly IMAGE_ONE_WIDTH_SM: string = '66.6%'; + static readonly IMAGE_ONE_WIDTH_MD: string = '63.8%'; + static readonly IMAGE_ONE_WIDTH_LG: string = '32.1%'; + static readonly TAB_PADDING_TOP: string = '28.6%' + static readonly TAB_PADDING_BOTTOM: string = '28.6%' + static readonly HOME_LIST_WIDTH: string = '37%' + static readonly APPLET_LIST_WIDTH: string = '37%' + static readonly IMAGE_ONE_ASPECT_RATIO: number = 1.33; + static readonly SMALL_MINI_FONT_SIZE: Resource = $r('app.float.smaller_mini_font_size'); + /** + * Text property. + */ + static readonly FONT_FAMILY_SEMI_BOLD: Resource = $r('app.float.font_family_semi_bold'); + static readonly FONT_FAMILY_NORMAL: Resource = $r('app.float.font_family_normal'); + static readonly FONT_FAMILY_BOLD: Resource = $r('app.float.font_family_bold'); + static readonly FONT_FAMILY_MEDIUM: Resource = $r('app.float.font_family_medium'); + static readonly FONT_WEIGHT_SEVEN: number = 700; + static readonly FONT_WEIGHT_SIX: number = 600; + static readonly FONT_WEIGHT_FIVE: number = 500; + static readonly FONT_WEIGHT_FOUR: number = 400; + static readonly FONT_SIZE_TEN: Resource = $r('app.float.font_size_ten'); + static readonly FONT_SIZE_ELEVEN: Resource = $r('app.float.font_size_eleven'); + static readonly FONT_SIZE_TWELVE: Resource = $r('app.float.font_size_twelve'); + static readonly FONT_SIZE_FOURTEEN: Resource = $r('app.float.font_size_fourteen'); + static readonly FONT_SIZE_SIXTEEN: Resource = $r('app.float.font_size_sixteen'); + static readonly FONT_SIZE_EIGHTEEN: Resource = $r('app.float.font_size_eighteen'); + static readonly FONT_SIZE_TWENTY: Resource = $r('app.float.font_size_twenty'); + static readonly FONT_SIZE_TWENTY_FOUR: Resource = $r('app.float.font_size_twenty_four'); + static readonly FONT_SIZE_THIRTY_TWO: Resource = $r('app.float.font_size_thirty_two'); + /** + * Application about. + */ + static readonly SPLIT_DOCUMENT_SCREEN = false; + static readonly SPLIT_APPLET_SCREEN = false; + /** + * Flex about. + */ + static readonly FLEX_GROW_ONE = 1; + static readonly LAYOUT_WEIGHT_ONE = 1; + static readonly FLEX_SHRINK_ZERO = 0; + static readonly FLEX_SHRINK_ONE = 1; + /** + * HomeTab. + */ + static readonly HOME_TAB_HEIGHT_SM: string = '56vp'; + static readonly HOME_TAB_HEIGHT_MD: string = '56vp'; + static readonly HOME_TAB_HEIGHT_LG: string = '100%'; + static readonly HOME_TAB_WIDTH_SM: string = '100%'; + static readonly HOME_TAB_WIDTH_MD: string = '100%'; + static readonly HOME_TAB_WIDTH_LG: string = '96vp'; + static readonly CONTACTS_PHONE_WIDTH_SM: string = '27%'; + static readonly CONTACTS_PHONE_WIDTH_MD: string = '28%'; + static readonly CONTACTS_PHONE_WIDTH_LG: string = '25%'; + static readonly CONTACTS_DETAIL_HEIGHT_SM: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_MD: string = '100%'; + static readonly CONTACTS_DETAIL_HEIGHT_LG: string = '90%'; + static readonly CONTACTS_ITEM_HEIGHT_SM: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_MD: string = '11%'; + static readonly CONTACTS_ITEM_HEIGHT_LG: string = '10%'; + /** + * Document tab. + */ + static readonly DOCUMENT_TITLE_HEIGHT_SM: string = '33%'; + static readonly DOCUMENT_TITLE_HEIGHT_MD: string = '58%'; + static readonly DOCUMENT_TITLE_HEIGHT_LG: string = '100%'; + static readonly DOCUMENT_TITLE_SPACE_SM: number = 32; + static readonly DOCUMENT_TITLE_SPACE_MD: number = 56; + static readonly DOCUMENT_TITLE_SPACE_LG: number = 103; + /** + * Component opacity value: 1. + */ + static readonly FULL_OPACITY: number = 1; + /** + * Component opacity value: 0.6. + */ + static readonly SIXTY_OPACITY: number = 0.6; + /** + * Device grid column list. + */ + static readonly DEVICE_GRID_COLUMNS: string[] = ['1fr 1fr', '1fr 1fr 1fr', '1fr 1fr 1fr 1fr', '1fr 1fr 1fr 1fr 1fr', + '1fr 1fr 1fr 1fr 1fr 1fr 1fr']; + /** + * Default icon size. + */ + static readonly DEFAULT_ICON_SIZE: number = 24; + /** + * Device 2in1. + */ + static readonly DEVICE_2IN1: string = '2in1'; +} + +/** + * Current feature home, applet or document. + */ +export enum CurrentFeature { + HOME = 0, + APPLET = 1, + DOCUMENT = 2 +} + +/** + * Current page home,conversation or socialCircle. + */ +export enum CurrentPage { + HOME = 0, + CONVERSATION = 1, + SOCIAL_CIRCLE = 2, + ME = 3 +} + +export enum DeviceTypes { + PHONE = 'phone', + TABLET = 'tablet', + "2IN1" = '2in1', +} \ No newline at end of file diff --git a/commons/base/src/main/ets/constants/BreakpointConstants.ets b/commons/base/src/main/ets/constants/BreakpointConstants.ets new file mode 100755 index 0000000000000000000000000000000000000000..77a84a94b5e9c2de1b30b9ed72b6665978a7bc85 --- /dev/null +++ b/commons/base/src/main/ets/constants/BreakpointConstants.ets @@ -0,0 +1,54 @@ +/* + * 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. + */ + +/** + * Constants for breakpoint. + */ +export class BreakpointConstants { + /** + * Breakpoints that represent small device types. + */ + static readonly BREAKPOINT_SM: string = 'sm'; + + /** + * Breakpoints that represent middle device types. + */ + static readonly BREAKPOINT_MD: string = 'md'; + + /** + * Breakpoints that represent large device types. + */ + static readonly BREAKPOINT_LG: string = 'lg'; + + /** + * Grid row column list. + */ + static readonly GRID_ROW_COLUMNS: number[] = [12, 15, 4]; + + /** + * Grid column span list. + */ + static readonly GRID_COLUMN_SPANS: number[] = [12, 6, 7, 5, 3, 4, 2]; + + /** + * Middle device width. + */ + static readonly MIDDLE_DEVICE_WIDTH: number = 600; + + /** + * Large device width. + */ + static readonly LARGE_DEVICE_WIDTH: number = 840; +} \ No newline at end of file diff --git a/commons/base/src/main/ets/utils/BreakpointType.ets b/commons/base/src/main/ets/utils/BreakpointType.ets new file mode 100755 index 0000000000000000000000000000000000000000..fc819ccc51361c559dd6c639d6aa771098113a02 --- /dev/null +++ b/commons/base/src/main/ets/utils/BreakpointType.ets @@ -0,0 +1,38 @@ +/* + * 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 { BreakpointConstants } from '../constants/BreakpointConstants'; + +export class BreakpointType { + sm: T; + md: T; + lg: T; + + constructor(sm: T, md: T, lg: T) { + this.sm = sm; + this.md = md; + this.lg = lg; + } + + GetValue(currentBreakpoint: string): T { + if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { + return this.md; + } else if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { + return this.lg; + } else { + return this.sm; + } + } +} \ No newline at end of file diff --git a/commons/base/src/main/module.json5 b/commons/base/src/main/module.json5 new file mode 100755 index 0000000000000000000000000000000000000000..eb28b576e25a85f1c79c8b3cfedf1c28eaec24d9 --- /dev/null +++ b/commons/base/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "base", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + } +} \ No newline at end of file diff --git a/commons/base/src/main/resources/base/element/color.json b/commons/base/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..62a137a61b90c14f109ed8c81d9d551ea0a5888a --- /dev/null +++ b/commons/base/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/commons/base/src/main/resources/base/element/float.json b/commons/base/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..34bdfe8f6fe4c7349efbc6b886ea5a16ef7013b8 --- /dev/null +++ b/commons/base/src/main/resources/base/element/float.json @@ -0,0 +1,120 @@ +{ + "float": [ + { + "name": "micro_font_size", + "value": "10fp" + }, + { + "name": "smaller_mini_font_size", + "value": "11fp" + }, + { + "name": "icon_height_one", + "value": "24vp" + }, + { + "name": "icon_width_one", + "value": "24vp" + }, + { + "name": "icon_margin_one", + "value": "12vp" + }, + { + "name": "icon_margin_two", + "value": "24vp" + }, + { + "name": "main_image_size", + "value": "22vp" + }, + { + "name": "main_image_size_lg", + "value": "24vp" + }, + { + "name": "avatar_image_size", + "value": "40vp" + }, + { + "name": "bar_width", + "value": "96vp" + }, + { + "name": "text_line_height_one", + "value": "19vp" + }, + { + "name": "text_line_height_three", + "value": "14vp" + }, + { + "name": "text_line_height_two", + "value": "22vp" + }, + { + "name": "text_line_height_five", + "value": "21vp" + }, + { + "name": "background_color_grey", + "value": "#111111" + }, + { + "name": "input_raduis_one", + "value": "20vp" + }, + { + "name": "font_family_normal", + "value": "HarmonyHeiTi" + }, + { + "name": "font_family_medium", + "value": "HarmonyHeiTi-Medium" + }, + { + "name": "font_family_bold", + "value": "HarmonyHeiTi-Bold" + }, + { + "name": "font_family_semi_bold", + "value": "HarmonyHeiTi-SemiBold" + }, + { + "name": "font_size_ten", + "value": "10fp" + }, + { + "name": "font_size_eleven", + "value": "11fp" + }, + { + "name": "font_size_twelve", + "value": "12fp" + }, + { + "name": "font_size_fourteen", + "value": "14fp" + }, + { + "name": "font_size_sixteen", + "value": "16fp" + }, + { + "name": "font_size_eighteen", + "value": "18fp" + }, + { + "name": "font_size_twenty", + "value": "20fp" + }, + { + "name": "font_size_twenty_four", + "value": "24fp" + }, + { + "name": "font_size_thirty_two", + "value": "32fp" + } + ] +} \ No newline at end of file diff --git a/commons/base/src/main/resources/base/element/string.json b/commons/base/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..95ba6cbabb98622d7723dcd5f616d3326345eb95 --- /dev/null +++ b/commons/base/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/commons/base/src/main/resources/base/media/icon.png b/commons/base/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/commons/base/src/main/resources/base/media/icon.png differ diff --git a/commons/base/src/main/resources/base/media/setting.jpeg b/commons/base/src/main/resources/base/media/setting.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/commons/base/src/main/resources/base/media/setting.jpeg differ diff --git a/features/albumView/build-profile.json5 b/features/albumView/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..78a5a3f1f587ddd84cd8f23ea0f6a818d6d25676 --- /dev/null +++ b/features/albumView/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/albumView/hvigorfile.ts b/features/albumView/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..64fa6f97b15f9d477f14026c181352882b94a21b --- /dev/null +++ b/features/albumView/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/albumView/obfuscation-rules.txt b/features/albumView/obfuscation-rules.txt new file mode 100755 index 0000000000000000000000000000000000000000..3ae3d22892781d9b4f8833eb1b19d819c3032d58 --- /dev/null +++ b/features/albumView/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# 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://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# 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 \ No newline at end of file diff --git a/features/albumView/oh-package.json5 b/features/albumView/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..5dcf579f812cb85edbbc8a9c5710c48a24e3b09c --- /dev/null +++ b/features/albumView/oh-package.json5 @@ -0,0 +1,11 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "albumview", + "description": "Please describe the basic information.", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/features/albumView/src/main/ets/constants/AlbumViewConstants.ets b/features/albumView/src/main/ets/constants/AlbumViewConstants.ets new file mode 100755 index 0000000000000000000000000000000000000000..013cb445b3309f185407681548531eb4bf5cff74 --- /dev/null +++ b/features/albumView/src/main/ets/constants/AlbumViewConstants.ets @@ -0,0 +1,80 @@ +/* + * 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. + */ + +/** + * Constants. + */ +export interface ImageData { + src: Resource, + selected: boolean +} + +export class AlbumViewConstants { + /** + * Image list. + */ + static readonly IMAGE_LIST: ImageData[] = [ + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false }, + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false }, + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false }, + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false }, + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false }, + { src: $r('app.media.photo1'), selected: false }, + { src: $r('app.media.photo2'), selected: false }, + { src: $r('app.media.photo3'), selected: false }, + { src: $r('app.media.photo4'), selected: false }, + { src: $r('app.media.photo5'), selected: false }, + { src: $r('app.media.photo6'), selected: false }, + { src: $r('app.media.photo7'), selected: false } + ]; + /** + * Default text. + */ + static DES_TEXT = '图片'; + /** + * Side constants. + */ + static SideConstants: string[] = [' 照片、人物、地点...', '相册', '图片', '我的收藏', '12', '视频', '新建相册1', '新建相册1', '人像', '地点', '上海市', '北京市', '南京市', '分类']; +} \ No newline at end of file diff --git a/features/albumView/src/main/ets/pages/AlbumViewIndex.ets b/features/albumView/src/main/ets/pages/AlbumViewIndex.ets new file mode 100755 index 0000000000000000000000000000000000000000..afa3b4a3f60822575d126cd0cde1326937cb7865 --- /dev/null +++ b/features/albumView/src/main/ets/pages/AlbumViewIndex.ets @@ -0,0 +1,196 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import { SideColumn } from '../views/SideColumn'; +import { AlbumViewConstants, ImageData } from '../constants/AlbumViewConstants' +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +// Grid unit. +const DEFAULT_GRID_TEMPLATE: string = '1fr'; +// Animate tiem. +const ANIMATE_TIME: number = 100; +// Max grid column. +const MAX_GRID_COLUMN = 16; +// Min grid column. +const MIN_GRID_COLUMN = 2; +// Finger number. +const FINGER_NUMBER = 2; +// Delay time +const DELAY = 70 +// Final delay time +const FINAL_DELAY = 100 + +@Entry +@Component +struct AlbumViewIndex { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_SM; + // Grid column num. + @State gridColumn: number = 3; + // Grid row num. + @State gridRow: number = 2; + // Save up setTimeOut + timeOutUpDemo: number = 0 + // Save down setTimeOut + timeOutDownDemo: number = 0 + + // Change the number of Grid columns based on the width of the Grid component. + getGridColumn(value: Length): number { + return Math.floor(2 * ((parseInt(JSON.stringify(value)) / 360) - 1) + 4); + } + + // PinchGesture up + up() { + if (!this.timeOutUpDemo) { + this.timeOutUpDemo = setTimeout(() => { + animateTo({ + duration: ANIMATE_TIME + }, () => { + if (this.gridColumn > MIN_GRID_COLUMN) { + this.gridColumn -= 1; + clearTimeout(this.timeOutUpDemo) + this.timeOutUpDemo = 0 + } + }) + }, DELAY) + } + setTimeout(() => { + this.timeOutUpDemo = 0 + }, FINAL_DELAY) + } + + // PinchGesture down + down() { + if (!this.timeOutDownDemo) { + this.timeOutDownDemo = setTimeout(() => { + animateTo({ + duration: ANIMATE_TIME + }, () => { + if (this.gridColumn < MAX_GRID_COLUMN) { + this.gridColumn += 1; + clearTimeout(this.timeOutDownDemo) + this.timeOutDownDemo = 0 + } + }) + + }, DELAY) + } + setTimeout(() => { + this.timeOutDownDemo = 0 + }, FINAL_DELAY) + + } + + @Builder + topRow() { + Column() { + Row() { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_public_back')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .onClick(() => { + router.back() + }) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + .margin({ right: $r('app.float.back_image_right') }) + + Text(AlbumViewConstants.DES_TEXT) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .height($r('app.float.text_image_height')) + Blank() + + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_gallery_material_select_checkbox')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + .margin({ right: $r('app.float.select_button_margin_right') }) + } + + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.ic_public_more')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .backgroundColor(Color.White) + + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.tab_height')) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.tab_left'), + right: $r('app.float.tab_right'), + top: $r('app.float.tab_top'), + bottom: $r('app.float.tab_bottom') + }) + .visibility(Visibility.Visible) + } + } + + build() { + Flex() { + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + SideColumn() + .width($r('app.float.side_width')) + } + Flex({ direction: FlexDirection.Column }) { + this.topRow() + Flex() { + Grid() { + ForEach(AlbumViewConstants.IMAGE_LIST, (item: ImageData) => { + GridItem() { + Image(item.src) + .objectFit(ImageFit.Cover) + .autoResize(true) + .borderColor(item.selected ? Color.Blue : Color.White) + .borderWidth(1) + }.aspectRatio(1) + }, (item: ImageData, index: number) => index + JSON.stringify(item)) + } + .columnsTemplate(new Array(this.gridColumn).fill(DEFAULT_GRID_TEMPLATE).join(' ')) + + } + .onAreaChange((oldValue: Area, newValue: Area) => { + this.gridColumn = this.getGridColumn(newValue.width); + }) + .gesture(PinchGesture({ fingers: FINGER_NUMBER }).onActionUpdate((event: GestureEvent) => { + if (event.scale > 1) { + this.up() + } else { + this.down() + } + })) + } + } + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } +} \ No newline at end of file diff --git a/features/albumView/src/main/ets/views/SideColumn.ets b/features/albumView/src/main/ets/views/SideColumn.ets new file mode 100755 index 0000000000000000000000000000000000000000..ce33b2fa83acb7b7ddaf7754a007c0d161a51226 --- /dev/null +++ b/features/albumView/src/main/ets/views/SideColumn.ets @@ -0,0 +1,287 @@ +/* + * 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 { BaseConstants } from '@ohos/commons'; +import { AlbumViewConstants } from '../constants/AlbumViewConstants'; + +@Component +export struct SideColumn { + build() { + Flex({ direction: FlexDirection.Column }) { + Row() { + Button({ type: ButtonType.Circle, stateEffect: false }) { + Image($r('app.media.switch')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + } + .backgroundColor(Color.White) + .margin({ right: $r('app.float.side_button_right') }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.side_button_height')) + .padding({ + left: $r('app.float.side_button_padding_left'), + right: $r('app.float.side_button_padding_right'), + top: $r('app.float.side_button_padding_top'), + bottom: $r('app.float.side_button_padding_bottom') + }) + + Row() { + Stack({ alignContent: Alignment.Start }) { + TextInput({ placeholder: AlbumViewConstants.SideConstants[0] }) + .type(InputType.Normal) + .enableKeyboardOnFocus(false) + + Image($r('app.media.search2')) + .aspectRatio(1) + .autoResize(true) + .padding({ + left: $r('app.float.search_left'), + top: $r('app.float.search_top'), + bottom: $r('app.float.search_bottom') + }) + }.padding({ left: $r('app.float.search_left') }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.search_height')) + .padding({ + right: $r('app.float.search_stack_right'), + top: $r('app.float.search_stack_top') + }) + + Row() { + Image($r('app.media.public_ic_public_folder_photo')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ + left: $r('app.float.margin_eight'), + right: $r('app.float.margin_eight') + }) + Text(AlbumViewConstants.SideConstants[1]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Image($r('app.media.public_ic_public_folder_album')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ + left: $r('app.float.margin_eight'), + right: $r('app.float.margin_eight') + }) + Text(AlbumViewConstants.SideConstants[1]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: 90 + }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[2]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + .fontColor('#0A59F7') + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[3]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[5]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[6]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[7]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Divider() + Row() { + Text(AlbumViewConstants.SideConstants[8]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[9]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: 90 + }) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[10]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[11]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[12]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Text(AlbumViewConstants.SideConstants[4]) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left2'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + + Row() { + Text(AlbumViewConstants.SideConstants[13]) + .fontSize(BaseConstants.FONT_SIZE_SIXTEEN) + Blank() + Image($r('app.media.ic_public_arrow_right')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width($r('app.float.image_width')) + } + .width(BaseConstants.FULL_WIDTH) + .height($r('app.float.row_height')) + .padding({ + left: $r('app.float.row_padding_left'), + right: $r('app.float.row_padding_right'), + top: $r('app.float.row_padding_top') + }) + } + } +} diff --git a/features/albumView/src/main/module.json5 b/features/albumView/src/main/module.json5 new file mode 100755 index 0000000000000000000000000000000000000000..bc394f51efe044e6e95c8933a74286ecabba991e --- /dev/null +++ b/features/albumView/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "albumView", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/element/color.json b/features/albumView/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..62a137a61b90c14f109ed8c81d9d551ea0a5888a --- /dev/null +++ b/features/albumView/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/element/float.json b/features/albumView/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..403ec88d29e3000422745af3e89213a984dbcd8d --- /dev/null +++ b/features/albumView/src/main/resources/base/element/float.json @@ -0,0 +1,128 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "16vp" + }, + { + "name": "text_image_height", + "value": "24vp" + }, + { + "name": "select_button_margin_right", + "value": "24vp" + }, + { + "name": "tab_height", + "value": "54vp" + }, + { + "name": "tab_right", + "value": "26vp" + }, + { + "name": "tab_left", + "value": "26vp" + }, + { + "name": "tab_top", + "value": "14vp" + }, + { + "name": "tab_bottom", + "value": "14vp" + }, + { + "name": "side_width", + "value": "280vp" + }, + { + "name": "side_button_right", + "value": "16vp" + }, + { + "name": "side_button_height", + "value": "54vp" + }, + { + "name": "side_button_padding_left", + "value": "26vp" + }, + { + "name": "side_button_padding_right", + "value": "26vp" + }, + { + "name": "side_button_padding_top", + "value": "14vp" + }, + { + "name": "side_button_padding_bottom", + "value": "14vp" + }, + { + "name": "search_left", + "value": "10vp" + }, + { + "name": "search_top", + "value": "5vp" + }, + { + "name": "search_bottom", + "value": "5vp" + }, + { + "name": "search_height", + "value": "48vp" + }, + { + "name": "search_stack_right", + "value": "12vp" + }, + { + "name": "search_stack_top", + "value": "14vp" + }, + { + "name": "row_height", + "value": "48vp" + }, + { + "name": "margin_eight", + "value": "8vp" + }, + { + "name": "row_padding_left", + "value": "52vp" + }, + { + "name": "row_padding_right", + "value": "12vp" + }, + { + "name": "row_padding_top", + "value": "14vp" + }, + { + "name": "row_padding_left2", + "value": "76vp" + }, + { + "name": "image_width", + "value": "12vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/element/string.json b/features/albumView/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..95ba6cbabb98622d7723dcd5f616d3326345eb95 --- /dev/null +++ b/features/albumView/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg b/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg new file mode 100755 index 0000000000000000000000000000000000000000..b9a2913e81ad088d33b5d7e6e3d05e34b9bbbf59 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/ic_gallery_material_select_checkbox.svg @@ -0,0 +1,11 @@ + + + ic_gallery_material_select_checkbox + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg b/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg new file mode 100755 index 0000000000000000000000000000000000000000..7dbbd9f247a6aa51a784085c6697c004171b2bab --- /dev/null +++ b/features/albumView/src/main/resources/base/media/ic_public_arrow_down_0.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_down_0 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg b/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100755 index 0000000000000000000000000000000000000000..c9db92b418432a1c349ced0a293e042d2fa14f20 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/ic_public_back.svg b/features/albumView/src/main/resources/base/media/ic_public_back.svg new file mode 100755 index 0000000000000000000000000000000000000000..466903b263bebc25ae9b2e40098b30b6c12f1653 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/ic_public_more.svg b/features/albumView/src/main/resources/base/media/ic_public_more.svg new file mode 100755 index 0000000000000000000000000000000000000000..2c4f6192ffddb951114eddab041bb77ffd106094 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_more + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/icon.png b/features/albumView/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/albumView/src/main/resources/base/media/icon.png differ diff --git a/features/albumView/src/main/resources/base/media/photo1.jpg b/features/albumView/src/main/resources/base/media/photo1.jpg new file mode 100755 index 0000000000000000000000000000000000000000..cb4e7161886e7db0944ceddf0bcbd130371cb7c6 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo1.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo2.jpg b/features/albumView/src/main/resources/base/media/photo2.jpg new file mode 100755 index 0000000000000000000000000000000000000000..7a3a7e45696d6f32f0818f0ce6e9252f77f463ee Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo2.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo3.jpg b/features/albumView/src/main/resources/base/media/photo3.jpg new file mode 100755 index 0000000000000000000000000000000000000000..926a77f6e6d96090d759f521ed352d6210c645d4 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo3.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo4.jpg b/features/albumView/src/main/resources/base/media/photo4.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fb763b87279c3fd1bcf7a2335c70f9b0846412cb Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo4.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo5.jpg b/features/albumView/src/main/resources/base/media/photo5.jpg new file mode 100755 index 0000000000000000000000000000000000000000..a830f0ce6fa0a0791a3621ba1266c2b63e8b8723 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo5.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo6.jpg b/features/albumView/src/main/resources/base/media/photo6.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo6.jpg differ diff --git a/features/albumView/src/main/resources/base/media/photo7.jpg b/features/albumView/src/main/resources/base/media/photo7.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/photo7.jpg differ diff --git a/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg b/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg new file mode 100755 index 0000000000000000000000000000000000000000..1753a84789e07c8d2c5f11b1ce272d79bc0e0dc7 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/public_ic_public_folder_album.svg @@ -0,0 +1,14 @@ + + + Public_ic_public_folder 3 + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg b/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg new file mode 100755 index 0000000000000000000000000000000000000000..5c8286bc65910f166deb29b9ea6bcae8115ba334 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/public_ic_public_folder_photo.svg @@ -0,0 +1,14 @@ + + + Public_ic_public_folder 2 + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/search2.svg b/features/albumView/src/main/resources/base/media/search2.svg new file mode 100755 index 0000000000000000000000000000000000000000..5c24b33fa4c86979a69c39e984aad8488b7d2fb6 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/search2.svg @@ -0,0 +1,22 @@ + + + ic_s_ic S_search 2 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/media/setting.jpeg b/features/albumView/src/main/resources/base/media/setting.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/setting.jpeg differ diff --git a/features/albumView/src/main/resources/base/media/startIcon.png b/features/albumView/src/main/resources/base/media/startIcon.png new file mode 100755 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/features/albumView/src/main/resources/base/media/startIcon.png differ diff --git a/features/albumView/src/main/resources/base/media/switch.svg b/features/albumView/src/main/resources/base/media/switch.svg new file mode 100755 index 0000000000000000000000000000000000000000..2052859f9760edd3415f7bc2ac985b8b0578c542 --- /dev/null +++ b/features/albumView/src/main/resources/base/media/switch.svg @@ -0,0 +1,19 @@ + + + newicon备份 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/albumView/src/main/resources/base/profile/main_pages.json b/features/albumView/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..d2e397f3fd2c47afcbdcfa7d4de247e5b8f1efea --- /dev/null +++ b/features/albumView/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/AlbumViewIndex" + ] +} diff --git a/features/pictureEdit/Index.ets b/features/pictureEdit/Index.ets new file mode 100755 index 0000000000000000000000000000000000000000..f1d9b1dda939ae56aa34dc9b8e5fedd0d42aa47a --- /dev/null +++ b/features/pictureEdit/Index.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 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. + */ + +export { PictureEditIndex } from './src/main/ets/pages/PictureEditIndex' \ No newline at end of file diff --git a/features/pictureEdit/build-profile.json5 b/features/pictureEdit/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..78a5a3f1f587ddd84cd8f23ea0f6a818d6d25676 --- /dev/null +++ b/features/pictureEdit/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/pictureEdit/hvigorfile.ts b/features/pictureEdit/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..64fa6f97b15f9d477f14026c181352882b94a21b --- /dev/null +++ b/features/pictureEdit/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/pictureEdit/obfuscation-rules.txt b/features/pictureEdit/obfuscation-rules.txt new file mode 100755 index 0000000000000000000000000000000000000000..3ae3d22892781d9b4f8833eb1b19d819c3032d58 --- /dev/null +++ b/features/pictureEdit/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# 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://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# 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 \ No newline at end of file diff --git a/features/pictureEdit/oh-package.json5 b/features/pictureEdit/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..2b5bcef569b2f691bd26040fdfedd2a11dc9c341 --- /dev/null +++ b/features/pictureEdit/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "pictureedit", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets b/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets new file mode 100755 index 0000000000000000000000000000000000000000..9ead7a31e1312b10227fe054992468c7ac1f6cb5 --- /dev/null +++ b/features/pictureEdit/src/main/ets/constants/PictureEditConstants.ets @@ -0,0 +1,112 @@ +/* + * 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 { PicAndName, ToolsAndName } from '../viewmodel/AdaptiveViewModel'; + +export default class PictureEditConstants { + /** + * Picture size. + */ + static PICTURE_HEIGHT_SM = '90%'; + static PICTURE_HEIGHT_MD = '90%'; + static PICTURE_HEIGHT_LG = '90%'; + static PICTURE_WIDTH_SM = '72%'; + static PICTURE_WIDTH_MD = '72%'; + static PICTURE_WIDTH_LG = '40%'; + static PICTURE_WIDTH_MD_ROW = '82%'; + static PICTURE_WIDTH_MD_COLUMN = '36.6%'; + static PICTURE_HEIGHT = '95%'; + static PICTURE_HALF_HEIGHT = '50%'; + /** + * Flex basis. + */ + static SLIDER_FLEX_BASIS = 80; + static BAR_FLEX_BASIS = 60; + static OPTION_FLEX_BASIS = 250; + static IMAGE_BORDER_RADIUS = 8; + /** + * Edit text. + */ + static Edit_Text = '编辑'; + /** + * Tools name. + */ + static toolsAndName: ToolsAndName[] = [ + { + pic: $r("app.media.tools_2"), pic_name: "截取" + }, + { + pic: $r("app.media.tools_1"), pic_name: "裁剪" + }, + { + pic: $r("app.media.tools_3"), pic_name: "调节" + }, + { + pic: $r("app.media.tools_4"), pic_name: "滤镜" + }]; + /** + * Filter name. + */ + static filterAndName: PicAndName[] = [ + { + pic: $r("app.media.photo"), pic_name: "原片", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "经典", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "晨光", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "黄昏", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "光晕", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "童年", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "怀旧", color_filter: [1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0] + }, + { + pic: $r("app.media.photo"), pic_name: "老照片", color_filter: [1, 1, 0, 0, 0, + 1, 1, 0, 0, 0, + 1, 0, 1, 0, 0, + 1, 0, 0, 1, 0] + } + ]; +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/ets/pages/PictureEditIndex.ets b/features/pictureEdit/src/main/ets/pages/PictureEditIndex.ets new file mode 100755 index 0000000000000000000000000000000000000000..0946e9bc6acd1909eae869a960f61d311d933dad --- /dev/null +++ b/features/pictureEdit/src/main/ets/pages/PictureEditIndex.ets @@ -0,0 +1,235 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import PictureEditConstants from '../constants/PictureEditConstants'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +interface ToolsAndName { + pic: Resource + pic_name: string +} + +interface PicAndName { + pic: Resource + pic_name: string + color_filter: number[] +} + +@Entry +@Component +export struct PictureEditIndex { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @State outSetValueOne: number = 40; + @State windowDirection: boolean = true; + @State pictureWidth: string = BaseConstants.FULL_WIDTH; + + isColumnLayout(bp: string, direction: Boolean): Boolean { + if (bp === BreakpointConstants.BREAKPOINT_SM) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_SM; + return true; + } + if (bp === BreakpointConstants.BREAKPOINT_LG) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_LG; + return false; + } + if (direction) { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_MD_ROW; + } else { + this.pictureWidth = PictureEditConstants.PICTURE_WIDTH_MD_COLUMN; + } + return !direction; + } + + @Builder + topBar() { + Row() { + Image($r('app.media.ic_public_back')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .onClick(() => { + router.back(); + }) + .margin({ + left: $r('app.float.back_image_left'), + right: $r('app.float.back_image_right') + }) + + Text(PictureEditConstants.Edit_Text) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .fontColor(Color.White) + Blank() + if (this.currentBp === BreakpointConstants.BREAKPOINT_MD) { + Image(this.windowDirection ? $r('app.media.change2') : $r('app.media.change')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + .onClick(() => { + this.windowDirection = !this.windowDirection; + }) + } + Image($r('app.media.ic_add_2')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + Image($r('app.media.ic_add_3')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + + Image($r('app.media.ic_add_4')) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.image_right') }) + + } + .alignItems(VerticalAlign.Center) + .height($r('app.float.row_height')) + .width(BaseConstants.FULL_WIDTH) + .backgroundColor(Color.Black) + } + + @Builder + centerPicture() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.photo")) + .interpolation(ImageInterpolation.High) + .objectFit(ImageFit.Cover) + .autoResize(true) + .height(PictureEditConstants.PICTURE_HEIGHT) + .width(this.pictureWidth) + } + } + + @Builder + optionRegion() { + Flex({ + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Column : FlexDirection.Row + }) { + Flex() { + this.sliderBar() + } + .flexBasis(PictureEditConstants.SLIDER_FLEX_BASIS) + + this.filterWindows() + Flex({ justifyContent: FlexAlign.Center }) { + this.bottomBar() + } + .flexBasis(PictureEditConstants.BAR_FLEX_BASIS) + } + .height(this.isColumnLayout(this.currentBp, this.windowDirection) ? BaseConstants.FULL_HEIGHT : + PictureEditConstants.PICTURE_HALF_HEIGHT) + .padding($r('app.float.row_padding')) + } + + @Builder + sliderBar() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet, + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? Axis.Horizontal : Axis.Vertical, + reverse: this.isColumnLayout(this.currentBp, this.windowDirection) ? false : true + }) + .blockColor(Color.White) + .selectedColor(Color.White) + .trackColor($r('app.color.track_color')) + .showTips(true) + .onChange((value: number) => { + this.outSetValueOne = value; + }) + } + } + + @Builder + filterWindows() { + List() { + ForEach(PictureEditConstants.filterAndName, (item: PicAndName) => { + ListItem() { + Stack() { + Image(item.pic) + .height($r('app.float.image_height')) + .aspectRatio(1) + .autoResize(true) + .colorFilter(item.color_filter) + .clip(true) + .borderRadius(PictureEditConstants.IMAGE_BORDER_RADIUS) + Text(item.pic_name) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor($r('app.color.text_color')) + .margin({ left: $r('app.float.text_margin'), bottom: $r('app.float.text_margin') }) + } + .alignContent(Alignment.BottomStart) + } + },(item: PicAndName, index: number) => index + JSON.stringify(item)) + } + .listDirection(this.isColumnLayout(this.currentBp, this.windowDirection) ? Axis.Horizontal : Axis.Vertical) + } + + @Builder + bottomBar() { + Flex({ + justifyContent: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexAlign.SpaceAround : + FlexAlign.SpaceAround, + alignItems: ItemAlign.Center, + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Row : FlexDirection.Column, + }) { + + ForEach(PictureEditConstants.toolsAndName, (item: ToolsAndName) => { + Column() { + Image(item.pic) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .autoResize(true) + .aspectRatio(1) + .margin({ bottom: $r('app.float.image_margin') }) + Text(item.pic_name) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontColor($r('app.color.text_color')) + } + }, (item: ToolsAndName) => item.pic_name + ) + } + } + + build() { + Flex({ direction: FlexDirection.Column }) { + this.topBar() + Flex({ + direction: this.isColumnLayout(this.currentBp, this.windowDirection) ? FlexDirection.Column : FlexDirection.Row + }) { + Flex() { + this.centerPicture() + } + .flexShrink(1) + + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + this.optionRegion() + } + .flexBasis(PictureEditConstants.OPTION_FLEX_BASIS) + .height(BaseConstants.FULL_HEIGHT) + } + } + .backgroundColor(Color.Black) + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets b/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets new file mode 100755 index 0000000000000000000000000000000000000000..db2450055a8734ba21f6e554d6e7b13a48914c43 --- /dev/null +++ b/features/pictureEdit/src/main/ets/viewmodel/AdaptiveViewModel.ets @@ -0,0 +1,44 @@ +/* + * 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 { BreakpointType } from '@ohos/commons'; +import PictureEditConstants from '../constants/PictureEditConstants'; + +export class Adaptive { + static PICTURE_HEIGHT = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureEditConstants.PICTURE_HEIGHT_SM, + PictureEditConstants.PICTURE_HEIGHT_MD, + PictureEditConstants.PICTURE_HEIGHT_LG, + ).GetValue(currentBreakpoint); + } + static PICTURE_WIDTH = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureEditConstants.PICTURE_WIDTH_SM, + PictureEditConstants.PICTURE_WIDTH_MD, + PictureEditConstants.PICTURE_WIDTH_LG, + ).GetValue(currentBreakpoint); + } +} +export interface ToolsAndName { + pic: Resource + pic_name: string +} + +export interface PicAndName { + pic: Resource + pic_name: string + color_filter: number[] +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/module.json5 b/features/pictureEdit/src/main/module.json5 new file mode 100755 index 0000000000000000000000000000000000000000..0e115069cce3b9b75be1d5c16808fe151ddf5988 --- /dev/null +++ b/features/pictureEdit/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "pictureEdit", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/element/color.json b/features/pictureEdit/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..79446dd199b9ccd0a31689c5685512df09e39357 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "text_color", + "value": "#DBFFFFFF" + }, + { + "name": "track_color", + "value": "#1AFFFFFF" + } + ] +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/element/float.json b/features/pictureEdit/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..7a1363829e62b23eb71760bc82c61290be66d3bd --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/element/float.json @@ -0,0 +1,48 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "16vp" + }, + { + "name": "back_image_left", + "value": "24vp" + }, + { + "name": "image_right", + "value": "26vp" + }, + { + "name": "row_height", + "value": "56vp" + }, + { + "name": "row_padding", + "value": "16vp" + }, + { + "name": "image_height", + "value": "68vp" + }, + { + "name": "text_margin", + "value": "8vp" + }, + { + "name": "image_margin", + "value": "2vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/element/string.json b/features/pictureEdit/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..95ba6cbabb98622d7723dcd5f616d3326345eb95 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/change.svg b/features/pictureEdit/src/main/resources/base/media/change.svg new file mode 100755 index 0000000000000000000000000000000000000000..0673d7414c4957acb343b57a3913455b2ee391f1 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/change.svg @@ -0,0 +1,17 @@ + + + Public_ic_public_view_list备份 2 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/change2.svg b/features/pictureEdit/src/main/resources/base/media/change2.svg new file mode 100755 index 0000000000000000000000000000000000000000..a5b5be6b19880dbc44060a6109ce62998db52db0 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/change2.svg @@ -0,0 +1,17 @@ + + + qieHuang 2 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg b/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg new file mode 100755 index 0000000000000000000000000000000000000000..eb6ba72870978961b8eec7ce72316ec1be1ba5c2 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/ic_add_2.svg @@ -0,0 +1,20 @@ + + + ic_add 2 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg b/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg new file mode 100755 index 0000000000000000000000000000000000000000..5eb3dfb325291015ad9b1236cfb7be9c4dacb807 --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/ic_add_3.svg @@ -0,0 +1,20 @@ + + + ic_add 3 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg b/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg new file mode 100755 index 0000000000000000000000000000000000000000..0a0733cd34beee8c99ea1202bd794cedc62e1cdc --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/ic_add_4.svg @@ -0,0 +1,25 @@ + + + ic_add 4 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/ic_public_back.svg b/features/pictureEdit/src/main/resources/base/media/ic_public_back.svg new file mode 100755 index 0000000000000000000000000000000000000000..f1ca47cdac34ac787cb5a5b0b7c93e42a5e8bcaf --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_back + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/icon.png b/features/pictureEdit/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/pictureEdit/src/main/resources/base/media/icon.png differ diff --git a/features/pictureEdit/src/main/resources/base/media/photo.jpg b/features/pictureEdit/src/main/resources/base/media/photo.jpg new file mode 100755 index 0000000000000000000000000000000000000000..acab7e7af890f6589b9f29241c940f1a6ca1b483 Binary files /dev/null and b/features/pictureEdit/src/main/resources/base/media/photo.jpg differ diff --git a/features/pictureEdit/src/main/resources/base/media/setting.jpeg b/features/pictureEdit/src/main/resources/base/media/setting.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/pictureEdit/src/main/resources/base/media/setting.jpeg differ diff --git a/features/pictureEdit/src/main/resources/base/media/tools_1.svg b/features/pictureEdit/src/main/resources/base/media/tools_1.svg new file mode 100755 index 0000000000000000000000000000000000000000..10bcaa65f03d26af2bafaae065ff420e6b7a1b3b --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/tools_1.svg @@ -0,0 +1,20 @@ + + + 蒙版 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/tools_2.svg b/features/pictureEdit/src/main/resources/base/media/tools_2.svg new file mode 100755 index 0000000000000000000000000000000000000000..7408084829873ab300d7f3596353b87425634e6c --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/tools_2.svg @@ -0,0 +1,16 @@ + + + 蒙版 2 + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/tools_3.svg b/features/pictureEdit/src/main/resources/base/media/tools_3.svg new file mode 100755 index 0000000000000000000000000000000000000000..bb0a72ef79bee02aa28f9b274f9a82655eca588e --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/tools_3.svg @@ -0,0 +1,20 @@ + + + 蒙版 3 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/media/tools_4.svg b/features/pictureEdit/src/main/resources/base/media/tools_4.svg new file mode 100755 index 0000000000000000000000000000000000000000..ecc35535ab507f6de14a8aaf2ffe0b2759f0246e --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/media/tools_4.svg @@ -0,0 +1,20 @@ + + + 蒙版 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureEdit/src/main/resources/base/profile/main_pages.json b/features/pictureEdit/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..bcf9c3a506e4f0ee56909c8b1f16d9bfd35c549e --- /dev/null +++ b/features/pictureEdit/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/PictureEditIndex" + ] +} diff --git a/features/pictureView/Index.ets b/features/pictureView/Index.ets new file mode 100755 index 0000000000000000000000000000000000000000..63ca242e6db032c5935a2c13cc739398e0df7dc5 --- /dev/null +++ b/features/pictureView/Index.ets @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 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. + */ + +export { PictureViewIndex } from './src/main/ets/pages/PictureViewIndex' \ No newline at end of file diff --git a/features/pictureView/build-profile.json5 b/features/pictureView/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..78a5a3f1f587ddd84cd8f23ea0f6a818d6d25676 --- /dev/null +++ b/features/pictureView/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/pictureView/hvigorfile.ts b/features/pictureView/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..64fa6f97b15f9d477f14026c181352882b94a21b --- /dev/null +++ b/features/pictureView/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/pictureView/obfuscation-rules.txt b/features/pictureView/obfuscation-rules.txt new file mode 100755 index 0000000000000000000000000000000000000000..3ae3d22892781d9b4f8833eb1b19d819c3032d58 --- /dev/null +++ b/features/pictureView/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# 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://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# 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 \ No newline at end of file diff --git a/features/pictureView/oh-package.json5 b/features/pictureView/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..157c2444a102e5ad021214777c74266eac549bcb --- /dev/null +++ b/features/pictureView/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "pictureview", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base" + } +} diff --git a/features/pictureView/src/main/ets/constants/PictureViewConstants.ets b/features/pictureView/src/main/ets/constants/PictureViewConstants.ets new file mode 100755 index 0000000000000000000000000000000000000000..32a6822a0fb5b89b0ede3d308fdf7c63b8b7d95f --- /dev/null +++ b/features/pictureView/src/main/ets/constants/PictureViewConstants.ets @@ -0,0 +1,115 @@ +/* + * 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. + */ + +export interface ActionInterface { + icon: Resource + icon_name: string +} + +export default class PictureViewConstants { + /** + * Picture size. + */ + static PICTURE_HEIGHT_SM = '88%'; + static PICTURE_HEIGHT_MD = '100%'; + static PICTURE_HEIGHT_LG = '100%'; + static PICTURE_WIDTH_SM = '100%'; + static PICTURE_WIDTH_MD = '84.5%'; + static PICTURE_WIDTH_LG = '46.9%'; + static readonly ICON_LIST_WIDTH = "18%"; + /** + * Edit icon name. + */ + static readonly EDIT_ICON_NAME: string = '编辑'; + /** + * Actions. + */ + static ACTIONS: ActionInterface[] = [ + { + icon: $r('app.media.ic_public_share'), icon_name: "分享" + }, + { + icon: $r('app.media.ic_public_favor'), icon_name: "收藏" + }, + { + icon: $r("app.media.ic_gallery_public_details_4"), icon_name: "编辑" + }, + { + icon: $r("app.media.ic_gallery_public_details_5"), icon_name: "删除" + }, + { + icon: $r('app.media.ic_public_more'), icon_name: "更多" + } + ]; + /** + * Pictures. + */ + static readonly PICTURES: Resource[] = [ + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9'), + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9'), + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9'), + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9'), + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9'), + $r('app.media.photo1'), + $r('app.media.photo2'), + $r('app.media.photo3'), + $r('app.media.photo4'), + $r('app.media.photo5'), + $r('app.media.photo6'), + $r('app.media.photo7'), + $r('app.media.photo8'), + $r('app.media.photo9') + ]; +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/pages/PictureViewIndex.ets b/features/pictureView/src/main/ets/pages/PictureViewIndex.ets new file mode 100755 index 0000000000000000000000000000000000000000..0fbe6aa21e5b06a9166e41c4a65b1e6c19000a97 --- /dev/null +++ b/features/pictureView/src/main/ets/pages/PictureViewIndex.ets @@ -0,0 +1,49 @@ +/* + * 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 { TopBar } from '../view/TopBar'; +import { CenterPart } from '../view/CenterPart'; +import { BottomBar } from '../view/BottomBar'; +import { PreviewLists } from '../view/PreviewLists'; +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import { deviceInfo } from '@kit.BasicServicesKit'; + +@Entry +@Preview +@Component +export struct PictureViewIndex { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center + }) { + TopBar() + CenterPart() + .flexGrow(1) + PreviewLists() + if (this.currentBp !== BreakpointConstants.BREAKPOINT_LG) { + BottomBar() + } + } + .padding({ + top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : + $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? + $r('app.float.tab_content_pb') : $r('app.float.zero') + }) + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/view/BottomBar.ets b/features/pictureView/src/main/ets/view/BottomBar.ets new file mode 100755 index 0000000000000000000000000000000000000000..f4916bdd21728c99460272ce51f5b49fbe7c64ee --- /dev/null +++ b/features/pictureView/src/main/ets/view/BottomBar.ets @@ -0,0 +1,52 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import PictureViewConstants, { ActionInterface } from '../constants/PictureViewConstants'; +import { BaseConstants } from '@ohos/commons'; + +@Preview +@Component +export struct BottomBar { + + build() { + Flex({ + justifyContent: FlexAlign.Center, + direction: FlexDirection.Row + }) { + ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { + Column() { + Image(item.icon) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + Text(item.icon_name) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_TEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + .padding({ top: $r('app.float.icon_padding_top') }) + } + .onClick(() => { + if (item.icon_name === PictureViewConstants.EDIT_ICON_NAME) { + router.pushUrl({ + url: '@bundle:com.example.multipicturebeautification/pictureEdit/ets/pages/PictureEditIndex' + }); + } + }) + .width(PictureViewConstants.ICON_LIST_WIDTH) + },(item: ActionInterface, index: number) => index + JSON.stringify(item)) + } + .height($r('app.float.icon_list_height')) + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/view/CenterPart.ets b/features/pictureView/src/main/ets/view/CenterPart.ets new file mode 100755 index 0000000000000000000000000000000000000000..1f430914e44bc6d7bb0261679e1f7430bf70baf8 --- /dev/null +++ b/features/pictureView/src/main/ets/view/CenterPart.ets @@ -0,0 +1,57 @@ +/* + * 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 { BreakpointConstants } from '@ohos/commons'; +import { Adaptive } from '../viewmodel/AdaptiveViewModel' + +const FINGER_NUM: number = 2 + +@Component +export struct CenterPart { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + @State scaleValue: number = 1; + @State pinchValue: number = 1; + + build() { + Flex({ direction: FlexDirection.Column }) { + Blank() + Row() { + Column() { + Image($r('app.media.photo')) + .autoResize(true) + } + } + .height(Adaptive.PICTURE_HEIGHT(this.currentBp)) + .width(Adaptive.PICTURE_WIDTH(this.currentBp)) + .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 }) + .gesture(PinchGesture({ fingers: FINGER_NUM }) + .onActionUpdate((event: GestureEvent | undefined) => { + if (event) { + this.scaleValue = this.pinchValue * event.scale; + } + }) + .onActionEnd(() => { + this.pinchValue = this.scaleValue; + })) + + Blank() + .height(this.currentBp === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.center_blank_height_lg') : 0) + } + .margin({ + top: $r('app.float.center_margin_top'), + bottom: $r('app.float.center_margin_bottom') + }) + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/view/PreviewLists.ets b/features/pictureView/src/main/ets/view/PreviewLists.ets new file mode 100755 index 0000000000000000000000000000000000000000..d0c6e09c14be4df459d1c1128eab1771071ab846 --- /dev/null +++ b/features/pictureView/src/main/ets/view/PreviewLists.ets @@ -0,0 +1,46 @@ +/* + * 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 { BreakpointConstants } from '@ohos/commons'; +import PictureViewConstants from '../constants/PictureViewConstants'; + +const IMAGE_ASPECT_RATIO: number = 0.5; + +@Component +export struct PreviewLists { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + + build() { + List({ initialIndex: 1 }) { + ForEach(PictureViewConstants.PICTURES, (item: Resource) => { + ListItem() { + Image(item) + .height($r('app.float.list_image_height')) + .aspectRatio(IMAGE_ASPECT_RATIO) + .autoResize(true) + .margin({ left: $r('app.float.list_image_margin_left') }) + } + }, (item: Resource, index: number) => index + JSON.stringify(item)) + } + .height($r('app.float.list_image_height')) + .padding({ + top: $r('app.float.list_margin_top'), + bottom: $r('app.float.list_margin_bottom') + }) + .listDirection(Axis.Horizontal) + .scrollSnapAlign(ScrollSnapAlign.CENTER) + .scrollBar(BarState.Off) + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/view/TopBar.ets b/features/pictureView/src/main/ets/view/TopBar.ets new file mode 100755 index 0000000000000000000000000000000000000000..510bbb22cc17bf5d3edb79d387b9580397ac1746 --- /dev/null +++ b/features/pictureView/src/main/ets/view/TopBar.ets @@ -0,0 +1,99 @@ +/* + * 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 { router } from '@kit.ArkUI'; +import { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import PictureViewConstants, { ActionInterface } from '../constants/PictureViewConstants'; + +const TITLE: string = '2020年12月24日'; +const SUBTITLE: string = '下午04:00 呼和浩特市'; + +@Preview +@Component +export struct TopBar { + @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; + + build() { + Flex({ + direction: FlexDirection.Row, + alignItems: ItemAlign.Center, + }) { + Column() { + Flex({ + justifyContent: FlexAlign.SpaceBetween, + direction: FlexDirection.Row, + alignItems: ItemAlign.Stretch + }) { + Row() { + Image($r('app.media.ic_public_back')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ right: $r('app.float.back_image_right') }) + Column() { + Text(TITLE) + .fontFamily(BaseConstants.FONT_FAMILY_MEDIUM) + .fontSize(BaseConstants.FONT_SIZE_TWENTY) + .fontWeight(BaseConstants.FONT_WEIGHT_FIVE) + Text(SUBTITLE) + .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) + .fontSize(BaseConstants.FONT_SIZE_FOURTEEN) + .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) + } + .alignItems(HorizontalAlign.Start) + .padding($r('app.float.back_area_padding')) + } + + Row() { + Image($r('app.media.ic_public_picture')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .autoResize(true) + .onClick(() => { + router.pushUrl({ + url: '@bundle:com.example.multipicturebeautification/albumView/ets/pages/AlbumViewIndex', + }); + }) + Image($r('app.media.ic_public_detail')) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ left: $r('app.float.detail_image_left') }) + if (this.currentBp === BreakpointConstants.BREAKPOINT_LG) { + ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { + Image(item.icon) + .height(BaseConstants.DEFAULT_ICON_SIZE) + .width(BaseConstants.DEFAULT_ICON_SIZE) + .margin({ left: $r('app.float.detail_image_left') }) + .onClick(() => { + if (item.icon_name === PictureViewConstants.EDIT_ICON_NAME) { + router.pushUrl({ + url: '@bundle:com.example.multipicturebeautification/pictureEdit/ets/pages/PictureEditIndex', + }); + } + }) + }, (item: ActionInterface, index: number) => index + JSON.stringify(item)) + } + } + } + } + } + .height($r('app.float.top_bar_height')) + .margin({ + top: $r('app.float.top_bar_top'), + bottom: $r('app.float.top_bar_bottom'), + left: $r('app.float.top_bar_left'), + right: $r('app.float.top_bar_right') + }) + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets b/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets new file mode 100755 index 0000000000000000000000000000000000000000..9c81c4a71033926456c85696ee34e25441b93468 --- /dev/null +++ b/features/pictureView/src/main/ets/viewmodel/AdaptiveViewModel.ets @@ -0,0 +1,90 @@ +/* + * 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 { BaseConstants as Constants, BreakpointType } from '@ohos/commons'; +import PictureViewConstants from '../constants/PictureViewConstants'; + +export class Adaptive { + static PICTURE_HEIGHT = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureViewConstants.PICTURE_HEIGHT_SM, + PictureViewConstants.PICTURE_HEIGHT_MD, + PictureViewConstants.PICTURE_HEIGHT_LG, + ).GetValue(currentBreakpoint); + }; + static PICTURE_WIDTH = (currentBreakpoint: string): string => { + return new BreakpointType( + PictureViewConstants.PICTURE_WIDTH_SM, + PictureViewConstants.PICTURE_WIDTH_MD, + PictureViewConstants.PICTURE_WIDTH_LG, + ).GetValue(currentBreakpoint); + }; + static CircleImageOneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.IMAGE_ONE_WIDTH_SM, + Constants.IMAGE_ONE_WIDTH_MD, + Constants.IMAGE_ONE_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static HomeTabHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_HEIGHT_SM, + Constants.HOME_TAB_HEIGHT_MD, + Constants.HOME_TAB_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static HomeTabWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.HOME_TAB_WIDTH_SM, + Constants.HOME_TAB_WIDTH_MD, + Constants.HOME_TAB_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static ContactPhoneWidth = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_PHONE_WIDTH_SM, + Constants.CONTACTS_PHONE_WIDTH_MD, + Constants.CONTACTS_PHONE_WIDTH_LG + ).GetValue(currentBreakpoint); + }; + static ContactDetailHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_DETAIL_HEIGHT_SM, + Constants.CONTACTS_DETAIL_HEIGHT_MD, + Constants.CONTACTS_DETAIL_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static ContactItemHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.CONTACTS_ITEM_HEIGHT_SM, + Constants.CONTACTS_ITEM_HEIGHT_MD, + Constants.CONTACTS_ITEM_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static DocumentTitleColumnHeight = (currentBreakpoint: string): string => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_HEIGHT_SM, + Constants.DOCUMENT_TITLE_HEIGHT_MD, + Constants.DOCUMENT_TITLE_HEIGHT_LG + ).GetValue(currentBreakpoint); + }; + static DocumentTitleColumnSpace = (currentBreakpoint: string): number => { + return new BreakpointType( + Constants.DOCUMENT_TITLE_SPACE_SM, + Constants.DOCUMENT_TITLE_SPACE_MD, + Constants.DOCUMENT_TITLE_SPACE_LG + ).GetValue(currentBreakpoint); + }; +} \ No newline at end of file diff --git a/features/pictureView/src/main/module.json5 b/features/pictureView/src/main/module.json5 new file mode 100755 index 0000000000000000000000000000000000000000..d4645c535cc461902f08f0448ce8de9200063339 --- /dev/null +++ b/features/pictureView/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "pictureView", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "pages": "$profile:main_pages" + } +} \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/element/color.json b/features/pictureView/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..62a137a61b90c14f109ed8c81d9d551ea0a5888a --- /dev/null +++ b/features/pictureView/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/element/float.json b/features/pictureView/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..e7816700c77ef3e1ac43c28c78d477939a6cbcfa --- /dev/null +++ b/features/pictureView/src/main/resources/base/element/float.json @@ -0,0 +1,84 @@ +{ + "float": [ + { + "name": "back_image_right", + "value": "10vp" + }, + { + "name": "back_area_padding", + "value": "5vp" + }, + { + "name": "detail_image_left", + "value": "24vp" + }, + { + "name": "top_bar_height", + "value": "52vp" + }, + { + "name": "top_bar_left", + "value": "24vp" + }, + { + "name": "top_bar_bottom", + "value": "3vp" + }, + { + "name": "top_bar_top", + "value": "3vp" + }, + { + "name": "top_bar_right", + "value": "24vp" + }, + { + "name": "center_blank_height_lg", + "value": "24vp" + }, + { + "name": "center_margin_top", + "value": "4vp" + }, + { + "name": "center_margin_bottom", + "value": "1vp" + }, + { + "name": "list_image_height", + "value": "47vp" + }, + { + "name": "list_image_margin_left", + "value": "1vp" + }, + { + "name": "list_margin_top", + "value": "1vp" + }, + { + "name": "list_margin_bottom", + "value": "10vp" + }, + { + "name": "icon_padding_top", + "value": "4.5vp" + }, + { + "name": "icon_list_height", + "value": "56vp" + }, + { + "name": "zero", + "value": "0vp" + }, + { + "name": "tab_content_pb", + "value": "28vp" + }, + { + "name": "device_padding_top", + "value": "36vp" + } + ] +} \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/element/string.json b/features/pictureView/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..95ba6cbabb98622d7723dcd5f616d3326345eb95 --- /dev/null +++ b/features/pictureView/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg b/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg new file mode 100755 index 0000000000000000000000000000000000000000..c9bb24c643526789201fbaf70d8637423b0f4e5c --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_4.svg @@ -0,0 +1,25 @@ + + + ic_gallery_public_details 4 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg b/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg new file mode 100755 index 0000000000000000000000000000000000000000..c2c4d05e1e5af14a661340ec8aeef4bd0e96e42c --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_gallery_public_details_5.svg @@ -0,0 +1,25 @@ + + + ic_gallery_public_details 5 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_back.svg b/features/pictureView/src/main/resources/base/media/ic_public_back.svg new file mode 100755 index 0000000000000000000000000000000000000000..466903b263bebc25ae9b2e40098b30b6c12f1653 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_detail.svg b/features/pictureView/src/main/resources/base/media/ic_public_detail.svg new file mode 100755 index 0000000000000000000000000000000000000000..277c3444fad1a2b27216a2773a2df3b55f3d3137 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_detail.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_detail + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_favor.svg b/features/pictureView/src/main/resources/base/media/ic_public_favor.svg new file mode 100755 index 0000000000000000000000000000000000000000..001c0f9dc14f8934d2593b82dc8db0d3488045a5 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_favor.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_favor + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_more.svg b/features/pictureView/src/main/resources/base/media/ic_public_more.svg new file mode 100755 index 0000000000000000000000000000000000000000..2c4f6192ffddb951114eddab041bb77ffd106094 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_more + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_picture.svg b/features/pictureView/src/main/resources/base/media/ic_public_picture.svg new file mode 100755 index 0000000000000000000000000000000000000000..86feb901220215388397f58d5428f927c6976421 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_picture.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_picture + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_reset.svg b/features/pictureView/src/main/resources/base/media/ic_public_reset.svg new file mode 100755 index 0000000000000000000000000000000000000000..2adcc071f0de29a682a89e73b3947a0ae57ee3e2 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_reset.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reset + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_save.svg b/features/pictureView/src/main/resources/base/media/ic_public_save.svg new file mode 100755 index 0000000000000000000000000000000000000000..bcd68c733d482b0ae55439dba3292e13f20264bd --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_save.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_save + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/ic_public_share.svg b/features/pictureView/src/main/resources/base/media/ic_public_share.svg new file mode 100755 index 0000000000000000000000000000000000000000..3681ddda632ae1218b39698a65082fb56900b594 --- /dev/null +++ b/features/pictureView/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/pictureView/src/main/resources/base/media/icon.png b/features/pictureView/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/icon.png differ diff --git a/features/pictureView/src/main/resources/base/media/photo.jpg b/features/pictureView/src/main/resources/base/media/photo.jpg new file mode 100755 index 0000000000000000000000000000000000000000..acab7e7af890f6589b9f29241c940f1a6ca1b483 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo1.jpg b/features/pictureView/src/main/resources/base/media/photo1.jpg new file mode 100755 index 0000000000000000000000000000000000000000..cb4e7161886e7db0944ceddf0bcbd130371cb7c6 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo1.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo10.jpg b/features/pictureView/src/main/resources/base/media/photo10.jpg new file mode 100755 index 0000000000000000000000000000000000000000..5ed4902c874809a32adedc8f49de2381e16251a9 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo10.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo2.jpg b/features/pictureView/src/main/resources/base/media/photo2.jpg new file mode 100755 index 0000000000000000000000000000000000000000..7a3a7e45696d6f32f0818f0ce6e9252f77f463ee Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo2.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo3.jpg b/features/pictureView/src/main/resources/base/media/photo3.jpg new file mode 100755 index 0000000000000000000000000000000000000000..926a77f6e6d96090d759f521ed352d6210c645d4 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo3.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo4.jpg b/features/pictureView/src/main/resources/base/media/photo4.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fb763b87279c3fd1bcf7a2335c70f9b0846412cb Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo4.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo5.jpg b/features/pictureView/src/main/resources/base/media/photo5.jpg new file mode 100755 index 0000000000000000000000000000000000000000..a830f0ce6fa0a0791a3621ba1266c2b63e8b8723 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo5.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo6.jpg b/features/pictureView/src/main/resources/base/media/photo6.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo6.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo7.jpg b/features/pictureView/src/main/resources/base/media/photo7.jpg new file mode 100755 index 0000000000000000000000000000000000000000..fe642935525294294c90a56308706cbf6b2aa2d3 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo7.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo8.jpg b/features/pictureView/src/main/resources/base/media/photo8.jpg new file mode 100755 index 0000000000000000000000000000000000000000..92562e9297c7bb2c702145630847f1d6c8474ad3 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo8.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/photo9.jpg b/features/pictureView/src/main/resources/base/media/photo9.jpg new file mode 100755 index 0000000000000000000000000000000000000000..90d2f285aefd4e72a9fc48b1ad3e2be968454905 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/photo9.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/picture1.jpg b/features/pictureView/src/main/resources/base/media/picture1.jpg new file mode 100755 index 0000000000000000000000000000000000000000..4653f525ea10dffbbe81f8bf8ae715148f956956 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/picture1.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/picture1_2.jpg b/features/pictureView/src/main/resources/base/media/picture1_2.jpg new file mode 100755 index 0000000000000000000000000000000000000000..769b4d8b2b587c915798f908abb9c8fa7eb27e3b Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/picture1_2.jpg differ diff --git a/features/pictureView/src/main/resources/base/media/setting.jpeg b/features/pictureView/src/main/resources/base/media/setting.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/setting.jpeg differ diff --git a/features/pictureView/src/main/resources/base/media/startIcon.png b/features/pictureView/src/main/resources/base/media/startIcon.png new file mode 100755 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/startIcon.png differ diff --git a/features/pictureView/src/main/resources/base/media/xiangCe.jpg b/features/pictureView/src/main/resources/base/media/xiangCe.jpg new file mode 100755 index 0000000000000000000000000000000000000000..df045cb2050a9e814543e58d933e2bcd59b2a0fa Binary files /dev/null and b/features/pictureView/src/main/resources/base/media/xiangCe.jpg differ diff --git a/features/pictureView/src/main/resources/base/profile/main_pages.json b/features/pictureView/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..ad688a678b7c216d5787b1b1e77bacab2cd9b465 --- /dev/null +++ b/features/pictureView/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/PictureViewIndex" + ] +} diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100755 index 0000000000000000000000000000000000000000..39dea44a4d24b4158dc0a16b17235e53c0a4e354 --- /dev/null +++ b/hvigor/hvigor-config.json5 @@ -0,0 +1,21 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */ + } +} diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..159890e9ee8c4dc8cfff2a03e6207edb86abb0b5 --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..72c698ca8385bf9d1b670b29b23da2b9825e832a --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.15", + + }, + "author": "", + "name": "multipicturebeautification", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/product/phone/build-profile.json5 b/product/phone/build-profile.json5 new file mode 100755 index 0000000000000000000000000000000000000000..f8ddb39800721c6f2a7561cf79aa783ded873777 --- /dev/null +++ b/product/phone/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/product/phone/hvigorfile.ts b/product/phone/hvigorfile.ts new file mode 100755 index 0000000000000000000000000000000000000000..ba9480d0a9291ab74ff5856e77634a1c05d027a9 --- /dev/null +++ b/product/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/product/phone/obfuscation-rules.txt b/product/phone/obfuscation-rules.txt new file mode 100755 index 0000000000000000000000000000000000000000..3ae3d22892781d9b4f8833eb1b19d819c3032d58 --- /dev/null +++ b/product/phone/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# 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://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# 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 \ No newline at end of file diff --git a/product/phone/oh-package.json5 b/product/phone/oh-package.json5 new file mode 100755 index 0000000000000000000000000000000000000000..cba764bccfdaa7075ab3e85c220c0170264b6abd --- /dev/null +++ b/product/phone/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": { + "@ohos/commons": "file:../../commons/base", + "@ohos/edit": "file:../../features/pictureEdit", + "@ohos/view": "file:../../features/pictureView" + } +} diff --git a/product/phone/src/main/ets/pages/Index.ets b/product/phone/src/main/ets/pages/Index.ets new file mode 100755 index 0000000000000000000000000000000000000000..e920e6b517779b87c26f83e0d5d59da8fddb3823 --- /dev/null +++ b/product/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,51 @@ +/* + * 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 { BaseConstants, BreakpointConstants } from '@ohos/commons'; +import { PictureViewIndex } from '@ohos/view'; + +@Entry +@Component +struct Index { + @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + + build() { + GridRow({ + columns: { + sm: BreakpointConstants.GRID_ROW_COLUMNS[2], + md: BreakpointConstants.GRID_ROW_COLUMNS[0], + lg: BreakpointConstants.GRID_ROW_COLUMNS[0] + } + }) { + GridCol({ span: { + sm: BreakpointConstants.GRID_COLUMN_SPANS[5], + md: BreakpointConstants.GRID_COLUMN_SPANS[0], + lg: BreakpointConstants.GRID_COLUMN_SPANS[0] + } }) { + Column() { + PictureViewIndex() + } + .width(BaseConstants.FULL_HEIGHT) + .height(BaseConstants.FULL_HEIGHT) + + } + .height(BaseConstants.FULL_PERCENT) + .width(BaseConstants.FULL_PERCENT) + } + .onBreakpointChange((breakPoints) => { + this.currentBreakpoint = breakPoints; + }) + } +} \ No newline at end of file diff --git a/product/phone/src/main/ets/phoneability/PhoneAbility.ets b/product/phone/src/main/ets/phoneability/PhoneAbility.ets new file mode 100755 index 0000000000000000000000000000000000000000..3224bdcf519358c26e1395121d1d59aaf774a849 --- /dev/null +++ b/product/phone/src/main/ets/phoneability/PhoneAbility.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023 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 { UIAbility, AbilityConstant, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; +import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; +import { BaseConstants } from '@ohos/commons/Index'; + +export default class PhoneAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.getMainWindow((err: BusinessError, data) => { + if (err.code) { + hilog.info(0x0000, 'testTag', '%{public}s', 'getMainWindow failed'); + return; + } + if (deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1) { + data.setWindowLayoutFullScreen(true); + } + }) + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/product/phone/src/main/module.json5 b/product/phone/src/main/module.json5 new file mode 100755 index 0000000000000000000000000000000000000000..2410b1a751635ab68f15f0a4940be9fa1effb34f --- /dev/null +++ b/product/phone/src/main/module.json5 @@ -0,0 +1,40 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "PhoneAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "PhoneAbility", + "srcEntry": "./ets/phoneability/PhoneAbility.ets", + "description": "$string:PhoneAbility_desc", + "icon": "$media:icon", + "label": "$string:PhoneAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 330, + "minWindowHeight": 600, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/product/phone/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/string.json b/product/phone/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..f60d1b9237c768567603c9147dddc10463e5154d --- /dev/null +++ b/product/phone/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/icon.png b/product/phone/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/product/phone/src/main/resources/base/media/icon.png differ diff --git a/product/phone/src/main/resources/base/media/startIcon.png b/product/phone/src/main/resources/base/media/startIcon.png new file mode 100755 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/product/phone/src/main/resources/base/media/startIcon.png differ diff --git a/product/phone/src/main/resources/base/profile/main_pages.json b/product/phone/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..14bbd62cb9de385b1f5551945d749bb5e0e5fc2c --- /dev/null +++ b/product/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/product/phone/src/main/resources/en_US/element/string.json b/product/phone/src/main/resources/en_US/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..f60d1b9237c768567603c9147dddc10463e5154d --- /dev/null +++ b/product/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/zh_CN/element/string.json b/product/phone/src/main/resources/zh_CN/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..933867c6c3d5843c8a0401f7d531130c01d5e75f --- /dev/null +++ b/product/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "PhoneAbility_desc", + "value": "description" + }, + { + "name": "PhoneAbility_label", + "value": "一多图片美化" + } + ] +} \ No newline at end of file diff --git a/screenshots/device/config.png b/screenshots/device/config.png new file mode 100755 index 0000000000000000000000000000000000000000..cce0dfb773dcdd98a5faf8c230c5644555335f93 Binary files /dev/null and b/screenshots/device/config.png differ diff --git a/screenshots/device/foldable.png b/screenshots/device/foldable.png new file mode 100755 index 0000000000000000000000000000000000000000..968f143108c36f35029497071aba28b2bb520c7b Binary files /dev/null and b/screenshots/device/foldable.png differ diff --git a/screenshots/device/pad.png b/screenshots/device/pad.png new file mode 100755 index 0000000000000000000000000000000000000000..3fcde65797e292806476a6fb0f5f3d11fe2a423e Binary files /dev/null and b/screenshots/device/pad.png differ diff --git a/screenshots/device/phone.png b/screenshots/device/phone.png new file mode 100755 index 0000000000000000000000000000000000000000..ab494f294197933264af9e17f86ecd7af0b02715 Binary files /dev/null and b/screenshots/device/phone.png differ diff --git a/screenshots/device/run.png b/screenshots/device/run.png new file mode 100755 index 0000000000000000000000000000000000000000..7655fa7e041bb067e028029d820bd2d320e2cd83 Binary files /dev/null and b/screenshots/device/run.png differ