diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/common/utils.ets b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/common/utils.ets index be487d359c36877c86a8a9992a09715788a28f64..ab9f244de261af2b52089a0289b907efc18d55e2 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/common/utils.ets +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/common/utils.ets @@ -18,6 +18,8 @@ import { MeasureOptions } from '@ohos.measure'; import { MeasureUtils } from '@ohos.arkui.UIContext'; import common from '@ohos.app.ability.common'; +const TAG = 'NotificationDialog_Service '; + /** * Omit display when application name is too long * @param {String} Application name @@ -42,19 +44,20 @@ export function calContainerWidth( try { let textWidth = px2vp(measureUtils.measureText(options)); let ratio = (textWidth % containerWidth) / containerWidth; - let crossLineFlag: boolean = textWidth > containerWidth; + let crossLineFlag: boolean = (textWidth > containerWidth) && (textWidth < 2 * containerWidth); if (crossLineFlag && ratio < crossLineRatio) { targetContainerWidth = containerWidth / Constants.CROSS_LINE_RESIZE_PARAM; + console.info(TAG, 'afford condition, cal new width.'); } } catch (err) { - console.error(`refresh width failed, code=${err?.code0}, msg=${err?.message}.`); + console.error(TAG, `refresh width failed, code=${err?.code0}, msg=${err?.message}.`); } return targetContainerWidth; } export function getFontSizeScale(context: common.UIAbilityContext, maxScale: number = 3.2): number { let fontSizeScale = context.config?.fontSizeScale; - console.log(`NotificationDialog_Service fontSizeScale = ${fontSizeScale}`); + console.log(TAG, `fontSizeScale = ${fontSizeScale}`); if(fontSizeScale === undefined) { return Constants.FONT_SCALE_DEFAULT; } diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets index bdc6bd9bcf140d8ef329684b68f3c1f2b13ae946..d3778717727d8cc045df5f841efe746191874225 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets @@ -156,13 +156,13 @@ struct PermissionDialog { .fontWeight(FontWeight.Regular) .fontColor($r('app.color.text_primary')) .lineHeight(Constants.DIALOG_DESP_LINE_HEIGHT) - .margin({ - top: Constants.DIALOG_DESP_MARGIN_TOP, - left: Constants.DIALOG_DESP_MARGIN_LEFT, - right: Constants.DIALOG_DESP_MARGIN_RIGHT, - bottom: Constants.DIALOG_DESP_MARGIN_BOTTOM - }) } + .margin({ + top: Constants.DIALOG_DESP_MARGIN_TOP, + left: Constants.DIALOG_DESP_MARGIN_LEFT, + right: Constants.DIALOG_DESP_MARGIN_RIGHT, + bottom: Constants.DIALOG_DESP_MARGIN_BOTTOM + }) } Row() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/pcNotificationDialog.ets b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/pcNotificationDialog.ets index 2e9c3e10347352448a1f50f77fd34bd9504cf798..9a4f6b1222ebf57bd29b862f842992481d4436b3 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/pcNotificationDialog.ets +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/pcNotificationDialog.ets @@ -170,12 +170,12 @@ struct PermissionDialog { ) .fontWeight(FontWeight.Medium) .fontColor($r('sys.color.font_primary')) - .margin({ - left: Constants.PC_CONTENT_MARGIN_SIDE, - right: Constants.PC_CONTENT_MARGIN_SIDE, - top: Constants.PC_CONTENT_MARGIN_TOP - }) } + .margin({ + left: Constants.PC_CONTENT_MARGIN_SIDE, + right: Constants.PC_CONTENT_MARGIN_SIDE, + top: Constants.PC_CONTENT_MARGIN_TOP + }) } Row() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {