• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 */
15import { BaseByodAdminPage, BottomButton } from './baseByodAdminPage';
16import common from '@ohos.app.ability.common';
17
18const TAG = 'ByodActivationPage';
19
20@Entry
21@Component
22struct ByodActivationPage {
23
24  @Builder
25  topBuilder() {
26    Text($r('app.string.byodActivationPageTitle'))
27      .fontColor($r('sys.color.ohos_id_color_text_primary'))
28      .fontWeight(FontWeight.Bold)
29      .lineHeight('27vp')
30      .fontSize('20vp')
31  }
32
33  @Builder
34  centerBuilder() {
35  }
36
37  @Builder
38  bottomBuilder() {
39    Row({ space: '12vp' }) {
40      BottomButton({
41        description: $r('app.string.byodDisagree'),
42        buttonWidth: '158vp',
43        isEnabled: true
44      })
45        .onClick(() => {
46          (getContext(this) as common.UIAbilityContext).terminateSelf();
47        })
48
49      BottomButton({
50        description: $r('app.string.byodAgree'),
51        buttonWidth: '158vp',
52        isEnabled: true
53      })
54        .onClick(() => {
55          AlertDialog.show(
56            {
57              title: $r('app.string.canNotActivate'),
58              message: $r('app.string.doNotSupport'),
59              autoCancel: true,
60              alignment: DialogAlignment.Center,
61              gridCount: 4,
62              confirm: {
63                value: $r('app.string.gotIt'),
64                action: () => {
65                  (getContext(this) as common.UIAbilityContext).terminateSelf();
66                }
67              },
68              cancel: () => {
69                console.info('Closed callbacks')
70              }
71            }
72          )
73        })
74    }
75  }
76
77  build() {
78    Column() {
79      BaseByodAdminPage({
80        topBuilderParam: () => {
81          this.topBuilder()
82        },
83        listTitle: '',
84        centerBuilderParam: () => {
85          this.centerBuilder()
86        },
87        bottomBuilderParam: () => {
88          this.bottomBuilder()
89        }
90      })
91    }
92  }
93}
94