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