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