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