!288 适老化大字体新方案适配

Merge pull request !288 from fanchenxuan/master-
This commit is contained in:
openharmony_ci 2024-08-03 02:26:57 +00:00 committed by Gitee
commit 08f4e185c9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 26 additions and 19 deletions

View File

@ -4,13 +4,14 @@
"app": {
"bundleName": "com.ohos.permissionmanager",
"vendor": "example",
"versionCode": 1000064,
"versionName": "1.6.4",
"versionCode": 1000065,
"versionName": "1.6.5",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,
"targetAPIVersion": 12,
"distributedNotificationEnabled": true,
"apiReleaseType": "Beta5"
"apiReleaseType": "Beta5",
"configuration": "$profile:configuration"
}
}

View File

@ -16,13 +16,14 @@
"app": {
"bundleName": "com.ohos.permissionmanager",
"vendor": "example",
"versionCode": 1000064,
"versionName": "1.6.4",
"versionCode": 1000065,
"versionName": "1.6.5",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,
"targetAPIVersion": 12,
"distributedNotificationEnabled": true,
"apiReleaseType": "Beta5"
"apiReleaseType": "Beta5",
"configuration": "$profile:configuration"
}
}

View File

@ -0,0 +1,6 @@
{
"configuration": {
"fontSizeScale": "followSystem",
"fontSizeMaxScale": "2"
}
}

View File

@ -135,6 +135,7 @@ export default class Constants {
public static DIVIDER_MARGIN_RIGHT_PERMISSION = 52;
public static DIVIDER_MARGIN_RIGHT_APPLICATION = 68;
public static DIALOG_TITLE_MAX_SCALE = 2;
public static DIALOG_TEXT_MAX_SCALE = 3.2;
// application-secondary, authority-secondary
public static FLEX_MARGIN_TOP = 8;

View File

@ -278,7 +278,7 @@ export function setAvoidArea(proxy: uiExtensionHost.UIExtensionHostWindowProxy)
export function getFontSizeScale(): number {
const FONT_SIZE_SCALE_PARAM = 'persist.sys.font_scale_for_user0';
let fontSizeScale = Number.parseFloat(systemParameterEnhance.getSync(FONT_SIZE_SCALE_PARAM, '1'));
return fontSizeScale;
return fontSizeScale >= Constants.DIALOG_TITLE_MAX_SCALE ? Constants.DIALOG_TITLE_MAX_SCALE : fontSizeScale;
}
export function getLimitFontSize(

View File

@ -89,8 +89,8 @@ struct dialogPlusPage {
Column() {
if ((this.initStatus != Constants.INIT_NEED_TO_WAIT) && this.verify()) {
Image(this.currentGroup().icon)
.width(Constants.DIALOG_ICON_WIDTH * getFontSizeScale())
.height(Constants.DIALOG_ICON_HEIGHT * getFontSizeScale())
.width(Constants.DIALOG_ICON_WIDTH)
.height(Constants.DIALOG_ICON_HEIGHT)
.fillColor($r('sys.color.ohos_id_color_text_primary'))
.margin({ top: Constants.DIALOG_ICON_MARGIN_TOP })
if (this.grantGroups.length > 1) {
@ -162,6 +162,7 @@ struct dialogPlusPage {
.textAlign(TextAlign.Start)
.fontColor($r('sys.color.font_primary'))
.fontSize($r('sys.float.Body_L'))
.maxFontScale(Constants.DIALOG_TEXT_MAX_SCALE)
.margin({
left: Constants.DIALOG_DESP_MARGIN_LEFT,
right: Constants.DIALOG_DESP_MARGIN_RIGHT,

View File

@ -102,8 +102,9 @@ struct SecurityDialog {
Column() {
Column() {
SymbolGlyph($r('sys.symbol.person_shield_fill'))
.constraintSize({ minWidth: Constants.SECURITY_ICON_WIDTH, minHeight: Constants.SECURITY_ICON_HEIGHT })
.fontSize(Constants.FONT_SIZE_28)
.width(Constants.SECURITY_ICON_WIDTH)
.height(Constants.SECURITY_ICON_HEIGHT)
.fontSize(Constants.FONT_SIZE_28 / getFontSizeScale())
.fontColor([$r('sys.color.brand')])
.border({
width: Constants.BORDER_WIDTH_1,
@ -112,14 +113,9 @@ struct SecurityDialog {
})
.padding(Constants.PADDING_10)
Image(this.securityParams[this.index].icon)
.width(Constants.IMAGE_LENGTH_20 * getFontSizeScale())
.height(Constants.IMAGE_LENGTH_20 * getFontSizeScale())
.position({
x: (Constants.FONT_SIZE_28 - Constants.IMAGE_LENGTH_20) * getFontSizeScale() +
Constants.PADDING_10 * Constants.PADDING_TWICE,
y: (Constants.FONT_SIZE_28 - Constants.IMAGE_LENGTH_20) * getFontSizeScale() +
Constants.PADDING_10 * Constants.PADDING_TWICE
})
.width(Constants.IMAGE_LENGTH_20)
.height(Constants.IMAGE_LENGTH_20)
.position({ x: Constants.IMAGE_POSITION_28, y: Constants.IMAGE_POSITION_28 })
}
.backgroundColor($r('app.color.icon_bg'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
@ -158,6 +154,7 @@ struct SecurityDialog {
.fontColor($r('sys.color.font_primary'))
.fontSize($r('sys.float.Body_L'))
.lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT)
.maxFontScale(Constants.DIALOG_TEXT_MAX_SCALE)
}
}
.clip(true)