From 7335f6ca0e75743c5189ed801c548108ea68af72 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 22 Sep 2024 17:44:08 +0800 Subject: [PATCH] optimized --- entry/src/main/ets/pages/Index.ets | 14 ++--- .../main/resources/base/element/float.json | 4 +- .../main/resources/base/element/string.json | 14 ++--- .../main/resources/en_US/element/string.json | 60 +++++++++++++++++++ .../main/resources/zh_CN/element/string.json | 60 +++++++++++++++++++ 5 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 entry/src/main/resources/en_US/element/string.json create mode 100644 entry/src/main/resources/zh_CN/element/string.json diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 0f982cd..fbd980d 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -158,10 +158,10 @@ struct Index { build() { Column({ space: CommonConstants.SPACE_TEN }) { Row({ space: CommonConstants.SPACE_TEN }) { - Text($r('app.string.max_compression_image_size')).fontSize($r('app.float.font_size_20')) + Text($r('app.string.max_compression_image_size')).fontSize($r('app.float.font_size_16')) TextInput() .type(InputType.Number) - .fontSize($r('app.float.font_size_20')) + .fontSize($r('app.float.font_size_16')) .width($r('app.string.text_input_width')) .onChange((value: string) => { this.maxCompressedImageSize = Number(value); @@ -192,13 +192,13 @@ struct Index { } this.compressedImageSrc = ''; this.imageCompression(); - }).fontSize($r('app.float.font_size_20')).width($r('app.string.button_width')) + }).fontSize($r('app.float.font_size_16')).width($r('app.string.button_width')) Row() { Text($r('app.string.image_size_before_compression')) - .fontSize($r('app.float.font_size_20')) + .fontSize($r('app.float.font_size_16')) Text(this.beforeCompressionSize) - .fontSize($r('app.float.font_size_20')) + .fontSize($r('app.float.font_size_16')) } Image($rawfile('beforeCompression.jpeg')) @@ -207,9 +207,9 @@ struct Index { Row() { Text($r('app.string.image_size_after_compression')) - .fontSize($r('app.float.font_size_20')) + .fontSize($r('app.float.font_size_16')) Text(this.afterCompressionSize) - .fontSize($r('app.float.font_size_20')) + .fontSize($r('app.float.font_size_16')) } Image(this.compressedImageSrc) diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json index 0870e2d..5e968ae 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -1,8 +1,8 @@ { "float": [ { - "name": "font_size_20", - "value": "20fp" + "name": "font_size_16", + "value": "16vp" }, { "name": "column_padding", diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index f0dc8c9..d4a1e6e 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -18,31 +18,31 @@ }, { "name": "image_compression", - "value": "图片压缩" + "value": "Image Compression" }, { "name": "max_compression_image_size", - "value": "输入图片压缩目标大小(kb):" + "value": "Input image compression target size(kb):" }, { "name": "image_size_before_compression", - "value": "压缩前图片大小(kb): " + "value": "Image size before compression(kb): " }, { "name": "image_size_after_compression", - "value": "压缩后图片大小(kb): " + "value": "Compressed image size(kb): " }, { "name": "prompt_enter_value_greater_than_0", - "value": "请输入大于0的值" + "value": "Enter a value greater than 0." }, { "name": "prompt_not_require_compression", - "value": "符合压缩要求,无需压缩" + "value": "Compiles with compression requirement and doesn't require compression." }, { "name": "image_get_failed", - "value": "图片获取失败" + "value": "Failed to obtain the image." }, { "name": "module_desc", diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..1b1fd0d --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,60 @@ +{ + "string": [ + { + "name": "text_input_width", + "value": "20%" + }, + { + "name": "button_width", + "value": "60%" + }, + { + "name": "image_width", + "value": "100%" + }, + { + "name": "image_height", + "value": "30%" + }, + { + "name": "image_compression", + "value": "Image Compression" + }, + { + "name": "max_compression_image_size", + "value": "Input compression target size(kb):" + }, + { + "name": "image_size_before_compression", + "value": "Image size before compression(kb): " + }, + { + "name": "image_size_after_compression", + "value": "Compressed image size(kb): " + }, + { + "name": "prompt_enter_value_greater_than_0", + "value": "Enter a value greater than 0." + }, + { + "name": "prompt_not_require_compression", + "value": "Compiles with compression requirement and doesn't require compression." + }, + { + "name": "image_get_failed", + "value": "Failed to obtain the image." + }, + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ImageCompression" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..a92563e --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,60 @@ +{ + "string": [ + { + "name": "text_input_width", + "value": "20%" + }, + { + "name": "button_width", + "value": "50%" + }, + { + "name": "image_width", + "value": "100%" + }, + { + "name": "image_height", + "value": "30%" + }, + { + "name": "image_compression", + "value": "图片压缩" + }, + { + "name": "max_compression_image_size", + "value": "输入图片压缩目标大小(kb):" + }, + { + "name": "image_size_before_compression", + "value": "压缩前图片大小(kb): " + }, + { + "name": "image_size_after_compression", + "value": "压缩后图片大小(kb): " + }, + { + "name": "prompt_enter_value_greater_than_0", + "value": "请输入大于0的值" + }, + { + "name": "prompt_not_require_compression", + "value": "符合压缩要求,无需压缩" + }, + { + "name": "image_get_failed", + "value": "图片获取失败" + }, + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ImageCompression" + } + ] +} \ No newline at end of file -- Gitee