1/*
2 * Copyright (c) 2022-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 BackComponent from '../component/backComponent';
17import Log from '../utils/log';
18import CommonController from '../controller/commonController';
19import CommonUtil from '../utils/CommonUtil';
20
21@Extend(Text) function setTitleFormat() {
22  .fontColor($r('sys.color.ohos_id_color_text_primary'))
23  .fontSize($r('sys.float.ohos_id_text_size_body1'))
24  .fontWeight(FontWeight.Medium)
25}
26
27@Extend(Text) function setContentFormat() {
28  .fontColor($r('sys.color.ohos_id_color_text_primary'))
29  .fontSize($r('sys.float.ohos_id_text_size_body1'))
30  .fontWeight(FontWeight.Regular)
31}
32
33@Extend(Span) function setSpanFormat() {
34  .fontColor($r('sys.color.ohos_id_color_text_primary'))
35  .fontSize($r('sys.float.ohos_id_text_size_body1'))
36  .fontWeight(FontWeight.Regular)
37}
38
39@Entry
40@Component
41export default struct EnrollDeclare {
42  private pattern: string = '2D';
43  private readonly TAG: string = 'EnrollDeclare';
44  @StorageLink('CONTENT_TYPE_WIDTH') CONTENT_TYPE_WIDTH: number = 0;
45  private scrollBarColor: string;
46
47  aboutToAppear() {
48    let scrollBarColor = CommonUtil.getColor(getContext(this), $r('sys.color.ohos_id_color_foreground_transparent'));
49    scrollBarColor = CommonUtil.setColorOpacity(scrollBarColor, 0.4);
50    this.scrollBarColor = scrollBarColor;
51  }
52
53  build() {
54    Column() {
55      BackComponent({ prevTag: this.TAG, title: $r('app.string.face_guide_2d_announce_link') })
56
57      Column() {
58        Scroll() {
59          Column() {
60            Column() {
61              Column() {
62                Text($r('app.string.face_feature_desc'))
63                  .setTitleFormat()
64                  .margin({ bottom: '16vp' })
65                Text($r('app.string.face_recognize_announce_message_01'))
66                  .setContentFormat()
67                  .margin({ bottom: '24vp' })
68                Text($r('app.string.face_recognize_announce_message_02'))
69                  .setTitleFormat()
70                  .margin({ bottom: '16vp' })
71                Text($r('app.string.face_recognize_announce_message_03'))
72                  .setContentFormat()
73                  .margin({ bottom: '8vp' })
74                Text($r('app.string.face_recognize_announce_message_04'))
75                  .setContentFormat()
76                  .margin({ bottom: '8vp' })
77                Text($r('app.string.face_recognize_announce_message_05'))
78                  .setContentFormat()
79                  .margin({ bottom: '8vp' })
80                Text($r('app.string.face_recognize_announce_message_06'))
81                  .setContentFormat()
82                  .margin({ bottom: '8vp' })
83                Text($r('app.string.face_recognize_announce_message_07'))
84                  .setContentFormat()
85                  .margin({ bottom: '24vp' })
86                Text($r('app.string.face_recognize_announce_message_08'))
87                  .setTitleFormat()
88                  .margin({ bottom: '16vp' })
89                Text($r('app.string.face_recognize_announce_message_09'))
90                  .setContentFormat()
91                  .margin({ bottom: '8vp' })
92                Text($r('app.string.face_announce_tip1_item2_3d'))
93                  .setContentFormat()
94                  .margin({ bottom: '8vp' })
95                Text($r('app.string.face_recognize_announce_message_10'))
96                  .setContentFormat()
97                  .margin({ bottom: '8vp' })
98                Text($r('app.string.face_recognize_announce_message_11'))
99                  .setContentFormat()
100                  .margin({ bottom: '8vp' })
101                Text($r('app.string.face_recognize_announce_message_12'))
102                  .setContentFormat()
103                  .margin({ bottom: '24vp' })
104                Text($r('app.string.face_recognize_announce_message_13'))
105                  .setTitleFormat()
106                  .margin({ bottom: '16vp' })
107                Text() {
108                  Span($r('app.string.face_recognize_announce_message_14_1'))
109                    .setSpanFormat()
110                  Span($r('app.string.face_recognize_announce_message_14_3'))
111                    .setSpanFormat()
112                    .fontWeight(FontWeight.Bold)
113                  Span($r('app.string.face_recognize_announce_message_14_2'))
114                    .setSpanFormat()
115                }
116              }
117              .alignItems(HorizontalAlign.Start)
118              .margin({ left: '24vp', right: '24vp' })
119            }
120            .width(this.CONTENT_TYPE_WIDTH)
121          }
122          .margin({ top: '24vp' })
123          .width('100%')
124        }
125        .scrollBarColor(this.scrollBarColor)
126        .scrollBarWidth('5vp')
127        .margin({ right: '12vp', bottom: '24vp' })
128      }
129      .width('100%')
130      .height('100%')
131      .flexShrink(1)
132    }
133    .width('100%')
134    .height('100%')
135    .backgroundColor($r('sys.color.ohos_id_color_sub_background'))
136  }
137
138  onBackPress(): boolean {
139    Log.info(this.TAG, 'onBackPress+');
140    CommonController.routeBack();
141    Log.info(this.TAG, 'onBackPress-');
142    return true;
143  }
144}