• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Fujian Newland Auto-ID Tech.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 { ListModel } from '../model/ListModel'
17import { DeviceUtil } from '../util/DeviceUtil'
18import { RadiusColumn } from '../components/RadiusColumn'
19import { getString } from '@ohos/common/src/main/ets/util/ResourceUtil';
20
21@Extend(Text) function fancy() {
22  .textAlign(TextAlign.Start)
23  .fontColor($r('sys.color.ohos_id_color_text_primary'))
24  .fontSize($r('sys.float.ohos_id_text_size_sub_title2'))
25  .fontWeight(FontWeight.Regular)
26};
27
28@Extend(Text) function fancyRight() {
29  .textAlign(TextAlign.End)
30  .fontColor($r('app.color.battery_info_value_text'))
31  .fontSize($r('sys.float.ohos_id_text_size_sub_title3'))
32};
33
34@Component
35export struct DeviceInfo {
36  @State table: ListModel[] = [
37    new ListModel(getString($r('app.string.device_type')), DeviceUtil.deviceType),
38    new ListModel(getString($r('app.string.manufacture')), DeviceUtil.manufacture),
39    new ListModel(getString($r('app.string.brand')), DeviceUtil.brand),
40    new ListModel(getString($r('app.string.marker_name')), DeviceUtil.markerName),
41    new ListModel(getString($r('app.string.product_series')), DeviceUtil.productSeries),
42    new ListModel(getString($r('app.string.product_model')), DeviceUtil.productModel),
43    new ListModel(getString($r('app.string.software_model')), DeviceUtil.softwareModel),
44    new ListModel(getString($r('app.string.hardware_model')), DeviceUtil.hardwareModel),
45    new ListModel(getString($r('app.string.hardware_profile')), DeviceUtil.hardwareProfile),
46    new ListModel(getString($r('app.string.serial')), DeviceUtil.serial),
47    new ListModel(getString($r('app.string.bootloader_version')), DeviceUtil.bootloaderVersion),
48    new ListModel(getString($r('app.string.abi_list')), DeviceUtil.abiList),
49    new ListModel(getString($r('app.string.security_patch_tag')), DeviceUtil.securityPatchTag),
50    new ListModel(getString($r('app.string.display_version')), DeviceUtil.displayVersion),
51    new ListModel(getString($r('app.string.incremental_version')), DeviceUtil.incrementalVersion),
52    new ListModel(getString($r('app.string.os_release_type')), DeviceUtil.osReleaseType),
53    new ListModel(getString($r('app.string.os_full_name')), DeviceUtil.osFullName),
54    new ListModel(getString($r('app.string.major_version')), DeviceUtil.majorVersion),
55    new ListModel(getString($r('app.string.senior_version')), DeviceUtil.seniorVersion),
56    new ListModel(getString($r('app.string.featureVersion')), DeviceUtil.featureVersion),
57    new ListModel(getString($r('app.string.build_version')), DeviceUtil.buildVersion),
58    new ListModel(getString($r('app.string.sdk_api_version')), DeviceUtil.sdkApiVersion),
59    new ListModel(getString($r('app.string.first_api_version')), DeviceUtil.firstApiVersion),
60    new ListModel(getString($r('app.string.version_id')), DeviceUtil.versionId),
61    new ListModel(getString($r('app.string.build_type')), DeviceUtil.buildType),
62    new ListModel(getString($r('app.string.build_user')), DeviceUtil.buildUser),
63    new ListModel(getString($r('app.string.build_host')), DeviceUtil.buildHost),
64    new ListModel(getString($r('app.string.build_time')), DeviceUtil.buildTime),
65    new ListModel(getString($r('app.string.build_root_hash')), DeviceUtil.buildRootHash),
66    new ListModel(getString($r('app.string.udid')), DeviceUtil.udid)
67  ];
68
69  build() {
70    List() {
71      ForEach(this.table, (item: ListModel) => {
72        ListItem() {
73          RadiusColumn() {
74            Row() {
75              Text(item.title)
76                .fancy()
77                .width('30%')
78              Blank()
79              Text(item.getValue())
80                .fancyRight()
81                .width('67%')
82            }
83            .padding(px2vp(12))
84          }
85        }
86      })
87    }
88    .margin({ top: 12, bottom: 12 })
89    .width('100%')
90  }
91}