• 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 Constants from '../constant';
17
18@Component
19struct EncryptingPanel {
20  @Link processing: boolean;
21  @Prop loadingType: number = 0;
22
23  loadingText() {
24    if (this.loadingType === Constants.LOAD_TYPE_CE) {
25      return $r('app.string.loading_title');
26    } else {
27      return $r('app.string.encryption_loading_title');
28    }
29  }
30
31  build() {
32    if (this.processing) {
33      Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center,
34        direction: FlexDirection.Column }) {
35        Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
36          Column() {
37            Row() {
38              Text($r('app.string.header_title'))
39                .fontWeight(FontWeight.Bold)
40                .fontFamily($r('app.string.typeface'))
41                .fontColor($r('sys.color.ohos_id_color_text_primary'))
42                .fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
43                .lineHeight(Constants.HEADER_TEXT_LINE_HEIGHT)
44                .width(Constants.HEADER_TEXT_WIDTH)
45                .align(Alignment.Start)
46            }
47            .width(Constants.HEADER_COLUMN_WIDTH)
48            .height(Constants.HEADER_COLUMN_HEIGHT)
49            .padding({
50              left: Constants.HEADER_COLUMN_PADDING_LEFT,
51              right: Constants.HEADER_COLUMN_PADDING_RIGHT
52            })
53            Column() {
54              LoadingProgress()
55                .color($r('sys.color.ohos_id_color_progress'))
56                .height(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
57                .width(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
58              Text(this.loadingText())
59                .fontSize($r('sys.float.ohos_id_text_size_body2'))
60                .fontColor($r('sys.color.ohos_id_color_text_secondary'))
61            }
62            .height(Constants.ENCRYPTION_LOADING_CONTENT_HEIGHT)
63            .alignItems(HorizontalAlign.Center)
64            .justifyContent(FlexAlign.Center)
65          }
66          .width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
67          .height(Constants.ENCRYPTION_LOADING_HEIGHT)
68          .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
69          .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
70          .constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH })
71        }
72      }
73    }
74  }
75}
76
77export { EncryptingPanel };
78