• 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 '../../common/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                .width(Constants.HEADER_TEXT_WIDTH)
44                .align(Alignment.Start)
45            }
46            .width(Constants.HEADER_COLUMN_WIDTH)
47            .height(Constants.HEADER_COLUMN_HEIGHT)
48            .padding({
49              left: Constants.HEADER_COLUMN_PADDING_LEFT,
50              right: Constants.HEADER_COLUMN_PADDING_RIGHT
51            })
52            Column() {
53              LoadingProgress()
54                .color($r('sys.color.ohos_id_color_progress'))
55                .height(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
56                .width(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
57              Text(this.loadingText())
58                .fontSize($r('sys.float.ohos_id_text_size_body2'))
59                .fontColor($r('sys.color.ohos_id_color_text_secondary'))
60            }
61            .height(Constants.ENCRYPTION_LOADING_CONTENT_HEIGHT)
62            .alignItems(HorizontalAlign.Center)
63            .justifyContent(FlexAlign.Center)
64          }
65          .width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
66          .height(Constants.ENCRYPTION_LOADING_HEIGHT)
67          .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
68          .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
69          .constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH })
70        }
71      }
72    }
73  }
74}
75
76export { EncryptingPanel };
77