From cd90aae989d5c022011197949b36f17ef8debd0b Mon Sep 17 00:00:00 2001 From: caoliwen1 <14658249+caoliwen1@user.noreply.gitee.com> Date: Fri, 20 Sep 2024 16:17:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AA=92=E4=BD=93=E5=BA=9F=E5=BC=83?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/HomePage.ets | 51 +++++++++++++-------------- entry/src/main/module.json5 | 20 ----------- 2 files changed, 24 insertions(+), 47 deletions(-) diff --git a/entry/src/main/ets/pages/HomePage.ets b/entry/src/main/ets/pages/HomePage.ets index e6b34f7..39ae080 100644 --- a/entry/src/main/ets/pages/HomePage.ets +++ b/entry/src/main/ets/pages/HomePage.ets @@ -46,6 +46,11 @@ struct HomePage { @Provide('isPixelMapChange') @Watch('flushPixelMap') isPixelMapChange: boolean = false; menuIconChangeList = menuIconList; cropIconChange: Array = cropIconChangeList; + @State saveButtonOptions: SaveButtonOptions = { + icon: SaveIconStyle.FULL_FILLED, + text: SaveDescription.SAVE_IMAGE, + buttonType: ButtonType.Capsule + } @Builder NavigationTitle() { @@ -185,36 +190,28 @@ struct HomePage { this.pixelInit(); }) - Button() { - Image($r('app.media.ic_save')) - .width($r('app.float.title_image_width')) - .height($r('app.float.title_image_height')) - } - .height(CommonConstants.LAYOUT_FULL_SCREEN) - .type(ButtonType.Normal) - .aspectRatio(1) - .backgroundColor(Color.Transparent) - .onClick(() => { - AlertDialog.show({ - title: $r('app.string.save_image'), - message: $r('app.string.confirm_save'), - alignment: DialogAlignment.Center, - primaryButton: { - value: $r('app.string.save'), - action: () => { - if (this.pixelMap) { - encode(this, this.pixelMap); + SaveButton(this.saveButtonOptions) + .onClick(() => { + AlertDialog.show({ + title: $r('app.string.save_image'), + message: $r('app.string.confirm_save'), + alignment: DialogAlignment.Center, + primaryButton: { + value: $r('app.string.save'), + action: () => { + if (this.pixelMap) { + encode(this, this.pixelMap); + } + } + }, + secondaryButton: { + value: $r('app.string.cancel'), + action: () => { + Logger.info(TAG, `cancel`); } } - }, - secondaryButton: { - value: $r('app.string.cancel'), - action: () => { - Logger.info(TAG, `cancel`); - } - } + }) }) - }) } } diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index f399e04..0cf2dfe 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -50,26 +50,6 @@ "when": "inuse" } }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "inuse" - } - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "inuse" - } - }, { "name": "ohos.permission.WRITE_IMAGEVIDEO", "reason": "$string:reason", -- Gitee From e3554b0ea1e1ec8b6c063b40b042788fb9f0276e Mon Sep 17 00:00:00 2001 From: caoliwen1 <14658249+caoliwen1@user.noreply.gitee.com> Date: Fri, 20 Sep 2024 16:23:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E9=99=A4readme=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f30e51e..39efae1 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ ### 相关权限 - ohos.permission.MEDIA_LOCATION -- ohos.permission.READ_MEDIA -- ohos.permission.WRITE_MEDIA ### 使用说明 -- Gitee From 5b6f52f8e100ee18a2da0633b30dd1dbb51b3e8e Mon Sep 17 00:00:00 2001 From: caoliwen1 <14658249+caoliwen1@user.noreply.gitee.com> Date: Tue, 24 Sep 2024 11:28:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/resources/base/element/string.json | 2 +- entry/src/main/resources/en_US/element/string.json | 2 +- entry/src/main/resources/zh_CN/element/string.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 29f42bd..07d65cc 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -14,7 +14,7 @@ }, { "name": "reason", - "value": "save image" + "value": "For saving pictures" }, { "name": "image_edit", diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 29f42bd..07d65cc 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -14,7 +14,7 @@ }, { "name": "reason", - "value": "save image" + "value": "For saving pictures" }, { "name": "image_edit", diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index ad0fb6e..0a0ae63 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -14,7 +14,7 @@ }, { "name": "reason", - "value": "保存图片" + "value": "用于保存图片" }, { "name": "image_edit", -- Gitee