16e80583aSopenharmony_ci/* 26e80583aSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 36e80583aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 46e80583aSopenharmony_ci * you may not use this file except in compliance with the License. 56e80583aSopenharmony_ci * You may obtain a copy of the License at 66e80583aSopenharmony_ci * 76e80583aSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 86e80583aSopenharmony_ci * 96e80583aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 106e80583aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 116e80583aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 126e80583aSopenharmony_ci * See the License for the specific language governing permissions and 136e80583aSopenharmony_ci * limitations under the License. 146e80583aSopenharmony_ci */ 156e80583aSopenharmony_ciimport { ILayoutConfig } from './ILayoutConfig'; 166e80583aSopenharmony_ciimport { CommonConstants } from '../constants/CommonConstants'; 176e80583aSopenharmony_ciimport { PresetStyleConstants } from '../constants/PresetStyleConstants'; 186e80583aSopenharmony_ci 196e80583aSopenharmony_ci/** 206e80583aSopenharmony_ci * Launcher_layout style 216e80583aSopenharmony_ci */ 226e80583aSopenharmony_ciexport class LauncherLayoutStyleConfig extends ILayoutConfig { 236e80583aSopenharmony_ci 246e80583aSopenharmony_ci static LAUNCHER_COMMON_STYLE_CONFIG: string = 'launcherStyleCommon'; 256e80583aSopenharmony_ci 266e80583aSopenharmony_ci static LAUNCHER_PRODUCT_STYLE_CONFIG: string = 'launcherStyleProduct'; 276e80583aSopenharmony_ci 286e80583aSopenharmony_ci /** 296e80583aSopenharmony_ci * CommonDialogWidth width 306e80583aSopenharmony_ci */ 316e80583aSopenharmony_ci mCommonDialogWidth = PresetStyleConstants.DEFAULT_COMMONDIALOG_WIDTH; 326e80583aSopenharmony_ci 336e80583aSopenharmony_ci /** 346e80583aSopenharmony_ci * systemUI top height 356e80583aSopenharmony_ci */ 366e80583aSopenharmony_ci mSysTopHeight = PresetStyleConstants.DEFAULT_SYS_TOP_HEIGHT; 376e80583aSopenharmony_ci 386e80583aSopenharmony_ci /** 396e80583aSopenharmony_ci * systemUI bottom height 406e80583aSopenharmony_ci */ 416e80583aSopenharmony_ci mSysBottomHeight = PresetStyleConstants.DEFAULT_SYS_BOTTOM_HEIGHT; 426e80583aSopenharmony_ci 436e80583aSopenharmony_ci mSystemUIHeight = PresetStyleConstants.DEFAULT_PAD_SYSTEM_UI; 446e80583aSopenharmony_ci 456e80583aSopenharmony_ci mIndicatorHeight = PresetStyleConstants.DEFAULT_PAD_INDICATOR_HEIGHT; 466e80583aSopenharmony_ci 476e80583aSopenharmony_ci /** 486e80583aSopenharmony_ci * desktop item Size 496e80583aSopenharmony_ci */ 506e80583aSopenharmony_ci mAppItemSize = PresetStyleConstants.DEFAULT_APP_LAYOUT_SIZE; 516e80583aSopenharmony_ci 526e80583aSopenharmony_ci /** 536e80583aSopenharmony_ci * desktop space margin 546e80583aSopenharmony_ci */ 556e80583aSopenharmony_ci mMargin = PresetStyleConstants.DEFAULT_LAYOUT_MARGIN; 566e80583aSopenharmony_ci 576e80583aSopenharmony_ci /** 586e80583aSopenharmony_ci * desktop grid gap 596e80583aSopenharmony_ci */ 606e80583aSopenharmony_ci mGridGutter = PresetStyleConstants.DEFAULT_APP_LAYOUT_MIN_GUTTER; 616e80583aSopenharmony_ci 626e80583aSopenharmony_ci /** 636e80583aSopenharmony_ci * icon name lines 646e80583aSopenharmony_ci */ 656e80583aSopenharmony_ci mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES; 666e80583aSopenharmony_ci 676e80583aSopenharmony_ci /** 686e80583aSopenharmony_ci * icon ratio 696e80583aSopenharmony_ci */ 706e80583aSopenharmony_ci mIconRatio: number = PresetStyleConstants.DEFAULT_APP_TOP_RATIO; 716e80583aSopenharmony_ci 726e80583aSopenharmony_ci /** 736e80583aSopenharmony_ci * icon name margin 746e80583aSopenharmony_ci */ 756e80583aSopenharmony_ci mIconNameGap: number = PresetStyleConstants.DEFAULT_ICON_NAME_GAP; 766e80583aSopenharmony_ci 776e80583aSopenharmony_ci /** 786e80583aSopenharmony_ci * icon name text size 796e80583aSopenharmony_ci */ 806e80583aSopenharmony_ci mNameSize: number = PresetStyleConstants.DEFAULT_APP_NAME_TEXT_SIZE; 816e80583aSopenharmony_ci 826e80583aSopenharmony_ci /** 836e80583aSopenharmony_ci * name height 846e80583aSopenharmony_ci */ 856e80583aSopenharmony_ci mNameHeight: number = PresetStyleConstants.DEFAULT_DESKTOP_NAME_HEIGHT; 866e80583aSopenharmony_ci 876e80583aSopenharmony_ci //folder 886e80583aSopenharmony_ci /** 896e80583aSopenharmony_ci * ratio of gutter with folder 906e80583aSopenharmony_ci */ 916e80583aSopenharmony_ci mFolderGutterRatio: number = PresetStyleConstants.DEFAULT_FOLDER_GUTTER_RATIO; 926e80583aSopenharmony_ci 936e80583aSopenharmony_ci /** 946e80583aSopenharmony_ci * ratio of margin with folder 956e80583aSopenharmony_ci */ 966e80583aSopenharmony_ci mFolderMarginRatio: number = PresetStyleConstants.DEFAULT_FOLDER_PADDING_RATIO; 976e80583aSopenharmony_ci 986e80583aSopenharmony_ci /** 996e80583aSopenharmony_ci * gutter of open folder 1006e80583aSopenharmony_ci */ 1016e80583aSopenharmony_ci mFolderOpenGutter: number = PresetStyleConstants.DEFAULT_OPEN_FOLDER_GUTTER; 1026e80583aSopenharmony_ci 1036e80583aSopenharmony_ci /** 1046e80583aSopenharmony_ci * padding of open folder 1056e80583aSopenharmony_ci */ 1066e80583aSopenharmony_ci mFolderOpenPADDING: number = PresetStyleConstants.DEFAULT_OPEN_FOLDER_PADDING; 1076e80583aSopenharmony_ci 1086e80583aSopenharmony_ci /** 1096e80583aSopenharmony_ci * margin of open folder 1106e80583aSopenharmony_ci */ 1116e80583aSopenharmony_ci mFolderOpenMargin: number = PresetStyleConstants.DEFAULT_OPEN_FOLDER_MARGIN_TOP; 1126e80583aSopenharmony_ci 1136e80583aSopenharmony_ci /** 1146e80583aSopenharmony_ci * margin top of open folder 1156e80583aSopenharmony_ci */ 1166e80583aSopenharmony_ci mFolderOpenTitle: number = PresetStyleConstants.DEFAULT_OPEN_FOLDER_TITLE_TOP; 1176e80583aSopenharmony_ci 1186e80583aSopenharmony_ci /** 1196e80583aSopenharmony_ci * gutter of add app 1206e80583aSopenharmony_ci */ 1216e80583aSopenharmony_ci mFolderAddGridGap: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_GAP; 1226e80583aSopenharmony_ci 1236e80583aSopenharmony_ci /** 1246e80583aSopenharmony_ci * margin of add app and padding of add app 1256e80583aSopenharmony_ci */ 1266e80583aSopenharmony_ci mFolderAddGridMargin: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_MARGIN; 1276e80583aSopenharmony_ci 1286e80583aSopenharmony_ci /** 1296e80583aSopenharmony_ci * max height of add app 1306e80583aSopenharmony_ci */ 1316e80583aSopenharmony_ci mFolderAddMaxHeight: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_MAX_HEIGHT; 1326e80583aSopenharmony_ci 1336e80583aSopenharmony_ci /** 1346e80583aSopenharmony_ci * toggle size of add app 1356e80583aSopenharmony_ci */ 1366e80583aSopenharmony_ci mFolderToggleSize: number = PresetStyleConstants.DEFAULT_APP_GRID_TOGGLE_SIZE; 1376e80583aSopenharmony_ci 1386e80583aSopenharmony_ci /** 1396e80583aSopenharmony_ci * name lines of add app 1406e80583aSopenharmony_ci */ 1416e80583aSopenharmony_ci mFolderAddTextLines: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_TEXT_LINES; 1426e80583aSopenharmony_ci 1436e80583aSopenharmony_ci /** 1446e80583aSopenharmony_ci * text size of add app 1456e80583aSopenharmony_ci */ 1466e80583aSopenharmony_ci mFolderAddTextSize: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_GRID_TEXT_SIZE; 1476e80583aSopenharmony_ci 1486e80583aSopenharmony_ci /** 1496e80583aSopenharmony_ci * title size of add app 1506e80583aSopenharmony_ci */ 1516e80583aSopenharmony_ci mFolderAddTitleSize: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_TITLE_TEXT_SIZE; 1526e80583aSopenharmony_ci 1536e80583aSopenharmony_ci /** 1546e80583aSopenharmony_ci * ratio of padding top with icon in add app 1556e80583aSopenharmony_ci */ 1566e80583aSopenharmony_ci mFolderAddIconRatio: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_ICON_TOP_RATIO; 1576e80583aSopenharmony_ci 1586e80583aSopenharmony_ci /** 1596e80583aSopenharmony_ci * button size of add app 1606e80583aSopenharmony_ci */ 1616e80583aSopenharmony_ci mFolderAddButtonSize: number = PresetStyleConstants.DEFAULT_FOLDER_ADD_BUTTON_SIZE; 1626e80583aSopenharmony_ci //App Center 1636e80583aSopenharmony_ci /** 1646e80583aSopenharmony_ci * left margin of app center 1656e80583aSopenharmony_ci */ 1666e80583aSopenharmony_ci mAppCenterMarginLeft: number = PresetStyleConstants.DEFAULT_APP_CENTER_MARGIN; 1676e80583aSopenharmony_ci //App Center 1686e80583aSopenharmony_ci /** 1696e80583aSopenharmony_ci * margin of app center 1706e80583aSopenharmony_ci */ 1716e80583aSopenharmony_ci mAppCenterMargin: number = PresetStyleConstants.DEFAULT_APP_CENTER_MARGIN; 1726e80583aSopenharmony_ci 1736e80583aSopenharmony_ci /** 1746e80583aSopenharmony_ci * gutter of app center 1756e80583aSopenharmony_ci */ 1766e80583aSopenharmony_ci mAppCenterGutter: number = PresetStyleConstants.DEFAULT_APP_CENTER_GUTTER; 1776e80583aSopenharmony_ci 1786e80583aSopenharmony_ci /** 1796e80583aSopenharmony_ci * size of app center container 1806e80583aSopenharmony_ci */ 1816e80583aSopenharmony_ci mAppCenterSize: number = PresetStyleConstants.DEFAULT_APP_CENTER_SIZE; 1826e80583aSopenharmony_ci 1836e80583aSopenharmony_ci /** 1846e80583aSopenharmony_ci * ratio of padding top with icon in app center 1856e80583aSopenharmony_ci */ 1866e80583aSopenharmony_ci mAppCenterRatio: number = PresetStyleConstants.DEFAULT_APP_CENTER_TOP_RATIO; 1876e80583aSopenharmony_ci 1886e80583aSopenharmony_ci /** 1896e80583aSopenharmony_ci * name lines of app center 1906e80583aSopenharmony_ci */ 1916e80583aSopenharmony_ci mAppCenterNameLines: number = PresetStyleConstants.DEFAULT_APP_CENTER_NAME_LINES; 1926e80583aSopenharmony_ci 1936e80583aSopenharmony_ci /** 1946e80583aSopenharmony_ci * name size of app center 1956e80583aSopenharmony_ci */ 1966e80583aSopenharmony_ci mAppCenterNameSize: number = PresetStyleConstants.DEFAULT_APP_CENTER_NAME_TEXT_SIZE; 1976e80583aSopenharmony_ci 1986e80583aSopenharmony_ci //dock 1996e80583aSopenharmony_ci /** 2006e80583aSopenharmony_ci * padding of dock 2016e80583aSopenharmony_ci */ 2026e80583aSopenharmony_ci mDockPadding: number = PresetStyleConstants.DEFAULT_DOCK_PADDING; 2036e80583aSopenharmony_ci 2046e80583aSopenharmony_ci /** 2056e80583aSopenharmony_ci * icon size of dock 2066e80583aSopenharmony_ci */ 2076e80583aSopenharmony_ci mDockIconSize: number = PresetStyleConstants.DEFAULT_DOCK_ICON_SIZE; 2086e80583aSopenharmony_ci 2096e80583aSopenharmony_ci /** 2106e80583aSopenharmony_ci * gap of icon and icon 2116e80583aSopenharmony_ci */ 2126e80583aSopenharmony_ci mDockItemGap: number = PresetStyleConstants.DEFAULT_DOCK_ITEM_GAP; 2136e80583aSopenharmony_ci 2146e80583aSopenharmony_ci /** 2156e80583aSopenharmony_ci * gap of dock and dock 2166e80583aSopenharmony_ci */ 2176e80583aSopenharmony_ci mDockGutter: number = PresetStyleConstants.DEFAULT_DOCK_GUTTER; 2186e80583aSopenharmony_ci 2196e80583aSopenharmony_ci /** 2206e80583aSopenharmony_ci * save margin of dock 2216e80583aSopenharmony_ci */ 2226e80583aSopenharmony_ci mDockSaveMargin: number = PresetStyleConstants.DEFAULT_DOCK_SAVE_MARGIN; 2236e80583aSopenharmony_ci 2246e80583aSopenharmony_ci /** 2256e80583aSopenharmony_ci * margin bottom of dock 2266e80583aSopenharmony_ci */ 2276e80583aSopenharmony_ci mDockMarginBottom: number = PresetStyleConstants.DEFAULT_DOCK_MARGIN_BOTTOM; 2286e80583aSopenharmony_ci 2296e80583aSopenharmony_ci /** 2306e80583aSopenharmony_ci * margin bottom of dock (Immersive navigation bar) 2316e80583aSopenharmony_ci */ 2326e80583aSopenharmony_ci mDockMarginBottomHideBar: number = PresetStyleConstants.DEFAULT_DOCK_MARGIN_BOTTOM_HIDE_BAR; 2336e80583aSopenharmony_ci 2346e80583aSopenharmony_ci protected constructor() { 2356e80583aSopenharmony_ci super(); 2366e80583aSopenharmony_ci } 2376e80583aSopenharmony_ci 2386e80583aSopenharmony_ci /** 2396e80583aSopenharmony_ci * LauncherLayoutStyleConfig of instance 2406e80583aSopenharmony_ci */ 2416e80583aSopenharmony_ci static getInstance(): LauncherLayoutStyleConfig { 2426e80583aSopenharmony_ci if (globalThis.LauncherLayoutStyleConfigInstance == null) { 2436e80583aSopenharmony_ci globalThis.LauncherLayoutStyleConfigInstance = new LauncherLayoutStyleConfig(); 2446e80583aSopenharmony_ci } 2456e80583aSopenharmony_ci return globalThis.LauncherLayoutStyleConfigInstance; 2466e80583aSopenharmony_ci } 2476e80583aSopenharmony_ci 2486e80583aSopenharmony_ci initConfig(): void { 2496e80583aSopenharmony_ci } 2506e80583aSopenharmony_ci 2516e80583aSopenharmony_ci getConfigLevel(): string { 2526e80583aSopenharmony_ci return CommonConstants.LAYOUT_CONFIG_LEVEL_COMMON; 2536e80583aSopenharmony_ci } 2546e80583aSopenharmony_ci 2556e80583aSopenharmony_ci getConfigType(): number { 2566e80583aSopenharmony_ci return CommonConstants.LAYOUT_CONFIG_TYPE_STYLE; 2576e80583aSopenharmony_ci } 2586e80583aSopenharmony_ci 2596e80583aSopenharmony_ci getConfigName(): string { 2606e80583aSopenharmony_ci return LauncherLayoutStyleConfig.LAUNCHER_COMMON_STYLE_CONFIG; 2616e80583aSopenharmony_ci } 2626e80583aSopenharmony_ci 2636e80583aSopenharmony_ci protected getPersistConfigJson(): string { 2646e80583aSopenharmony_ci let persistConfig = { 2656e80583aSopenharmony_ci }; 2666e80583aSopenharmony_ci return JSON.stringify(persistConfig); 2676e80583aSopenharmony_ci } 2686e80583aSopenharmony_ci}