• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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 display from '@ohos.display'
16import router from '@ohos.router';
17import { ShowInfo } from '../common/ShowInfo'
18import Logger from '../common/Logger'
19
20const TAG: string = '[ScreenDetector]'
21
22let scrInfo:display.Display = router.getParams()['scrInfo'];
23
24@Entry
25@Component
26struct ScreenInfo {
27  aboutToAppear() {
28    Logger.info(TAG, `ScreenInfo = ${JSON.stringify(scrInfo)}`)
29  }
30  /**
31   * In low-code mode, do not add anything to the build function, as it will be
32   * overwritten by the content generated by the .visual file in the build phase.
33   */
34  build() {
35    Column() {
36      Row() {
37        Text($r('app.string.entry_ScreenInfo'))
38          .fontSize(20)
39          .fontColor(Color.White)
40          .textAlign(TextAlign.Center)
41      }
42      .height('6%')
43      .width('100%')
44      .padding({ left: 15 })
45      .backgroundColor('#0D9FFB')
46      .constraintSize({ minHeight: 50 })
47
48      ShowInfo({
49        infoDetail: scrInfo
50      })
51    }
52    .width('100%')
53    .height('100%')
54    .backgroundColor('#F1F1F1')
55  }
56}