diff --git a/README.md b/README.md index f30e51eb6a9087b270291df02402c272474c383c..39efae1e7fa27c9b07435e0035eb1e7bc2ec2392 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ ### 相关权限 - ohos.permission.MEDIA_LOCATION -- ohos.permission.READ_MEDIA -- ohos.permission.WRITE_MEDIA ### 使用说明 diff --git a/entry/src/main/ets/pages/HomePage.ets b/entry/src/main/ets/pages/HomePage.ets index e6b34f760bc5c19c07c443a836ca1ab3745d8c54..39ae08069842f13c3419077aaeeabb50550b6d60 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 f399e0493ceeada3c1a14ad1da540cb9832cc5f8..0cf2dfecc0cee41449dea74fedb655e005c29c08 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", diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 29f42bdc6445a8655a122784d69b96960f4b5967..07d65cc741cedc205ba4bb06447fc002cc294bb7 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 29f42bdc6445a8655a122784d69b96960f4b5967..07d65cc741cedc205ba4bb06447fc002cc294bb7 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 ad0fb6e6b98a07fbd5dfcdc517888a0f10644f8b..0a0ae6374f83618453b37567347ff4228a9274af 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",