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 Log from '../../../../../../common/src/main/ets/default/Log'; 17import AbilityManager from '../../../../../../common/src/main/ets/default/abilitymanager/abilityManager'; 18import IndexStyleConfiguration from './StyleConfiguration' 19 20const TAG = 'StatusBar-StyleManager'; 21 22export default class StyleManager { 23 static STANDARD_DISPLAY_WIDTH: number = 720; 24 static STANDARD_DISPLAY_HEIGHT: number = 1280; 25 static maxWidth: number = StyleManager.STANDARD_DISPLAY_WIDTH; 26 27 static setStyle() { 28 Log.showInfo(TAG, `setStyle`) 29 30 let config = AbilityManager.getAbilityData(AbilityManager.ABILITY_NAME_STATUS_BAR, 'dis'); 31 StyleManager.maxWidth = config.maxWidth; 32 33 // xxx 34 { 35 36 } 37 38 } 39 40 static number2px(n: number): string { 41 return n.toString() + 'px'; 42 } 43 44 static calcScaleSize(n: number): number { 45 return n * StyleManager.maxWidth / StyleManager.STANDARD_DISPLAY_WIDTH; 46 } 47 48 static calcScaleSizePx(n: number): string { 49 return StyleManager.number2px(StyleManager.calcScaleSize(n)); 50 } 51}