1/** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { StyleConstants } from '@ohos/common'; 17import { CommonConstants } from '@ohos/common'; 18import { AppListStyleConfig } from '@ohos/common'; 19import AppcenterConstants from './constants/AppcenterConstants'; 20 21/** 22 * App center list style configuration class 23 */ 24export default class AppCenterListStyleConfig extends AppListStyleConfig { 25 /** 26 * List item width 27 */ 28 mListItemWidth: string | number = StyleConstants.PERCENTAGE_100; 29 30 /** 31 * List item height 32 */ 33 mListItemHeight: string | number = StyleConstants.DEFAULT_80; 34 35 /** 36 * List item spacing 37 */ 38 mListItemGap = 12; 39 40 /** 41 * Whether the list name is displayed next to 42 */ 43 mNameDisplaySide = true; 44 45 /** 46 * list icon size 47 */ 48 mIconSize: number = StyleConstants.DEFAULT_APP_ITEM_WIDTH; 49 50 /** 51 * list name size 52 */ 53 mNameSize: number = StyleConstants.DEFAULT_APP_NAME_SIZE; 54 55 /** 56 * Spacing between list icons and names 57 */ 58 mNameIconGap: number = StyleConstants.DEFAULT_NUMBER; 59 60 /** 61 * the inner margin of the entry 62 */ 63 mItemPadding = 8; 64 65 /** 66 * the background color of the entry 67 */ 68 mItemBackgroundColor: string = StyleConstants.LIGHT_BLACK; 69 70 /** 71 * the rounded corner value of the entry 72 */ 73 mItemBorderRadius: number = StyleConstants.DEFAULT_20; 74 75 protected constructor() { 76 super(); 77 } 78 79 /** 80 * Get an instance of the app center list style 81 */ 82 static getInstance(): AppCenterListStyleConfig { 83 if (globalThis.AppCenterListStyleConfig == null) { 84 globalThis.AppCenterListStyleConfig = new AppCenterListStyleConfig(); 85 globalThis.AppCenterListStyleConfig.initConfig(); 86 } 87 return globalThis.AppCenterListStyleConfig; 88 } 89 90 getConfigLevel(): string { 91 return CommonConstants.LAYOUT_CONFIG_LEVEL_FEATURE; 92 } 93 94 getFeatureName(): string { 95 return AppcenterConstants.FEATURE_NAME; 96 } 97}