mirror of
https://gitee.com/openharmony/applications_launcher
synced 2024-11-23 06:50:02 +00:00
图库卡片显示异常
Signed-off-by: zhengyongjie <15531316327@163.com>
This commit is contained in:
parent
9ad0f5f055
commit
7b37c4f550
@ -19,6 +19,7 @@ import { Log } from '../utils/Log';
|
||||
import { CardItemInfo } from '../bean/CardItemInfo';
|
||||
import { CommonConstants } from '../constants/CommonConstants';
|
||||
import { launcherAbilityManager } from './LauncherAbilityManager';
|
||||
import { ResourceManager } from './ResourceManager';
|
||||
|
||||
const TAG = 'FormManager';
|
||||
|
||||
@ -94,6 +95,8 @@ export class FormManager {
|
||||
const formList = await formManagerAbility.getFormsInfo(bundle);
|
||||
const cardItemInfoList = new Array<CardItemInfo>();
|
||||
for (const formItem of formList) {
|
||||
let value: string = await this.updateFormDescription(formItem.description,
|
||||
formItem.descriptionId, formItem.descriptionId, formItem.bundleName, formItem.moduleName, formItem.name);
|
||||
const cardItemInfo = new CardItemInfo();
|
||||
cardItemInfo.bundleName = formItem.bundleName;
|
||||
cardItemInfo.abilityName = formItem.abilityName;
|
||||
@ -101,7 +104,7 @@ export class FormManager {
|
||||
cardItemInfo.cardName = formItem.name;
|
||||
cardItemInfo.cardDimension = formItem.defaultDimension;
|
||||
cardItemInfo.area = this.getCardSize(cardItemInfo.cardDimension);
|
||||
cardItemInfo.description = formItem.description;
|
||||
cardItemInfo.description = value;
|
||||
cardItemInfo.formConfigAbility = formItem.formConfigAbility;
|
||||
cardItemInfo.supportDimensions = formItem.supportDimensions;
|
||||
cardItemInfoList.push(cardItemInfo);
|
||||
@ -109,6 +112,20 @@ export class FormManager {
|
||||
return cardItemInfoList;
|
||||
}
|
||||
|
||||
async updateFormDescription(description: string, descriptionId: number, labelId: number,
|
||||
bundleName: string, moduleName: string, appName: string): Promise<string> {
|
||||
if (description.match(/\d+/)) {
|
||||
let number = parseInt(description.match(/\d+/)[0], 10);
|
||||
if (descriptionId === number) {
|
||||
let resourceManager: ResourceManager = ResourceManager.getInstance();
|
||||
let value = await resourceManager.getAppNameSync(labelId, bundleName, moduleName, appName);
|
||||
return value;
|
||||
}
|
||||
} else {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get formCardItem by want parameters
|
||||
*
|
||||
@ -187,6 +204,5 @@ export class FormManager {
|
||||
Log.showInfo(TAG, `delete form info by formId:${formId}`);
|
||||
return await formManagerAbility.deleteForm(formId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user