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 CommonStyleManager from '../../../../../../../../common/src/main/ets/default/CommonStyleManager'; 17import Constants from './Constants'; 18 19const TAG = 'ControlCenter-StyleConfiguration'; 20 21export class ControlCenterComponentStyle { 22 marginLeft: Length = $r('app.float.control_center_margin_left'); 23 marginRight: Length = $r('app.float.control_center_margin_right'); 24 marginTop: Length = $r('app.float.control_center_margin_top'); 25 titleMarginBottom: Length = $r('app.float.control_center_title_margin_bottom'); 26 upTitleHeight: Length = $r('app.float.control_center_title_height'); 27 toggleAreaGap: Length = $r('app.float.control_center_toggle_area_gap'); 28 simpleToggleLayoutMarginTop: Length = $r('app.float.control_center_simple_toggle_layout_margin_top'); 29 simpleToggleLayoutMarginBottom: Length = $r('app.float.control_center_simple_toggle_layout_margin_bottom'); 30 brightnessMarginBottom: Length = $r('app.float.control_center_brightness_margin_bottom'); 31 componentBorderRadius: Length = $r('app.float.control_center_component_border_radius'); 32 componentBackgroundColor: ResourceColor = $r('app.color.control_center_component_background'); 33} 34 35export class ControlCenterUpTitleStyle { 36 marginLeft: Length = $r('app.float.control_center_title_margin_left'); 37 marginRight: Length = $r('app.float.control_center_title_margin_right'); 38 fontSize: Length = $r('app.float.control_center_title_font_size'); 39 fontColor: ResourceColor = $r('app.color.control_center_title_font_color'); 40 titleImageColor: ResourceColor = $r('app.color.control_center_title_image_color'); 41 imageWidth: Length = $r('app.float.control_center_title_icon_width'); 42 imageHeight: Length = $r('app.float.control_center_title_icon_height'); 43 imageHoverWidth: number | string = Constants.CONTROL_CENTER_TITLE_ICON_HOVER_WIDTH; 44 imageHoverHeight: number | string = Constants.CONTROL_CENTER_TITLE_ICON_HOVER_HEIGHT; 45 imageHoverRadius: number | string = Constants.CONTROL_CENTER_TITLE_ICON_HOVER_RADIUS; 46 imageHoverColor: ResourceColor = $r('app.color.control_center_title_icon_hover_color'); 47 imageTransparentColor: ResourceColor = $r('app.color.control_center_title_icon_transparent_color'); 48 upTitleSpace: Length = $r('app.float.control_center_title_space'); 49} 50 51export class ControlCenterComplexToggleLayoutStyle { 52 columnGap: Length = $r('app.float.control_center_complex_toggle_column_gap'); 53 rowGap: Length = Constants.COMPLEX_TOGGLE_GRID_ROW_GAP; 54 rowHeight: Length = Constants.COMPLEX_TOGGLE_GRID_ROW_HEIGHT; 55} 56 57export class ControlCenterSimpleToggleLayoutStyle { 58 marginLeft: Length = $r('app.float.control_center_simple_toggle_layout_margin_left'); 59 marginRight: Length = $r('app.float.control_center_simple_toggle_layout_margin_right'); 60 columnGap: Length = $r('app.float.control_center_simple_toggle_column_gap'); 61 rowGap: Length = Constants.SIMPLE_TOGGLE_GRID_ROW_GAP; 62 rowHeight: Length = Constants.SIMPLE_TOGGLE_GRID_ROW_HEIGHT; 63} 64 65export class SimpleToggleLayoutEditComponentStyle { 66 marginLeft: Length = $r('app.float.simple_toggle_edit_margin_left'); 67 marginRight: Length = $r('app.float.simple_toggle_edit_margin_right'); 68 marginTop: Length = $r('app.float.simple_toggle_edit_margin_top'); 69 titleHeight: Length = $r('app.float.simple_toggle_edit_title_height'); 70 titleMarginBottom: Length = $r('app.float.simple_toggle_edit_title_margin_bottom'); 71 upGridMarginTop: Length = $r('app.float.simple_toggle_edit_up_grid_margin_top'); 72 upGridMarginBottom: Length = $r('app.float.simple_toggle_edit_up_grid_margin_bottom'); 73 gridMarginLeft: Length = $r('app.float.simple_toggle_edit_grid_margin_left'); 74 gridMarginRight: Length = $r('app.float.simple_toggle_edit_grid_margin_right'); 75 msgMarginTop: Length = $r('app.float.simple_toggle_edit_msg_margin_top'); 76 msgMarginBottom: Length = $r('app.float.simple_toggle_edit_msg_margin_bottom'); 77 btnMarginTop: Length = $r('app.float.simple_toggle_edit_btn_margin_top'); 78 btnMarginBottom: Length = $r('app.float.simple_toggle_edit_btn_margin_bottom'); 79 borderRadius: Length = $r('app.float.simple_toggle_edit_border_radius'); 80 upAreaBgColor: ResourceColor = $r('app.color.center_edit_up_area_bg_color'); 81 downAreaBgColor: ResourceColor = $r('app.color.center_edit_down_area_bg_color'); 82 editBtnFontColor: ResourceColor = $r('app.color.simple_toggle_edit_btn_font_color'); 83 editBtnFontSize: Length = $r('sys.float.ohos_id_text_size_button1'); 84 editBtnBgColor: ResourceColor = $r('app.color.simple_toggle_edit_btn_bg_color'); 85 editBtnMarginLeft: Length = $r('app.float.simple_toggle_edit_btn_margin_left'); 86 editBtnMarginRight: Length = $r('app.float.simple_toggle_edit_btn_margin_right'); 87 editBtnHeight: Length = $r('app.float.simple_toggle_edit_btn_height'); 88 editBtnSpace: Length = $r('app.float.simple_toggle_edit_btn_space'); 89} 90 91export class SimpleToggleLayoutEditUpTitleStyle { 92 marginLeft: Length = $r('app.float.simple_toggle_edit_title_margin_left'); 93 imageWidth: Length = $r('app.float.simple_toggle_edit_title_icon_width'); 94 imageHeight: Length = $r('app.float.simple_toggle_edit_title_icon_height'); 95 fontColor: ResourceColor = $r('app.color.simple_toggle_edit_title_font_color'); 96 editTitleSpace: Length = $r('app.float.simple_toggle_edit_icon_width'); 97 titleFontSize: Length = $r('app.float.simple_toggle_edit_title_font_size'); 98} 99 100export class SimpleToggleLayoutEditOptMsgStyle { 101 fontSize: Length = $r('app.float.simple_toggle_edit_opt_msg_font_size'); 102 fontColor: ResourceColor = $r('sys.color.ohos_id_color_text_secondary'); 103 height: Length = $r('app.float.simple_toggle_edit_opt_msg_height'); 104 marginLeftRight: Length = $r('app.float.simple_toggle_edit_opt_msg_margin_left_right'); 105} 106 107export class SimpleToggleLayoutEditGridStyle { 108 columnGap: Length = $r('app.float.simple_toggle_edit_grid_column_gap'); 109 rowGap: number = Constants.SIMPLE_TOGGLE_GRID_ROW_GAP; 110 rowHeight: number = Constants.SIMPLE_TOGGLE_GRID_ROW_HEIGHT; 111 dragBgSize: Length = $r('app.float.simple_toggle_edit_grid_drag_bg_size'); 112} 113 114export class ControlEditDialogStyle { 115 editDialogHeight: Length = $r('app.float.simple_toggle_edit_dialog_height'); 116 editDialogWidth: Length = $r('app.float.simple_toggle_edit_dialog_width'); 117 editDialogFontSize: Length = $r('app.float.simple_toggle_edit_dialog_font_size'); 118 editDialogBtnMarginLF: Length = $r('app.float.simple_toggle_edit_dialog_btn_margin_lf'); 119 editDialogFontHeight: Length = $r('app.float.simple_toggle_edit_dialog_font_height'); 120 editDialogBtnMarginTop: Length = $r('app.float.simple_toggle_edit_dialog_btn_margin_top'); 121 editDialogButtonSize: Length = $r('app.float.simple_toggle_edit_dialog_btn_font_size'); 122 editDialogDividerHeight: Length = $r('app.float.simple_toggle_edit_dialog_divider_height'); 123 editDialogButtonHeight: Length = $r('app.float.simple_toggle_edit_dialog_btn_height'); 124 editDialogRadius: Length = $r('app.float.simple_toggle_edit_dialog_radius'); 125 editDialogBtnWidth: Length = $r('app.float.simple_toggle_edit_dialog_btn_width'); 126 editDialogColor: ResourceColor = $r('app.color.center_edit_dialog_color'); 127 editDialogBtnFontColor: ResourceStr = $r('app.color.center_edit_dialog_btn_font_color'); 128 editDialogBtnBgColor: ResourceColor = $r('app.color.center_edit_dialog_btn_bg_color'); 129 editDialogDividerColor: ResourceColor = $r('sys.color.ohos_id_color_secondary'); 130 editDialogFontMarginTop: Length = $r('app.float.simple_toggle_edit_dialog_font_margin_top'); 131 editDialogDividerWidth: number | string = Constants.SIMPLE_TOGGLE_EDIT_DIALOG_DIVIDER_WIDTH; 132} 133 134export default class StyleConfiguration { 135 static getControlCenterComponentStyle(): ControlCenterComponentStyle { 136 const key: string = TAG + '-ControlCenterComponent'; 137 return CommonStyleManager.getStyle(key, ControlCenterComponentStyle); 138 } 139 140 static getControlCenterUpTitleStyle(): ControlCenterUpTitleStyle { 141 const key: string = TAG + '-ControlCenterUpTitle'; 142 return CommonStyleManager.getStyle(key, ControlCenterUpTitleStyle); 143 } 144 145 static getControlCenterComplexToggleLayoutStyle(): ControlCenterComplexToggleLayoutStyle { 146 const key: string = TAG + '-ControlCenterComplexToggleLayout'; 147 return CommonStyleManager.getStyle(key, ControlCenterComplexToggleLayoutStyle); 148 } 149 150 static getControlCenterSimpleToggleLayoutStyle(): ControlCenterSimpleToggleLayoutStyle { 151 const key: string = TAG + '-ControlCenterSimpleToggleLayout'; 152 return CommonStyleManager.getStyle(key, ControlCenterSimpleToggleLayoutStyle); 153 } 154 155 static getSimpleToggleLayoutEditComponentStyle(): SimpleToggleLayoutEditComponentStyle { 156 const key: string = TAG + '-SimpleToggleLayoutEditComponent'; 157 return CommonStyleManager.getStyle(key, SimpleToggleLayoutEditComponentStyle); 158 } 159 160 static getSimpleToggleLayoutEditUpTitleStyle(): SimpleToggleLayoutEditUpTitleStyle { 161 const key: string = TAG + '-SimpleToggleLayoutEditUpTitle'; 162 return CommonStyleManager.getStyle(key, SimpleToggleLayoutEditUpTitleStyle); 163 } 164 165 static getSimpleToggleLayoutEditOptMsgStyle(): SimpleToggleLayoutEditOptMsgStyle { 166 const key: string = TAG + '-SimpleToggleLayoutEditOptMsg'; 167 return CommonStyleManager.getStyle(key, SimpleToggleLayoutEditOptMsgStyle); 168 } 169 170 static getSimpleToggleLayoutEditGridStyle(): SimpleToggleLayoutEditGridStyle { 171 const key: string = TAG + '-SimpleToggleLayoutEditGrid'; 172 return CommonStyleManager.getStyle(key, SimpleToggleLayoutEditGridStyle); 173 } 174 175 static getControlEditDialogStyle(): ControlEditDialogStyle { 176 const key: string = TAG + '-ControlEditDialog'; 177 return CommonStyleManager.getStyle(key, ControlEditDialogStyle); 178 } 179}