1/* 2 * Copyright (c) 2021-2023 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 StyleConfigurationCommon, { CommonStyle } from '../../../../../../../common/src/main/ets/default/StyleConfiguration' 17import { TintContentInfo } from '../../../../../../../common/src/main/ets/default/TintStateManager'; 18import Log from '../../../../../../../common/src/main/ets/default/Log'; 19import StyleConfiguration, { StatusBarAirplaneComponentStyle } from '../common/StyleConfiguration' 20import ViewModel from '../viewmodel/AirplaneVM' 21 22const TAG = 'airplane-StatusBarIconItemAirplaneComponent'; 23 24@Component 25export default struct StatusBarIconItemAirplaneComponent { 26 @StorageLink('Airplane_Status') airplaneStatus: boolean = false; 27 @State mTintContentInfo: TintContentInfo = ViewModel.getTintContentInfo(); 28 @State styleCommon: CommonStyle = StyleConfigurationCommon.getCommonStyle(); 29 @State style: StatusBarAirplaneComponentStyle = StyleConfiguration.getStatusBarAirplaneComponentStyle(); 30 31 aboutToAppear() { 32 ViewModel.startVM(); 33 } 34 35 build() { 36 Row() { 37 if (this.airplaneStatus) { 38 Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%') 39 Image($r("app.media.airplane")) 40 .objectFit(ImageFit.Contain) 41 .width(this.style.statusBarAirplaneWidth) 42 .height(this.style.statusBarAirplaneHeight) 43 .fillColor(this.mTintContentInfo.contentColor) 44 Row().width(this.styleCommon.statusBarMarginLeftRight).height('100%') 45 } 46 } 47 .height('100%') 48 .opacity($r("app.float.icon_component_opacity")) 49 } 50} 51