• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { MainItem } from '../components/MainItem'
17import { WlanMoreSettingItem } from './WlanMoreSetting'
18import { SubItemToggle } from '../components/SubItemToggle'
19import { SubItemWifi } from '../components/SubItemWifi'
20import { ItemGroup } from '../components/ItemGroup'
21import { ItemDescription } from '../components/ItemDescription'
22
23@Component
24export struct WlanSettingItem {
25  @State itemTitle: string = ''
26  @LocalStorageLink('selectedLabel') selectedLabel: string  = ''
27
28  aboutToAppear() {
29    this.itemTitle = getContext().resourceManager.getStringSync($r('app.string.wifiTab').id)
30  }
31
32  build() {
33    Column() {
34      NavRouter() {
35        MainItem({
36          title: $r('app.string.wifiTab'),
37          tag: 'UX',
38          icon: $r('app.media.wlan'),
39          label: 'WLAN'
40        })
41
42        NavDestination() {
43          WlanSetting()
44        }
45        .title(this.itemTitle)
46        .backgroundColor($r('sys.color.ohos_id_color_sub_background'))
47      }.onStateChange((isActivated: boolean) => {
48        if (isActivated) {
49          this.selectedLabel = 'WLAN'
50        }
51      })
52    }
53  }
54}
55
56@Component
57struct WlanSetting {
58  @Builder CustomDivider() {
59    Divider()
60      .strokeWidth('1px')
61      .color($r('sys.color.ohos_id_color_list_separator'))
62      .margin({left: 12, right: 8})
63  }
64
65  build() {
66    Column() {
67      Column() {
68        ItemGroup() {
69          SubItemToggle({title: $r('app.string.wifiTab'), isOn: true})
70        }
71
72        Row().height(16)
73
74        ItemGroup() {
75          WlanMoreSettingItem()
76        }
77      }
78      .margin({bottom: 19.5})
79      .flexShrink(0)
80
81      Scroll() {
82        Column() {
83          ItemDescription({description: $r('app.string.wifiTipConnectedWLAN')})
84            .padding({
85              left: 12,
86              right: 12,
87              bottom: 9.5
88            })
89
90          ItemGroup() {
91            SubItemWifi({
92              title: 'UX',
93              subTitle: $r('app.string.wifiSummaryConnected'),
94              isConnected: true,
95              icon: $r('app.media.ic_wifi_signal_4_dark')
96            })
97          }
98
99          Column() {
100            ItemDescription({description: $r('app.string.wifiTipValidWLAN')})
101              .margin({
102                left: 12,
103                right: 12,
104                top: 19.5,
105                bottom: 9.5
106              })
107
108            ItemGroup() {
109              SubItemWifi({
110                title: 'Huwe-yee',
111                subTitle: $r('app.string.wifiSummaryEncrypted'),
112                isConnected: false,
113                icon: $r('app.media.ic_wifi_lock_signal_4_dark')
114              })
115
116              this.CustomDivider()
117
118              SubItemWifi({
119                title: 'UX-5G',
120                subTitle: $r('app.string.wifiSummaryOpen'),
121                isConnected: false,
122                icon: $r('app.media.ic_wifi_signal_4_dark')
123              })
124
125              this.CustomDivider()
126
127              SubItemWifi({
128                title: 'E1-AP',
129                subTitle: $r('app.string.wifiSummarySaveOpen'),
130                isConnected: false,
131                icon: $r('app.media.ic_wifi_signal_4_dark')
132              })
133            }
134          }
135        }
136      }
137      .scrollable(ScrollDirection.Vertical)
138      .scrollBar(BarState.Off)
139      .width('100%')
140      .flexShrink(1)
141    }
142    .width('100%')
143    .height('100%')
144    .padding({left: 12, right: 12})
145  }
146}
147