1/* 2 * Copyright (c) 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 { SettingManager } from '../../../setting/SettingManager' 17import { Log } from '../../../utils/Log' 18import { SetResolution } from './SetResolution' 19import { SetToggle } from './SetToggle' 20import { BaseData } from '../model/BaseData' 21 22@Component 23export struct SettingItem { 24 private TAG: string = '[SettingItem]:' 25 @Link settingsList: any[] 26 @Link closeFlag: Boolean 27 private item: BaseData 28 private index: number 29 private settingsListIndex: number 30 private getPhotoValue: Promise<string> 31 private getVideoValue: Promise<string> 32 private WH_100_100: string = "100%" 33 private settingManager = SettingManager.getInstance() 34 35 aboutToAppear() { 36 Log.info(`${this.TAG} aboutToAppear start`) 37 Log.info(`${this.TAG} aboutToAppear ${JSON.stringify(this.item.settingChildren)}`) 38 Log.info(`${this.TAG} aboutToAppear end`) 39 } 40 41 build() { 42 Flex({ direction: FlexDirection.Column, 43 alignItems: ItemAlign.Center, 44 justifyContent: FlexAlign.SpaceBetween }) { 45 Column() { 46 Row() { 47 Text(this.item.settingTitle) 48 .margin({ top: $r('app.float.margin_value_20'), 49 left: $r("sys.float.ohos_id_card_margin_start"), 50 bottom: $r('app.float.margin_value_8') }) 51 .fontColor($r('app.color.font_color_FFFFFF')) 52 .opacity($r('app.float.opacity_6')) 53 .fontSize($r('app.float.font_14')) 54 .fontWeight(FontWeight.Medium) 55 } 56 .width(this.WH_100_100) 57 .height(this.WH_100_100) 58 } 59 .width(this.WH_100_100) 60 .height(48) 61 62 Column() { 63 List() { 64 ForEach(this.item.settingChildren, (itemValue) => { 65 ListItem() { 66 Column() { 67 if (itemValue.selectType === "radio") { 68 SetResolution({ 69 closeFlag: $closeFlag, 70 settingsList: $settingsList, 71 itemValue: itemValue 72 }) 73 } 74 if (itemValue.selectType === "toggle") { 75 SetToggle({ 76 settingsList: $settingsList, 77 itemValue: itemValue 78 }) 79 } 80 } 81 } 82 }) 83 } 84 .listDirection(Axis.Vertical) 85 .divider({ strokeWidth: 0.5, color: '#33FFFFFF', startMargin: 56, endMargin: 12 }) 86 .borderRadius($r("sys.float.ohos_id_corner_radius_card")) 87 .backgroundColor("#202224") 88 .padding({ top: 4, bottom: 4 }) 89 }.width(this.WH_100_100) 90 } 91 } 92}