From 29756d3ea0d9360c01d7bd71e710a59f96e46b3a Mon Sep 17 00:00:00 2001 From: li-li-wang Date: Sat, 1 Mar 2025 15:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AD=97=E4=BD=93=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=B8=8D=E5=B1=85=E4=B8=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-li-wang --- .../SecurityExtAbility/SecurityExtAbility.ts | 7 ++- .../src/main/ets/pages/securityDialog.ets | 55 ++++++++++--------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts index e35b4fd..d47b4d0 100644 --- a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts +++ b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts @@ -18,6 +18,7 @@ import window from '@ohos.window'; import display from '@ohos.display'; import { GlobalContext } from '../common/utils/globalContext'; import { Configuration } from '@ohos.app.ability.Configuration'; +import deviceInfo from '@ohos.deviceInfo'; const TAG = 'PermissionManager_Log:'; const BG_COLOR = '#00000000'; @@ -95,8 +96,10 @@ export default class SecurityExtensionAbility extends extension { this.context.terminateSelf(); } }); - await win.moveWindowTo(rect.left, rect.top); - await win.resize(rect.width, rect.height); + if (deviceInfo.deviceType !== 'wearable') { + await win.moveWindowTo(rect.left, rect.top); + await win.resize(rect.width, rect.height); + }; await win.loadContent('pages/securityDialog', storage); win.setWindowBackgroundColor(BG_COLOR); await win.showWindow(); diff --git a/permissionmanager/src/main/ets/pages/securityDialog.ets b/permissionmanager/src/main/ets/pages/securityDialog.ets index 547feb4..0255cec 100644 --- a/permissionmanager/src/main/ets/pages/securityDialog.ets +++ b/permissionmanager/src/main/ets/pages/securityDialog.ets @@ -86,9 +86,20 @@ function dialogTitle(index: number, securityParams: Array, isWearable: bo function dialogContentsArea(params: DialogInfo) { Column() { Column() { - SymbolGlyph($r('sys.symbol.person_shield_fill')) - .fontSize(Constants.FONT_SIZE_28) - .fontColor([$r('sys.color.brand')]) + Row() { + SymbolGlyph($r('sys.symbol.person_shield_fill')) + .fontSize(Constants.FONT_SIZE_28) + .fontColor([$r('sys.color.brand')]) + } + .width(Constants.SECURITY_ICON_WIDTH) + .height(Constants.SECURITY_ICON_HEIGHT) + .justifyContent(FlexAlign.Center) + .pixelRound({ start: PixelRoundCalcPolicy.NO_FORCE_ROUND, end: PixelRoundCalcPolicy.NO_FORCE_ROUND }) + .border({ + width: Constants.BORDER_WIDTH_1, + color: $r('app.color.icon_border'), + radius: Constants.SECURITY_ICON_WIDTH * 14 / 54 + }) if (params.index === 1) { Image(params.securityParams[params.index].icon) .width(Constants.IMAGE_LENGTH_20) @@ -101,33 +112,27 @@ function dialogContentsArea(params: DialogInfo) { radius: Constants.IMAGE_LENGTH_20 * 14 / 54 }) } else { - SymbolGlyph($r('sys.symbol.local_fill')) - .width(Constants.IMAGE_LENGTH_20) - .height(Constants.IMAGE_LENGTH_20) - .fontSize(Constants.FONT_SIZE_12) - .fontColor([Color.White]) - .backgroundColor($r('app.color.local_background_color')) - .padding(Constants.PADDING_4) - .position({ x: Constants.IMAGE_POSITION_28, y: Constants.IMAGE_POSITION_28 }) - .border({ - width: Constants.BORDER_WIDTH_1, - color: $r('app.color.icon_border'), - radius: Constants.IMAGE_LENGTH_20 * 14 / 54 - }) + Row() { + SymbolGlyph($r('sys.symbol.local_fill')) + .fontSize(Constants.FONT_SIZE_12) + .fontColor([Color.White]) + } + .width(Constants.IMAGE_LENGTH_20) + .height(Constants.IMAGE_LENGTH_20) + .justifyContent(FlexAlign.Center) + .backgroundColor($r('app.color.local_background_color')) + .position({ x: Constants.IMAGE_POSITION_28, y: Constants.IMAGE_POSITION_28 }) + .border({ + width: Constants.BORDER_WIDTH_1, + color: $r('app.color.icon_border'), + radius: Constants.IMAGE_LENGTH_20 * 14 / 54 + }) } } - .width(Constants.SECURITY_ICON_WIDTH) - .height(Constants.SECURITY_ICON_HEIGHT) - .justifyContent(FlexAlign.Center) .pixelRound({ start: PixelRoundCalcPolicy.NO_FORCE_ROUND, end: PixelRoundCalcPolicy.NO_FORCE_ROUND }) .backgroundColor($r('app.color.icon_bg')) .borderRadius(Constants.SECURITY_ICON_WIDTH * 14 / 54) .margin(params.isWearable ? { top: Constants.MARGIN_12 } : {}) - .border({ - width: Constants.BORDER_WIDTH_1, - color: $r('app.color.icon_border'), - radius: Constants.SECURITY_ICON_WIDTH * 14 / 54 - }) Column() { // content dialogTitle(params.index, params.securityParams, params.isWearable); Text($r( @@ -136,7 +141,7 @@ function dialogContentsArea(params: DialogInfo) { params.appIndex === 0 ? '' : String(params.appIndex) )) .textAlign(params.isWearable ? TextAlign.Center : TextAlign.Start) - .fontColor(params.isWearable ? '#A8FFFFFF' : $r('sys.color.font_primary') ) + .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Body_L')) .maxFontScale(Constants.DIALOG_TEXT_MAX_SCALE) .margin(params.isWearable ? { -- Gitee