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