update OpenHarmony 2.0 Canary
15
.gitattributes
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.trp filter=lfs diff=lfs merge=lfs -text
|
||||
*.apk filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.asm filter=lfs diff=lfs merge=lfs -text
|
||||
*.8svn filter=lfs diff=lfs merge=lfs -text
|
||||
*.9svn filter=lfs diff=lfs merge=lfs -text
|
||||
*.dylib filter=lfs diff=lfs merge=lfs -text
|
||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
*.so filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
176
LICENSE
Executable file
@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
36
README.en.md
@ -1,36 +0,0 @@
|
||||
# applications_settings
|
||||
|
||||
#### Description
|
||||
Settings system app | 系统设置应用
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
50
README.md
Normal file → Executable file
@ -1,37 +1,37 @@
|
||||
# applications_settings
|
||||
# Settings<a name="EN-US_TOPIC_0000001103421572"></a>
|
||||
|
||||
#### 介绍
|
||||
Settings system app | 系统设置应用
|
||||
- [Introduction](#section11660541593)
|
||||
- [Architecture](#section48896451454)
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
- [Directory Structure](#section161941989596)
|
||||
- [Repositories Involved](#section1371113476307)
|
||||
|
||||
## Introduction<a name="section11660541593"></a>
|
||||
|
||||
#### 安装教程
|
||||
Settings is a system app preinstalled in OpenHarmony to provide an interactive UI for users to set system attributes, such as the system time and screen brightness.
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
### Architecture<a name="section48896451454"></a>
|
||||
|
||||
#### 使用说明
|
||||
![](figures/en-us_image_0000001153225717.png)
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
## Directory Structure<a name="section161941989596"></a>
|
||||
|
||||
#### 参与贡献
|
||||
```
|
||||
/applications/standard/settings
|
||||
├── figures # Architecture figures
|
||||
├── entry # Main entry module code
|
||||
│ ├── src
|
||||
│ ├── main
|
||||
│ └── js # JavaScript code
|
||||
│ └── resources # Resources
|
||||
│ └── config.json # Global configuration files
|
||||
├── signature # Certificate files
|
||||
├── LICENSE # License files
|
||||
```
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
## Repositories Involved<a name="section1371113476307"></a>
|
||||
|
||||
System apps
|
||||
|
||||
#### 特技
|
||||
**applications\_standard\_settings**
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
37
README_zh.md
Executable file
@ -0,0 +1,37 @@
|
||||
# Settings<a name="ZH-CN_TOPIC_0000001103421572"></a>
|
||||
|
||||
- [简介](#section11660541593)
|
||||
- [架构图](#section48896451454)
|
||||
|
||||
- [目录](#section161941989596)
|
||||
- [相关仓](#section1371113476307)
|
||||
|
||||
## 简介<a name="section11660541593"></a>
|
||||
|
||||
设置应用是OpenHarmony系统中预置的系统应用,为用户提供设置系统属性的交互界面,例如设置系统时间,屏幕亮度等系统属性。
|
||||
|
||||
### 架构图<a name="section48896451454"></a>
|
||||
|
||||
![](figures/zh-cn_image_0000001153225717.png)
|
||||
|
||||
## 目录<a name="section161941989596"></a>
|
||||
|
||||
```
|
||||
/applications/standard/settings
|
||||
├── figures # 架构图目录
|
||||
├── entry # 主entry模块目录
|
||||
│ ├── src
|
||||
│ ├── main
|
||||
│ └── js # js代码目录
|
||||
│ └── resources # 资源存放目录
|
||||
│ └── config.json # 全局配置文件
|
||||
├── signature # 证书文件目录
|
||||
├── LICENSE # 许可文件
|
||||
```
|
||||
|
||||
## 相关仓<a name="section1371113476307"></a>
|
||||
|
||||
系统应用
|
||||
|
||||
**applications\_standard\_settings**
|
||||
|
42
build.gradle
Executable file
@ -0,0 +1,42 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
apply plugin: 'com.huawei.ohos.app'
|
||||
|
||||
ohos {
|
||||
compileSdkVersion 6
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 6
|
||||
}
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
}
|
||||
maven {
|
||||
url 'https://mirrors.huaweicloud.com/repository/maven/'
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.huawei.ohos:hap:2.4.4.3-RC'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
}
|
||||
maven {
|
||||
url 'https://mirrors.huaweicloud.com/repository/maven/'
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
}
|
11
entry/build.gradle
Executable file
@ -0,0 +1,11 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
ohos {
|
||||
compileSdkVersion 6
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 6
|
||||
}
|
||||
supportSystem "standard"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
1
entry/package.json
Executable file
@ -0,0 +1 @@
|
||||
{}
|
65
entry/src/main/config.json
Executable file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.settings",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1,
|
||||
"name": "1.0"
|
||||
},
|
||||
"apiVersion": {
|
||||
"compatible": 3,
|
||||
"target": 3
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.settings",
|
||||
"name": ".MyApplication",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "entry",
|
||||
"moduleType": "entry"
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "com.ohos.settings.MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:app_name",
|
||||
"type": "page",
|
||||
"launchType": "standard"
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"pages": [
|
||||
"pages/settingList/settingList",
|
||||
"pages/dateAndTime/dateAndTime",
|
||||
"pages/brightness/brightnessSettings",
|
||||
"pages/searchInfo/searchInfo",
|
||||
"pages/appManagement/appManagement",
|
||||
"pages/aboutDevice/aboutDevice",
|
||||
"pages/applicationInfo/applicationInfo"
|
||||
],
|
||||
"name": "default",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
23
entry/src/main/js/default/app.js
Executable file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('AceApplication onCreate');
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('AceApplication onDestroy');
|
||||
}
|
||||
};
|
||||
|
150
entry/src/main/js/default/common/baseUtil/DateAndTimeUtil.js
Executable file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const twelve = 12;
|
||||
/**
|
||||
* date package tool class
|
||||
*/
|
||||
export default class DateAndTimeUtil{
|
||||
constructor() {
|
||||
console.log('DateAndTimeUtil constructor start globalThis.$globalT:'+globalThis.$globalT);
|
||||
if (globalThis.$globalT) {
|
||||
this.monday = globalThis.$globalT('strings.monday');
|
||||
this.tuesday = globalThis.$globalT('strings.tuesday');
|
||||
this.wednesday = globalThis.$globalT('strings.wednesday');
|
||||
this.thursday = globalThis.$globalT('strings.thursday');
|
||||
this.friday = globalThis.$globalT('strings.friday');
|
||||
this.saturday = globalThis.$globalT('strings.saturday');
|
||||
this.sunday = globalThis.$globalT('strings.sunday');
|
||||
this.morning = globalThis.$globalT('strings.morning');
|
||||
this.afternoon = globalThis.$globalT('strings.afternoon');
|
||||
this.year = globalThis.$globalT('strings.year');
|
||||
this.month = globalThis.$globalT('strings.month');
|
||||
this.day = globalThis.$globalT('strings.day');
|
||||
console.log('DateAndTimeUtil constructor this.monday:' + this.monday);
|
||||
}
|
||||
console.log('DateAndTimeUtil constructor end');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Get the current time
|
||||
*/
|
||||
now() {
|
||||
const datetime = new Date();
|
||||
const hours = datetime.getHours();
|
||||
const minutes = datetime.getMinutes();
|
||||
return this.concatTime(hours, minutes);
|
||||
};
|
||||
/**
|
||||
* format
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
fill(value) {
|
||||
return (value > 9 ? "" : "0") + value;
|
||||
};
|
||||
/**
|
||||
* concat date
|
||||
* @param year m d
|
||||
* @return
|
||||
*/
|
||||
concatDate(year, month, date) {
|
||||
return year + this.year + month + this.month + date + this.day;
|
||||
};
|
||||
|
||||
concatTime(hours, minutes) {
|
||||
return `${this.fill(hours)}:${this.fill(minutes)}`;
|
||||
};
|
||||
/**
|
||||
* Turn to 24-hour clock
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
transform24(str) {
|
||||
const timeFlag = str.substr(0, 2);
|
||||
if (timeFlag == this.morning) {
|
||||
const h = str.substr(2).split(":")[0];
|
||||
if (h == twelve) {
|
||||
const time = "0" + ":" + str.substr(2).split(":")[1];
|
||||
return time;
|
||||
} else {
|
||||
return h + ":" + str.substr(2).split(":")[1];
|
||||
}
|
||||
} else {
|
||||
const h = str.substr(2).split(":")[0];
|
||||
const h1 = parseInt(h) + twelve;
|
||||
if (h != twelve) {
|
||||
const time = h1 + ":" + str.substr(2).split(":")[1];
|
||||
return time;
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Turn to 12-hour clock
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
transform12(str) {
|
||||
const hours = str.substring(0, str.indexOf(":"));
|
||||
const minutes = str.split(":")[1];
|
||||
if (hours < twelve) {
|
||||
return this.morning.concat(`${hours}:${minutes}`);
|
||||
}
|
||||
if (hours == twelve) {
|
||||
return this.afternoon.concat(`${hours}:${minutes}`);
|
||||
} else {
|
||||
const reduceHours = parseInt(hours) - twelve;
|
||||
return this.afternoon.concat(`${reduceHours}:${minutes}`);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Calculate the week base on date
|
||||
* @param y
|
||||
* @param m
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
convert(y, m, d) {
|
||||
if (!globalThis.$globalT) {
|
||||
return;
|
||||
}
|
||||
const week = (d + 2 * m + parseInt(3 * (m + 1) / 5) + y + parseInt(y / 4)
|
||||
- parseInt(y / 100) + parseInt(y / 400)) % 7;
|
||||
switch (week) {
|
||||
case 0:
|
||||
return this.monday;
|
||||
break;
|
||||
case 1:
|
||||
return this.tuesday;
|
||||
break;
|
||||
case 2:
|
||||
return this.wednesday;
|
||||
break;
|
||||
case 3:
|
||||
return this.thursday;
|
||||
break;
|
||||
case 4:
|
||||
return this.friday;
|
||||
break;
|
||||
case 5:
|
||||
return this.saturday;
|
||||
break;
|
||||
case 6:
|
||||
return this.sunday;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
71
entry/src/main/js/default/common/baseUtil/LogUtil.js
Executable file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../../model/BaseModel.js';
|
||||
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
var LOG_LEVEL = {
|
||||
/**
|
||||
* debug
|
||||
*/
|
||||
DEBUG: 'debug',
|
||||
|
||||
/**
|
||||
* log
|
||||
*/
|
||||
LOG: 'log',
|
||||
|
||||
/**
|
||||
* info
|
||||
*/
|
||||
INFO: 'info',
|
||||
|
||||
/**
|
||||
* warn
|
||||
*/
|
||||
WARN: 'warn',
|
||||
|
||||
/**
|
||||
* error
|
||||
*/
|
||||
ERROR: 'error'
|
||||
};
|
||||
|
||||
/**
|
||||
* log package tool class
|
||||
*/
|
||||
export default class LogUtil extends BaseModel {
|
||||
debug(msg) {
|
||||
console.info(msg);
|
||||
}
|
||||
|
||||
log(msg) {
|
||||
console.log(msg);
|
||||
|
||||
}
|
||||
|
||||
info(msg) {
|
||||
console.info(msg);
|
||||
}
|
||||
|
||||
warn(msg) {
|
||||
console.warn(msg);
|
||||
}
|
||||
|
||||
error(msg) {
|
||||
console.error(msg);
|
||||
}
|
||||
}
|
66
entry/src/main/js/default/i18n/en-US.json
Executable file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"strings": {
|
||||
"enable": "ENABLE",
|
||||
"enabled": "Enabled",
|
||||
"disable": "DISABLE",
|
||||
"disabled": "Disabled",
|
||||
"restore": "RESTORE",
|
||||
"on": "On",
|
||||
"off": "Off",
|
||||
"ok": "OK",
|
||||
"setting": "Settings",
|
||||
"search": "Search",
|
||||
"buttonValue1Right": ">",
|
||||
"buttonValue1Left": "<",
|
||||
"buttonValue2Left": "⇦",
|
||||
"more-wifi-settings": "More Wifi Settings",
|
||||
"wifi-list": "Wifi-List which can be used",
|
||||
"autoset": "Autoset",
|
||||
"autoset-require": "date、time and time zone",
|
||||
"date": "Date",
|
||||
"time": "Time",
|
||||
"time-zone": "Time Zone",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"brightnessMode": "brightnessMode",
|
||||
"settings": "Settings",
|
||||
"wifiTab": "wifiTab",
|
||||
"brightnessTab": "brightnessTab",
|
||||
"applyTab": "applyTab",
|
||||
"dateAndTimeTab": "dateAndTimeTab",
|
||||
"aboutTab": "aboutTab",
|
||||
"applicationInfo": "App info",
|
||||
"appManagement": "Apps",
|
||||
"24Hour": "24 Hour",
|
||||
"deviceId": "DeviceId",
|
||||
"companyInfo": "CompanyInfo",
|
||||
"hardwareVersion": "HardwareVersion",
|
||||
"systemName": "SystemName",
|
||||
"softwareVersion": "SoftwareVersion",
|
||||
"adjust": "Automatic adjustment",
|
||||
"model": "Model",
|
||||
"brand": "Brand",
|
||||
"manufacturer": "Manufacturer",
|
||||
"wifi": "WIFI",
|
||||
"version": "version",
|
||||
"monday": "Monday",
|
||||
"tuesday": "Tuesday",
|
||||
"wednesday": "Wednesday",
|
||||
"thursday": "Thursday",
|
||||
"friday": "Friday",
|
||||
"saturday": "Saturday",
|
||||
"sunday": "Sunday",
|
||||
"year": "year",
|
||||
"month": "month",
|
||||
"day": "date",
|
||||
"morning": "morning",
|
||||
"afternoon": "afternoon"
|
||||
},
|
||||
"png": {
|
||||
"info": {
|
||||
"back": "/res/image/ic_back.png"
|
||||
},
|
||||
"new": {
|
||||
}
|
||||
}
|
||||
}
|
72
entry/src/main/js/default/i18n/zh-CN.json
Executable file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"strings": {
|
||||
"enable": "开启",
|
||||
"enabled": "已开启",
|
||||
"disable": "关闭",
|
||||
"disabled": "已关闭",
|
||||
"restore": "还原",
|
||||
"on": "开启",
|
||||
"off": "关闭",
|
||||
"ok": "确定",
|
||||
"setting": "设置",
|
||||
"search": "搜索",
|
||||
"buttonValue1Right": ">",
|
||||
"buttonValue1Left": "<",
|
||||
"buttonValue2Left": "⇦",
|
||||
"more-wifi-settings": "更多WIFI设置",
|
||||
"tips-content": "为提高位置信息的精确度,应用和服务仍然会扫描WIFI网络.您可以在提高精确度中更改此设置",
|
||||
"wifi-list": "可用WIFI列表",
|
||||
"wifi-advanced-options": "显示高级选项",
|
||||
"wifi-pass-details": "请至少输入8个字符",
|
||||
"wifi-link": "连接",
|
||||
"autoset": "自动设置",
|
||||
"autoset-require": "日期、时间和时区",
|
||||
"date": "日期",
|
||||
"time": "时间",
|
||||
"time-zone": "时区",
|
||||
"location-service": "打开定位服务,自动定位所在时区",
|
||||
"cancel": "取消",
|
||||
"confirm": "确定",
|
||||
"brightnessMode": "自动调节",
|
||||
"settings": "设置",
|
||||
"wifiTab": "WIFI",
|
||||
"brightnessTab": "亮度",
|
||||
"applyTab": "应用",
|
||||
"dateAndTimeTab": "日期和时间",
|
||||
"aboutTab": "关于手机",
|
||||
"wifi-pass": "密码",
|
||||
"displayMode": "显示模式",
|
||||
"applicationInfo": "应用信息",
|
||||
"appManagement": "应用管理",
|
||||
"24Hour": "24小时制",
|
||||
"deviceId": "设备ID",
|
||||
"companyInfo": "厂家信息",
|
||||
"hardwareVersion": "硬件版本",
|
||||
"systemName": "系统名称",
|
||||
"softwareVersion": "软件版本",
|
||||
"model": "型号",
|
||||
"brand": "品牌",
|
||||
"manufacturer": "生产商",
|
||||
"wifi": "WIFI",
|
||||
"version": "版本 ",
|
||||
"monday": "星期一",
|
||||
"tuesday": "星期二",
|
||||
"wednesday": "星期三",
|
||||
"thursday": "星期四",
|
||||
"friday": "星期五",
|
||||
"saturday": "星期六",
|
||||
"sunday": "星期日",
|
||||
"year": "年",
|
||||
"month": "月",
|
||||
"day": "日",
|
||||
"morning": "上午",
|
||||
"afternoon": "下午"
|
||||
},
|
||||
"png": {
|
||||
"info": {
|
||||
"back": "/res/image/ic_back.png"
|
||||
},
|
||||
"new": {
|
||||
}
|
||||
}
|
||||
}
|
19
entry/src/main/js/default/model/BaseModel.js
Executable file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class BaseModel {
|
||||
constructor() {
|
||||
}
|
||||
}
|
30
entry/src/main/js/default/model/aboutDeviceImpl/AboutDeviceModel.js
Executable file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../BaseModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
import deviceInfo from '@ohos.deviceinfo';
|
||||
|
||||
let logUtil = new LogUtil();
|
||||
/**
|
||||
* about device service class
|
||||
*/
|
||||
export default class AboutDeviceModel extends BaseModel {
|
||||
setOnAboutDeviceListener(callback) {
|
||||
logUtil.info('settings aboutDevice get deviceInfo start:');
|
||||
this.text = deviceInfo.productModel;
|
||||
logUtil.info('settings aboutDevice get deviceInfo:' + JSON.stringify(deviceInfo));
|
||||
callback(deviceInfo);
|
||||
}
|
||||
}
|
140
entry/src/main/js/default/model/appManagementImpl/AppManagementModel.js
Executable file
@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../BaseModel.js';
|
||||
import bundle from '@ohos.bundle_mgr';
|
||||
import resmgr from '@ohos.resmgr';
|
||||
|
||||
const index = 0;
|
||||
/**
|
||||
* app management service class
|
||||
*
|
||||
*/
|
||||
var mBundleInfoList = [];
|
||||
|
||||
export default class AppManagementModel extends BaseModel {
|
||||
setAppManagementListener(callback) {
|
||||
console.info('setting appManagement init AppManagementModel setAppManagementListener start')
|
||||
bundle.getApplicationInfos().then((data) => {
|
||||
console.log('setting appManagement init AppManagementModel setAppManagementListener getApplicationInfos() data.length: ' + data.length);
|
||||
for (var i = 0;i < data.length; i++) {
|
||||
console.log('setting appManagement init AppManagementModel setAppManagementListener getApplicationInfos() data[i].iconId:' + data[i].bundleName + '|data[i].iconId:' + data[i].iconId + '|data[i].labelId:' + data[i].labelId);
|
||||
}
|
||||
var dataArray = data;
|
||||
console.log('setting appManagement init AppManagementModel setAppManagementListener getApplicationInfos() dataArray' + JSON.stringify(dataArray));
|
||||
this.getIcon(dataArray, callback);
|
||||
});
|
||||
console.info('setting appManagement init AppManagementModel setAppManagementListener end')
|
||||
}
|
||||
|
||||
getIcon(data, callback) {
|
||||
console.info('setting appManagement init AppManagementModel getIcon start')
|
||||
this.getIconItem(index, data.length, data, callback);
|
||||
console.info('setting appManagement init AppManagementModel getIcon end')
|
||||
}
|
||||
|
||||
/**
|
||||
* get app icon and item
|
||||
* @param index
|
||||
* @param count
|
||||
* @param data
|
||||
* @param callback
|
||||
* @return
|
||||
*/
|
||||
getIconItem(index, count, data, callback) {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem start data.length' + data.length)
|
||||
let imageValue = '';
|
||||
let label = '';
|
||||
let that = this;
|
||||
resmgr.getResourceManager(data[index].bundleName, (error, item) => {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager start item' + JSON.stringify(item))
|
||||
if (data[index].labelId > 0) {
|
||||
item.getString(data[index].labelId, (error, value) => {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() value.length:' + value.length)
|
||||
if (value != null) {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() value:' + value)
|
||||
label = value;
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() label:' + label)
|
||||
} else {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() error:' + error)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() data[index].label:' + data[index].label)
|
||||
label = data[index].label;
|
||||
}
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getString() finish label:' + label)
|
||||
item.getMediaBase64(data[index].iconId, (error, value) => {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getMediaBase64() value.length:' + value.length)
|
||||
if (value.length > 0) {
|
||||
imageValue = value;
|
||||
} else {
|
||||
}
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getMediaBase64() end')
|
||||
mBundleInfoList.push({
|
||||
settingIcon: imageValue,
|
||||
settingTitle: label,
|
||||
settingValue: '',
|
||||
settingArrow: '/res/image/ic_settings_arrow.png',
|
||||
settingDefaultValue: false,
|
||||
settingSummary: '',
|
||||
dividerIsShow: true,
|
||||
settingType: 1,
|
||||
settingBundleName: data[index].bundleName,
|
||||
item: data[index],
|
||||
settingUri: 'pages/applicationInfo/applicationInfo'
|
||||
})
|
||||
if (count - 1 > index) {
|
||||
setTimeout(function () {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getMediaBase64() if index:' + index + '|count:' + count)
|
||||
index = index + 1;
|
||||
that.getIconItem(index, count, data, callback);
|
||||
}, 100);
|
||||
} else {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getResourceManager getMediaBase64() else index:' + index + '|count:' + count)
|
||||
that.getBundleInfo(0, mBundleInfoList.length, mBundleInfoList, callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
console.info('setting appManagement init AppManagementModel getIconItem end')
|
||||
}
|
||||
/**
|
||||
* getBundleInfo
|
||||
* @param index
|
||||
* @param count
|
||||
* @param mBundleInfoList
|
||||
* @param callback
|
||||
* @return
|
||||
*/
|
||||
getBundleInfo(index, count, mBundleInfoList, callback) {
|
||||
let that = this
|
||||
console.info('setting appManagement init AppManagementModel getBundleInfo start mBundleInfoList :' + mBundleInfoList.length+mBundleInfoList[index].settingBundleName)
|
||||
bundle.getBundleInfo(mBundleInfoList[index].settingBundleName).then(data => {
|
||||
console.info("setting appManagement init AppManagementModel getBundleInfo versionCode:" + data.versionCode + "|versionName:" + data.versionName);
|
||||
mBundleInfoList[index].settingSummary = data.versionName;
|
||||
console.info("setting appManagement init AppManagementModel getBundleInfo mBundleInfoList[index].settingSummary:" + mBundleInfoList[index].settingSummary);
|
||||
if (count - 1 > index) {
|
||||
setTimeout(function () {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getBundleInfo if index:' + index + '|count:' + count)
|
||||
index = index + 1;
|
||||
that.getBundleInfo(index, count, mBundleInfoList, callback);
|
||||
}, 100);
|
||||
} else {
|
||||
console.info('setting appManagement init AppManagementModel getIconItem getBundleInfo callback else index:' + index + '|count:' + count)
|
||||
callback(mBundleInfoList);
|
||||
}
|
||||
});
|
||||
console.info('setting appManagement init AppManagementModel getBundleInfo end' )
|
||||
}
|
||||
}
|
35
entry/src/main/js/default/model/baseParseConfImpl/BaseParseConfModel.js
Executable file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../BaseModel.js';
|
||||
import fileio from '@ohos.fileio';
|
||||
|
||||
export default class BaseParseConfModel extends BaseModel {
|
||||
getJsonData(fileName) {
|
||||
console.info('settings dateAndTime BaseParseConfModel getJsonData start')
|
||||
try {
|
||||
console.info('settings dateAndTime BaseParseConfModel getJsonDat start try');
|
||||
var ss = fileio.Stream.createStreamSync(fileName, "r")
|
||||
var buf = new ArrayBuffer(4096)
|
||||
var len = ss.readSync(buf)
|
||||
console.info('settings dateAndTime BaseParseConfModel getJsonData len' + JSON.stringify(len) + len);
|
||||
var content = String.fromCharCode.apply(null, new Uint8Array(buf));
|
||||
console.info('settings dateAndTime BaseParseConfModel getJsonData content:' + content);
|
||||
ss.closeSync();
|
||||
return JSON.parse(content);
|
||||
} catch (e) {
|
||||
console.info("settings dateAndTime BaseParseConfModel getJsonData catch e:" + e);
|
||||
}
|
||||
}
|
||||
}
|
45
entry/src/main/js/default/model/brightnessImpl/BrightnessSettingModel.js
Executable file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../BaseModel.js';
|
||||
import brightness from '@ohos.brightness';
|
||||
import storage from '@ohos.data.storage';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
|
||||
const PREFERENCES_PATH = '/data/accounts/account_0/appdata/com.ohos.settings/sharedPreference/SettingPreferences';
|
||||
var brightnessPreferences = storage.getStorageSync(PREFERENCES_PATH);
|
||||
let logUtil = new LogUtil();
|
||||
const BRIGHTNESS_SAVE_VALUE = 'BrightnessSaveValue';
|
||||
/**
|
||||
* brightness service class
|
||||
*/
|
||||
export default class BrightnessSettingModel extends BaseModel {
|
||||
setBrightnessListener(brightnessValue) {
|
||||
logUtil.log('setting setBrightnessListener BrightnessSettingModel start');
|
||||
brightness.setValue(brightnessValue);
|
||||
logUtil.log('setting setBrightnessListener BrightnessSettingModel end');
|
||||
}
|
||||
|
||||
setStorageValue(brightnessValue) {
|
||||
logUtil.log('setting setBrightnessListener setStorageListener start brightnessValue£º' + brightnessValue);
|
||||
brightnessPreferences.putSync(BRIGHTNESS_SAVE_VALUE, brightnessValue);
|
||||
brightnessPreferences.flushSync();
|
||||
logUtil.log('setting setBrightnessListener setStorageListener end');
|
||||
}
|
||||
|
||||
getStorageValue() {
|
||||
logUtil.log('setting setBrightnessListener getStorageValue start');
|
||||
return brightnessPreferences.getSync(BRIGHTNESS_SAVE_VALUE, 0);
|
||||
}
|
||||
}
|
32
entry/src/main/js/default/model/settingListImpl/SettingListModel.js
Executable file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseModel from '../BaseModel.js';
|
||||
import BaseParseConfModel from '../baseParseConfImpl/BaseParseConfModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
|
||||
/**
|
||||
* app setting homepage service class
|
||||
*/
|
||||
let baseParseConfModel = new BaseParseConfModel();
|
||||
let logUtil = new LogUtil();
|
||||
var settingList;
|
||||
|
||||
export default class SettingListModel extends BaseModel {
|
||||
setSettingListener(callback) {
|
||||
settingList = baseParseConfModel.getJsonData('/data/accounts/account_0/applications/com.ohos.settings/com.ohos.settings/assets/entry/resources/rawfile/settinglist.json');
|
||||
logUtil.info('settings settingList get by json:' + JSON.stringify(settingList));
|
||||
callback(settingList);
|
||||
}
|
||||
}
|
20
entry/src/main/js/default/pages/aboutDevice/aboutDevice.css
Executable file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
32
entry/src/main/js/default/pages/aboutDevice/aboutDevice.hml
Executable file
@ -0,0 +1,32 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='head-component' src='../component/headComponent/headComponent.hml' ></element>
|
||||
<element name = "entry-component" src = "../component/entryComponent/entryComponent.hml"></element>
|
||||
<div class="container">
|
||||
<head-component title-name="{{$t('strings.aboutTab')}}" back-icon="{{$t('png.info.back')}}" @back-type="aboutDeviceBack"></head-component>
|
||||
<!--List item-->
|
||||
<list >
|
||||
<list-item id="item" class="list-item-background-color" for="{{aboutDeviceList}}" clickeffect="false" >
|
||||
<entry-component item="{{$item.settingType==1?$item:''}}" icon="{{$item.settingIcon}}"
|
||||
icon-show="{{$item.settingIcon==''?false:true}}" summary="{{$item.settingSummary}}"
|
||||
title="{{$item.settingTitle}}" is-summary-show="{{$item.settingSummary==''?false:true}}"
|
||||
model-state-describe="{{$item.settingValue}}" divider-show="{{$item.settingShowDivider}}"
|
||||
state-description-show="{{$item.settingValue==''?false:true}}"
|
||||
entrance-to-item-icon="{{$item.settingArrow}}" entrance-to-item-show="{{$item.settingType==1}}"
|
||||
switches-is-show="{{$item.settingType==2}}" switch-default-value="{{$item.settingDefaultValue}}"
|
||||
switch-on-change-value="{{switchChangeValue}}"></entry-component>
|
||||
</list-item>
|
||||
</list>
|
||||
</div>
|
82
entry/src/main/js/default/pages/aboutDevice/aboutDevice.js
Executable file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import AboutDeviceModel from '../../model/aboutDeviceImpl/AboutDeviceModel.js';
|
||||
import BaseParseConfModel from '../../model/baseParseConfImpl/BaseParseConfModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
|
||||
let mAboutDeviceModel = new AboutDeviceModel();
|
||||
let baseParseConfModel = new BaseParseConfModel();
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
data: {
|
||||
aboutDeviceList: [],
|
||||
text: ''
|
||||
},
|
||||
onInit() {
|
||||
logUtil.info('aboutDevice onInit start:')
|
||||
this.aboutDeviceList = baseParseConfModel.getJsonData('/data/accounts/account_0/applications/com.ohos.settings/com.ohos.settings/assets/entry/resources/rawfile/aboutDevice.json');
|
||||
logUtil.info('settings aboutDevice get aboutDeviceList by json:' + JSON.stringify(this.aboutDeviceList))
|
||||
for (let key in this.aboutDeviceList) {
|
||||
var settingAlias = this.aboutDeviceList[key].settingAlias
|
||||
this.aboutDeviceList[key].settingTitle = this.$t('strings.'.concat(settingAlias))
|
||||
}
|
||||
mAboutDeviceModel.setOnAboutDeviceListener(this.aboutDevice);
|
||||
logUtil.info('aboutDevice onInit end:')
|
||||
},
|
||||
aboutDevice(data) {
|
||||
logUtil.info('aboutDeviceList start:' + JSON.stringify(data))
|
||||
for (let key in this.aboutDeviceList) {
|
||||
let value = this.aboutDeviceList[key]
|
||||
if ('model' == value.settingAlias) {
|
||||
value.settingValue = data.productModel;
|
||||
}
|
||||
if ('companyInfo' == value.settingAlias) {
|
||||
value.settingValue = data.manufacture;
|
||||
}
|
||||
if ('deviceId' == value.settingAlias) {
|
||||
value.settingValue = data.serial;
|
||||
}
|
||||
if ('softwareVersion' == value.settingAlias) {
|
||||
value.settingValue = data.displayVersion;
|
||||
}
|
||||
}
|
||||
},
|
||||
aboutDeviceBack() {
|
||||
logUtil.info('settings aboutDevice back start:')
|
||||
router.back();
|
||||
logUtil.info('settings aboutDevice back end:')
|
||||
},
|
||||
onBackPress() {
|
||||
logUtil.info('settings aboutDevice onBackPress:')
|
||||
router.back();
|
||||
},
|
||||
onCreate() {
|
||||
logUtil.info('setting aboutDevice onCreate')
|
||||
},
|
||||
onReady() {
|
||||
logUtil.info('setting aboutDevice onReady')
|
||||
},
|
||||
onShow() {
|
||||
logUtil.info('setting aboutDevice onShow')
|
||||
},
|
||||
onHide() {
|
||||
logUtil.info('setting aboutDevice onHide')
|
||||
},
|
||||
onDestroy() {
|
||||
logUtil.info('setting aboutDevice onDestroy')
|
||||
}
|
||||
}
|
31
entry/src/main/js/default/pages/appManagement/appManagement.css
Executable file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
|
||||
|
26
entry/src/main/js/default/pages/appManagement/appManagement.hml
Executable file
@ -0,0 +1,26 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='head-component' src='../component/headComponent/headComponent.hml'></element>
|
||||
<element name='settings-list-component' src='../component/settingsListComponent/settingsListComponent.hml'></element>
|
||||
<div class="container">
|
||||
<head-component title-name="{{$t('strings.appManagement')}}" back-icon="{{$t('png.info.back')}}" @back-type="appInfoBack"></head-component>
|
||||
<!-- search bar-->
|
||||
<div class="search" show="false">
|
||||
<search id="search" style="height: 60px;" hint="{{$t('strings.search')}}" focusable="false" value="{{inputSearchValue}}" ontouchstart="onClick"></search>
|
||||
</div>
|
||||
<!--List item-->
|
||||
<settings-list-component parent-data="{{appList}}"></settings-list-component>
|
||||
</div>
|
||||
|
85
entry/src/main/js/default/pages/appManagement/appManagement.js
Executable file
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import AppManagementModel from '../../model/appManagementImpl/AppManagementModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
import router from '@system.router';
|
||||
|
||||
const DATA_PAGE_SOURCE_APP_PAGE = 'appPage';
|
||||
let appManagementModel = new AppManagementModel();
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
data: {
|
||||
appList: [],
|
||||
},
|
||||
onInit() {
|
||||
logUtil.info('setting appManagement init start:')
|
||||
appManagementModel.setAppManagementListener(this.appListData)
|
||||
logUtil.info('setting appManagement init end:')
|
||||
},
|
||||
appListData(appListData) {
|
||||
if (null == appListData) {
|
||||
logUtil.info('setting appManagement appListData is null')
|
||||
return;
|
||||
}
|
||||
logUtil.info('setting appManagement appListData start:' + JSON.stringify(appListData.length))
|
||||
for(var i=0;i<appListData.length;i++){
|
||||
var settingSummary=appListData[i].settingSummary;
|
||||
appListData[i].settingSummary=this.$t('strings.version').concat(settingSummary);
|
||||
}
|
||||
this.appList = appListData;
|
||||
logUtil.info('setting appManagement appListData end')
|
||||
},
|
||||
/**
|
||||
* Jump to search page
|
||||
*/
|
||||
onClick() {
|
||||
logUtil.info('setting appManagement onClick start pages/searchInfo/searchInfo ')
|
||||
router.push({
|
||||
uri: 'pages/searchInfo/searchInfo',
|
||||
params: {
|
||||
appData: this.appList,
|
||||
type: DATA_PAGE_SOURCE_APP_PAGE
|
||||
}
|
||||
});
|
||||
logUtil.info('setting appManagement onClick end')
|
||||
},
|
||||
appInfoBack() {
|
||||
logUtil.info('setting appManagement appInfoBack start')
|
||||
router.back();
|
||||
logUtil.info('setting appManagement appInfoBack end')
|
||||
},
|
||||
onBackPress() {
|
||||
logUtil.info('setting appManagement onBackPress start')
|
||||
router.back();
|
||||
logUtil.info('setting appManagement onBackPress end')
|
||||
},
|
||||
onCreate() {
|
||||
logUtil.info('setting appManagement onCreate')
|
||||
},
|
||||
onReady() {
|
||||
logUtil.info('setting appManagement onReady')
|
||||
},
|
||||
onShow() {
|
||||
logUtil.info('setting appManagement onShow')
|
||||
},
|
||||
onHide() {
|
||||
logUtil.info('setting appManagement onHide')
|
||||
},
|
||||
onDestroy() {
|
||||
logUtil.info('setting appManagement onDestroy')
|
||||
}
|
||||
}
|
||||
|
62
entry/src/main/js/default/pages/applicationInfo/applicationInfo.css
Executable file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.preference {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
flex-direction: row;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
align-items: center;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.preference-title {
|
||||
width: 80%;
|
||||
flex-direction: column;
|
||||
weights: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.title-style {
|
||||
font-family: Courier;
|
||||
font-size: 22px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.text-style-empty {
|
||||
weights: 1;
|
||||
}
|
||||
|
||||
.text-style-version {
|
||||
font-size: 18px;
|
||||
margin-top: 1px;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.head-image-pin {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
justify-content: center;
|
||||
margin-right: 20px;
|
||||
align-items: center;
|
||||
}
|
27
entry/src/main/js/default/pages/applicationInfo/applicationInfo.hml
Executable file
@ -0,0 +1,27 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name = "head-component" src = "../component/headComponent/headComponent.hml"></element>
|
||||
<div class = "container">
|
||||
<head-component title-name = "{{ $t('strings.applicationInfo') }}" back-icon = "{{ $t('png.info.back') }}"
|
||||
@back-type = "appInfoBack">
|
||||
</head-component>
|
||||
<div class = "preference">
|
||||
<image class = "head-image-pin" src="{{ icon }}"></image>
|
||||
<div class = "preference-title">
|
||||
<text class = "title-style">{{ label }}</text>
|
||||
<text class = "text-style-version" show = "true">{{ settingSummary }}</text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
128
entry/src/main/js/default/pages/applicationInfo/applicationInfo.js
Executable file
@ -0,0 +1,128 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
import resmgr from '@ohos.resmgr';
|
||||
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
data: {
|
||||
appInfo: {},
|
||||
bundleName: '',
|
||||
icon: '',
|
||||
label: '',
|
||||
settingSummary: ''
|
||||
},
|
||||
onInit() {
|
||||
logUtil.info('setting applicationInfo onInit start:');
|
||||
this.appInfo = this.dataParam;
|
||||
logUtil.info('setting applicationInfo onInit appInfo:' + JSON.stringify(this.appInfo))
|
||||
this.bundleName = this.appInfo.item.bundleName;
|
||||
this.settingSummary = this.appInfo.settingSummary;
|
||||
this.getMediaResources(this.bundleName, this.appInfo.item.iconId);
|
||||
this.getStringResources(this.bundleName, this.appInfo.item.labelId);
|
||||
logUtil.info('setting applicationInfo onInit end:');
|
||||
},
|
||||
|
||||
/**
|
||||
* get app icon media by iconId
|
||||
* @param bundleName
|
||||
* @param iconId
|
||||
* @return
|
||||
*/
|
||||
getMediaResources(bundleName, iconId) {
|
||||
logUtil.info('setting applicationInfo getMediaResources start bundleName labelId' + bundleName + '|' + iconId)
|
||||
let that = this;
|
||||
try {
|
||||
resmgr.getResourceManager(bundleName).then(data => {
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager start data:' + JSON.stringify(data))
|
||||
data.getMediaBase64(iconId, (error, value) => {
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager getMediaBase64 value:' + value)
|
||||
if (value != null) {
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager getMediaBase64 if 1 value :' + value)
|
||||
that.icon = value;
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager getMediaBase64 if 2 that.icon :' + that.icon)
|
||||
} else {
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager getMediaBase64 else error:' + error)
|
||||
}
|
||||
});
|
||||
logUtil.info('setting applicationInfo getMediaResources getResourceManager end')
|
||||
});
|
||||
} catch (err) {
|
||||
logUtil.info('setting applicationInfo getStringResources getMediaBase64 else error:' + err)
|
||||
}
|
||||
logUtil.info('setting applicationInfo getStringResources end')
|
||||
},
|
||||
|
||||
/**
|
||||
* get app label info by labelId
|
||||
* @param bundleName
|
||||
* @param labelId
|
||||
* @return
|
||||
*/
|
||||
getStringResources(bundleName, labelId) {
|
||||
logUtil.info('setting applicationInfo getStringResources start bundleName labelId' + bundleName + '---' + labelId)
|
||||
let that = this;
|
||||
try {
|
||||
resmgr.getResourceManager(bundleName).then(data => {
|
||||
logUtil.info('setting applicationInfo getStringResources start data:' + data)
|
||||
if (labelId > 0) {
|
||||
data.getString(labelId, (error, value) => {
|
||||
logUtil.info('setting applicationInfo getStringResources getString value:' + value)
|
||||
if (value != null) {
|
||||
logUtil.info('setting applicationInfo getStringResources getString if value:' + value)
|
||||
that.label = value;
|
||||
logUtil.info('setting applicationInfo getStringResources getString if that.label:' + that.label)
|
||||
} else {
|
||||
logUtil.info('setting applicationInfo getStringResources getString else error:' + error)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logUtil.info('setting applicationInfo getStringResources getString else this.appInfo.item.label:' + this.appInfo.item.label)
|
||||
that.label = this.appInfo.item.label;
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
logUtil.info('setting applicationInfo getStringResources catch err:' + err)
|
||||
}
|
||||
logUtil.info('setting applicationInfo getStringResources end')
|
||||
},
|
||||
appInfoBack() {
|
||||
logUtil.info('setting applicationInfo appInfoBack start')
|
||||
router.back();
|
||||
logUtil.info('setting applicationInfo appInfoBack end')
|
||||
},
|
||||
onBackPress() {
|
||||
logUtil.info('setting applicationInfo onBackPress start')
|
||||
router.back();
|
||||
logUtil.info('setting applicationInfo onBackPress end')
|
||||
},
|
||||
onCreate() {
|
||||
logUtil.info('setting applicationInfo onCreate')
|
||||
},
|
||||
onReady() {
|
||||
logUtil.info('setting applicationInfo onReady')
|
||||
},
|
||||
onShow() {
|
||||
logUtil.info('setting applicationInfo onShow')
|
||||
},
|
||||
onHide() {
|
||||
logUtil.info('setting applicationInfo onHide')
|
||||
},
|
||||
onDestroy() {
|
||||
logUtil.info('setting applicationInfo onDestroy')
|
||||
}
|
||||
}
|
51
entry/src/main/js/default/pages/brightness/brightnessSettings.css
Executable file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.container-first {
|
||||
width: 100%;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.bright-slider {
|
||||
color: gray;
|
||||
selected-color: cornflowerblue;
|
||||
block-color: cornflowerblue;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.bright-image {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.bright-image-after {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
|
41
entry/src/main/js/default/pages/brightness/brightnessSettings.hml
Executable file
@ -0,0 +1,41 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name = "head-component" src = "../component/headComponent/headComponent.hml"></element>
|
||||
<element name = "entry-component" src = "../component/entryComponent/entryComponent.hml"></element>
|
||||
<div class = "container">
|
||||
<head-component title-name = "{{ $t('strings.brightnessTab') }}" back-icon = "{{ $t('png.info.back') }}"
|
||||
@back-type = "back">
|
||||
</head-component>
|
||||
<div class = "container-first">
|
||||
<image class = "bright-image" src = "{{ before }}"></image>
|
||||
<slider min = "0" max = "255" class = "bright-slider" value = "{{ bright }}" onchange = "getValue('{{ 10 }}')"
|
||||
ontouchend = "clickBrightnessSet({{ touchEndValue }})"/>
|
||||
<image class = "bright-image-after" src = "{{ after }}"></image>
|
||||
</div>
|
||||
<list scrollpage = "true">
|
||||
<list-item id = "item" for = "{{ brightnessSettingList }}" clickeffect = "false">
|
||||
<entry-component title = "{{ $item.settingTitle }}" icon-show = "{{ $item.settingIcon == '' ? false : true }}"
|
||||
is-summary-show = "{{ $item.settingSummaryShow == '' ? false : true }}"
|
||||
entrance-to-item-show = "{{ $item.settingType == 1 }}"
|
||||
switches-is-show = "{{ $item.settingType == 2 }}"
|
||||
divider-show = "{{ $item.settingShowDivider }}"
|
||||
state-description-show = "{{ $item.settingValue == '' ? false : true }}"
|
||||
switch-default-value = "{{ $item.settingDefaultValue }}"
|
||||
switch-on-change-value = "{{ $item.settingSwitchValue }}"
|
||||
@switch-on-change-type = "switchTouch">
|
||||
</entry-component>
|
||||
</list-item>
|
||||
</list>
|
||||
</div>
|
154
entry/src/main/js/default/pages/brightness/brightnessSettings.js
Executable file
@ -0,0 +1,154 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import BrightnessSettingModel from '../../model/brightnessImpl/BrightnessSettingModel.js';
|
||||
import BaseParseConfModel from '../../model/baseParseConfImpl/BaseParseConfModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
|
||||
let brightnessSettingModel = new BrightnessSettingModel();
|
||||
let baseParseConfModel = new BaseParseConfModel();
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
data: {
|
||||
bright: null,
|
||||
settingSwitchValue: false,
|
||||
switchModeValue: 0,
|
||||
before: '/res/image/ic_settings_brightness_minimum.png',
|
||||
after: '/res/image/ic_settings_brightness_maximum.png',
|
||||
brightnessSettingOb: {},
|
||||
brightnessSettingList: []
|
||||
},
|
||||
onInit() {
|
||||
logUtil.info('setting brightnessSettings onInit start')
|
||||
this.bright = brightnessSettingModel.getStorageValue();
|
||||
logUtil.info('setting brightnessSettings onInit start this.bright:' + this.bright)
|
||||
/**
|
||||
* Get the current screen brightness value of the device
|
||||
*/
|
||||
this.brightnessSettingList = baseParseConfModel.getJsonData('/data/accounts/account_0/applications/com.ohos.settings/com.ohos.settings/assets/entry/resources/rawfile/brightness.json');
|
||||
for (let key in this.brightnessSettingList) {
|
||||
var settingAlias = this.brightnessSettingList[key].settingAlias
|
||||
this.brightnessSettingList[key].settingTitle = this.$t('strings.'.concat(settingAlias))
|
||||
}
|
||||
logUtil.info('setting brightnessSettings onInit end')
|
||||
},
|
||||
|
||||
/**
|
||||
* Acquisition mode
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
getMode(data) {
|
||||
logUtil.info('setting brightnessSettings getMode start:' + JSON.stringify(data) + JSON.stringify(this.brightnessSettingList));
|
||||
for (let key in this.brightnessSettingList) {
|
||||
let value = this.brightnessSettingList[key]
|
||||
/**
|
||||
* The value adjustment of the screen brightness mode is 0 or 1
|
||||
* 0: manual 1:automatic
|
||||
*/
|
||||
value.settingSwitchValue = data[value.settingAlias] == 0 ? false : true;
|
||||
value.switchModeValue = data[value.settingAlias];
|
||||
}
|
||||
logUtil.info('setting brightnessSettings getMode end:' + JSON.stringify(this.brightnessSettingList));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the current screen brightness value of the device
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
getBrightnessValue(brightValue) {
|
||||
logUtil.info('setting brightnessSettings getBrightnessValue start brightValue:' + brightValue);
|
||||
this.bright = brightValue;
|
||||
logUtil.info('setting brightnessSettings getBrightnessValue end')
|
||||
},
|
||||
|
||||
/**
|
||||
* Brightness setting
|
||||
*/
|
||||
getValue: function (name, data) {
|
||||
logUtil.info('setting brightnessSettings getValue start');
|
||||
this.bright = data.value;
|
||||
brightnessSettingModel.setBrightnessListener(this.bright);
|
||||
brightnessSettingModel.setStorageValue(this.bright);
|
||||
logUtil.info('setting brightnessSettings getValue end this.bright:' + this.bright);
|
||||
},
|
||||
/**
|
||||
* Set the current screen brightness value of the device
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
clickBrightnessSet(brightnessValue) {
|
||||
logUtil.info('setting brightnessSettings clickBrightnessSet start brightnessValue:' + brightnessValue)
|
||||
brightnessSettingModel.setBrightnessListener(brightnessValue);
|
||||
brightnessSettingModel.setStorageValue(brightnessValue);
|
||||
logUtil.info('setting brightnessSettings clickBrightnessSet end')
|
||||
},
|
||||
/**
|
||||
* Brightness mode setting
|
||||
*/
|
||||
switchTouch() {
|
||||
logUtil.info('setting brightnessSettings switchTouch start')
|
||||
for (let key in this.brightnessSettingList) {
|
||||
logUtil.info('setting brightnessSettings switchTouch this.settingSwitchValue:' + this.brightnessSettingList[key].settingSwitchValue);
|
||||
if (this.brightnessSettingList[key].settingSwitchValue == false) {
|
||||
this.brightnessSettingList[key].settingSwitchValue = true;
|
||||
this.brightnessSettingList[key].switchModeValue = 1;
|
||||
this.clickSetMode(this.brightnessSettingList[key].switchModeValue)
|
||||
logUtil.info('setting brightnessSettings switchTouch settingSwitchValue true:' + this.brightnessSettingList[key].settingSwitchValue + " | switchModeValue | " + this.brightnessSettingList[key].switchModeValue);
|
||||
} else {
|
||||
this.brightnessSettingList[key].settingSwitchValue = false;
|
||||
this.brightnessSettingList[key].switchModeValue = 0;
|
||||
this.clickSetMode(this.brightnessSettingList[key].switchModeValue)
|
||||
logUtil.info('setting brightnessSettings switchTouch settingSwitchValue false:' + this.brightnessSettingList[key].settingSwitchValue + " | switchModeValue | " + this.brightnessSettingList[key].switchModeValue);
|
||||
}
|
||||
}
|
||||
logUtil.info('setting brightnessSettings onBackPress end')
|
||||
},
|
||||
/**
|
||||
* Set the current screen brightness mode of the device.
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
clickSetMode(e) {
|
||||
logUtil.info('setting brightnessSettings switchTouch start clickSetMode:' + e);
|
||||
},
|
||||
back() {
|
||||
logUtil.info('setting brightnessSettings back start')
|
||||
router.back();
|
||||
logUtil.info('setting brightnessSettings back end')
|
||||
},
|
||||
onBackPress() {
|
||||
logUtil.info('setting brightnessSettings onBackPress start')
|
||||
router.back();
|
||||
logUtil.info('setting brightnessSettings onBackPress end')
|
||||
},
|
||||
onCreate() {
|
||||
logUtil.info('setting brightnessSettings onCreate')
|
||||
},
|
||||
onReady() {
|
||||
logUtil.info('setting brightnessSettings onReady')
|
||||
},
|
||||
onShow() {
|
||||
logUtil.info('setting brightnessSettings onShow')
|
||||
},
|
||||
onHide() {
|
||||
logUtil.info('setting brightnessSettings onHide')
|
||||
},
|
||||
onDestroy() {
|
||||
logUtil.info('setting brightnessSettings onDestroy')
|
||||
}
|
||||
}
|
115
entry/src/main/js/default/pages/component/entryComponent/entryComponent.css
Executable file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.item {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #fdfdfd;
|
||||
}
|
||||
|
||||
.preference {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.text-style-summary {
|
||||
weights: 1;
|
||||
font-size: 18px;
|
||||
color: #999999;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title-text-style {
|
||||
weights: 1;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title-style {
|
||||
font-family: Courier;
|
||||
font-size: 22px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.preference-title {
|
||||
width: 60%;
|
||||
flex-direction: column;
|
||||
weights: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.head-image-pin {
|
||||
width: 43px;
|
||||
height: 38px;
|
||||
justify-content: center;
|
||||
margin-right: 15px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.div_head-image{
|
||||
height: 70px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.head-image {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.switch-on-off{
|
||||
width: 85px;
|
||||
height: 70px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.div-line{
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #E3E3E3;
|
||||
flex-shrink:0;
|
||||
}
|
||||
|
||||
.text-container-style-right {
|
||||
color: #666666;
|
||||
width: 40%;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.text-style-right {
|
||||
font-size: 18px;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.preference-title-width100{
|
||||
width:100%;
|
||||
flex-direction: column;
|
||||
weights: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text-container-style-right-width0{
|
||||
width:0%;
|
||||
}
|
40
entry/src/main/js/default/pages/component/entryComponent/entryComponent.hml
Executable file
@ -0,0 +1,40 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<div class="preference" onclick="action" show="{{itemIsShow}}">
|
||||
<image class="head-image-pin" src="{{icon}}" show="{{iconShow}}"></image>
|
||||
<div class="item">
|
||||
<div>
|
||||
<div class = "{{stateDescriptionShow==true?'preference-title':'preference-title-width100'}}">
|
||||
<div class="title-text-style">
|
||||
<text class="title-style">{{title}}
|
||||
</text>
|
||||
<image class="title-icon-image" src="{{headIcon}}" show="{{isHeadIconShow}}"></image>
|
||||
</div>
|
||||
<text class="text-style-summary" show="{{isSummaryShow}}">{{summary}}
|
||||
</text>
|
||||
</div>
|
||||
<div class = "{{stateDescriptionShow==true?'text-container-style-right':'text-container-style-right-width0'}}">
|
||||
<text class="text-style-right" show="{{stateDescriptionShow}}">{{modelStateDescribe}}
|
||||
</text>
|
||||
</div>
|
||||
<div class="div_head-image" show="{{ entranceToItemShow }}">
|
||||
<image class="head-image" src="{{ entranceToItemIcon }}" show="{{ entranceToItemShow }}"></image>
|
||||
</div>
|
||||
<switch class = "switch-on-off" show="{{switchesIsShow}}" checked="{{switchDefaultValue}}" onchange="{{switchOnChange}}"></switch>
|
||||
</div>
|
||||
<div class = "div-line" show = "{{ dividerShow }}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
165
entry/src/main/js/default/pages/component/entryComponent/entryComponent.js
Executable file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LogUtil from '../../../common/baseUtil/LogUtil.js';
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
props: {
|
||||
/**
|
||||
* Whether a single model is displayed or hidden
|
||||
*/
|
||||
itemIsShow: {
|
||||
default: true,
|
||||
},
|
||||
/**
|
||||
* String value representing the Preference title
|
||||
*/
|
||||
title: {
|
||||
default: '',
|
||||
},
|
||||
/**
|
||||
* String value representing the Preference summary
|
||||
*/
|
||||
summary: {
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* Drawable representing the Preference icon
|
||||
*/
|
||||
icon: {
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* Boolean indicating whether the user can interact with Preference
|
||||
* false:Preference will be grayed out and users cannot interact with it.
|
||||
* The default value is true
|
||||
*/
|
||||
enabled: {
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* A boolean indicating whether the user can interact with the Preference.
|
||||
* The default value is true.
|
||||
*/
|
||||
selectable: {
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* Whether the icon is displayed
|
||||
* The default value is false.
|
||||
*/
|
||||
iconShow: {
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* whether the Preference category or Preference category is visible
|
||||
* Does summary show or hide
|
||||
*/
|
||||
isSummaryShow: {
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* Whether the text status is displayed
|
||||
* The default value is false
|
||||
*/
|
||||
stateDescriptionShow: {
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* State description of a single model item
|
||||
*/
|
||||
modelStateDescribe: {
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* Entry item
|
||||
* Whether the icon at the end of a single model item is displayed
|
||||
* The default value is true
|
||||
*/
|
||||
entranceToItemShow: {
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* The icon at the end of a single model item
|
||||
*/
|
||||
entranceToItemIcon: {
|
||||
default: '/res/image/ic_settings_arrow.png'
|
||||
},
|
||||
/**
|
||||
* Whether to display the switch item
|
||||
* The default value is false
|
||||
*/
|
||||
switchesIsShow: {
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* switch item value
|
||||
* The default value is false
|
||||
*/
|
||||
switchDefaultValue: {
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* item
|
||||
*/
|
||||
item: {},
|
||||
/**
|
||||
* Switch item
|
||||
* monitor the changed value
|
||||
*/
|
||||
switchOnChangeValue:{},
|
||||
showObject: {},
|
||||
/**
|
||||
* Icon behind title
|
||||
*/
|
||||
headIcon: {
|
||||
default: '/res/image/head_icon.png'
|
||||
},
|
||||
isHeadIconShow: {
|
||||
default: false
|
||||
},
|
||||
dividerShow:{
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showObj: this.showObject,
|
||||
itemData: this.item,
|
||||
switchDefaultValue:this.switchDefaultValue,
|
||||
switchOnChangeValue: this.switchOnChangeValue,
|
||||
};
|
||||
},
|
||||
action() {
|
||||
logUtil.info("setting entryComponent action start this.itemData"+JSON.stringify( this.itemData));
|
||||
this.$emit('actionType',{
|
||||
text: this.itemData,
|
||||
});
|
||||
logUtil.info("setting entryComponent action end");
|
||||
},
|
||||
/**
|
||||
* The onchange event of the switch item
|
||||
*/
|
||||
switchOnChange() {
|
||||
|
||||
logUtil.info("setting entryComponent switchOnChange start switchChangeValue this.switchOnChangeValue:"+this.switchOnChangeValue+"--this.switchDefaultValue--"+this.switchDefaultValue);
|
||||
this.$emit('switchOnChangeType',{
|
||||
text: !this.switchOnChangeValue,
|
||||
defaultText: this.switchDefaultValue,
|
||||
detail: this.itemData,
|
||||
});
|
||||
logUtil.info("setting entryComponent switchOnChange end");
|
||||
}
|
||||
}
|
54
entry/src/main/js/default/pages/component/headComponent/headComponent.css
Executable file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.app-bar-info {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.app-bar-div {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
|
||||
}
|
||||
|
||||
.app-bar-image-change-background {
|
||||
border-left: 15px solid transparent;
|
||||
border-right: 15px solid transparent;
|
||||
border-top: 5px solid transparent;
|
||||
border-bottom: 5px solid transparent;
|
||||
width: 70px;
|
||||
height: 50px;
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
.app-bar-image {
|
||||
border-left: 15px solid transparent;
|
||||
border-right: 15px solid transparent;
|
||||
border-top: 5px solid transparent;
|
||||
border-bottom: 5px solid transparent;
|
||||
width: 70px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.app-bar-text {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
padding-right: 15px;
|
||||
}
|
24
entry/src/main/js/default/pages/component/headComponent/headComponent.hml
Executable file
@ -0,0 +1,24 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<div class="app-bar-info">
|
||||
<div show="{{backIsShow}}" class="app-bar-div" ontouchend="backRouter">
|
||||
<image class="{{buttonStyles}}" id="backId" src=" {{backIcon}}" ontouchstart="backChangeBackground"/>
|
||||
</div>
|
||||
<!--
|
||||
<image class="app-bar-image" src=" {{backIcon}}" onclick="back" show="{{backIsShow}}" />
|
||||
-->
|
||||
<text class="app-bar-text">{{titleName}}
|
||||
</text>
|
||||
</div>
|
47
entry/src/main/js/default/pages/component/headComponent/headComponent.js
Executable file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
//Title name
|
||||
titleName: {
|
||||
default: '',
|
||||
},
|
||||
backIcon: {},
|
||||
backIsShow: {
|
||||
default: true,
|
||||
},
|
||||
buttonStyles: {
|
||||
default: 'app-bar-image'
|
||||
},
|
||||
},
|
||||
back() {
|
||||
console.info('setting headComponent back start');
|
||||
this.$emit('backType', {});
|
||||
console.info('setting headComponent back end');
|
||||
},
|
||||
backChangeBackground() {
|
||||
console.info('setting headComponent backChangeBackground start');
|
||||
this.buttonStyles = 'app-bar-image-change-background'
|
||||
console.info('setting headComponent backChangeBackground end');
|
||||
},
|
||||
backRouter() {
|
||||
console.info('setting headComponent backRouter start');
|
||||
router.back();
|
||||
console.info('setting headComponent backRouter end');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
@ -0,0 +1,28 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='entry-component' src='../entryComponent/entryComponent.hml'></element>
|
||||
<list show="{{listShow}}" scrollpage = "true">
|
||||
<list-item id="item" for="{{parentData}}">
|
||||
<entry-component @action-type="onclick" item="{{$item.settingType==1?$item:''}}" icon="{{$item.settingIcon}}"
|
||||
icon-show="{{$item.settingIcon==''?false:true}}" summary="{{$item.settingSummary}}" title="{{$item.settingTitle}}"
|
||||
is-summary-show="{{$item.settingSummary==''?false:true}}" model-state-describe="{{$item.settingValue}}"
|
||||
state-description-show="{{$item.settingValue==''?false:true}}" divider-show = "{{ $item.settingShowDivider }}"
|
||||
entrance-to-item-icon="{{$item.settingArrow}}" entrance-to-item-show="{{$item.settingType==1}}"
|
||||
switches-is-show="{{$item.settingType==2}}" switch-default-value="{{$item.settingDefaultValue}}"
|
||||
switch-on-change-value="{{switchChangeValue}}" @switch-on-change-type="switchClick"></entry-component>
|
||||
</list-item>
|
||||
</list>
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import LogUtil from '../../../common/baseUtil/LogUtil.js';
|
||||
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
props: {
|
||||
//Receive the value passed by the parent component
|
||||
parentData: {
|
||||
default: '',
|
||||
},
|
||||
listShow: {
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
data: {},
|
||||
|
||||
/**
|
||||
* Jump to the corresponding lower menu
|
||||
*/
|
||||
onclick(e) {
|
||||
logUtil.info('setting settingsListComponent onclick start: ' + JSON.stringify(e.detail.text));
|
||||
router.push({
|
||||
uri: e.detail.text.settingUri,
|
||||
params: {
|
||||
dataParam: e.detail.text,
|
||||
}
|
||||
});
|
||||
logUtil.info('setting settingsListComponent onclick end: ');
|
||||
},
|
||||
/**
|
||||
* switch Onchange get the value
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
switchClick(e) {
|
||||
logUtil.info('setting settingsListComponent switchClick start: ');
|
||||
this.switchChangeValue = e.detail.text,
|
||||
this.switchDefaultChangeValue = e.detail.defaultText
|
||||
logUtil.info('setting settingsListComponent switchClick end:' + this.switchChangeValue + '|' + this.switchDefaultChangeValue);
|
||||
}
|
||||
}
|
||||
|
62
entry/src/main/js/default/pages/dateAndTime/dateAndTime.css
Executable file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dialog-main {
|
||||
width: 440px;
|
||||
height: 440px;
|
||||
}
|
||||
|
||||
.dialog-div {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 420px;
|
||||
height: 420px;
|
||||
}
|
||||
|
||||
.inner-title {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
margin-left: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.inner-txt {
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.inner-btn {
|
||||
width: 400px;
|
||||
height: 80px;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.time-picker {
|
||||
width: 600px;
|
||||
height: 500px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
66
entry/src/main/js/default/pages/dateAndTime/dateAndTime.hml
Executable file
@ -0,0 +1,66 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='head-component' src='../component/headComponent/headComponent.hml'></element>
|
||||
<element name='entry-component' src='../component/entryComponent/entryComponent.hml'></element>
|
||||
<div class="container">
|
||||
<!--Date time title-->
|
||||
<head-component title-name="{{$t('strings.dateAndTimeTab')}}" back-icon="{{$t('png.info.back')}}" @back-type="back"></head-component>
|
||||
<!--content-->
|
||||
<list class="autoSet">
|
||||
<list-item id="item" for="{{dateAndTimeList}}" ontouchstart="clickToDetail({{$idx}})">
|
||||
<entry-component title="{{$item.settingTitle}}" item="{{$item}}" item-is-show="{{$item.settingItemIsShow}}"
|
||||
entrance-to-item-icon="{{$item.settingArrow}}" summary="{{$item.settingSummary}}"
|
||||
is-summary-show="{{$item.settingSummary==''?false:true}}"
|
||||
model-state-describe="{{$item.settingValue}}"
|
||||
icon-show="{{$item.settingIcon==''?false:true}}"
|
||||
state-description-show="{{$item.settingValue==''?false:true}}"
|
||||
switch-default-value="{{$item.settingDefaultValue}}" entrance-to-item-show="{{$item.settingType==1}}"
|
||||
switches-is-show="{{$item.settingType==2}}" switch-on-change-value="{{$item.settingSwitchOnChangeValue}}"
|
||||
@switch-on-change-type="onclick"></entry-component>
|
||||
</list-item>
|
||||
</list>
|
||||
<!-- Manual date setting -->
|
||||
<dialog id="dateDialog" class="dialog-main" oncancel="cancelDialog">
|
||||
<div class="dialog-div" @swipe="handleSwipe">
|
||||
<div class="inner-title">
|
||||
<text>{{inner_title}}</text>
|
||||
</div>
|
||||
<div class="inner-txt">
|
||||
<picker-view type="date" start="2008-1-1"
|
||||
end="2037-12-31" selected="{{currentDate}}" @change="handleDateChange"></picker-view>
|
||||
</div>
|
||||
<div class="inner-btn">
|
||||
<button type="text" onclick="cancelSchedule" class="btn-txt">{{$t('strings.cancel')}}</button>
|
||||
<button type="text" onclick="setDateSchedule" class="btn-txt">{{$t('strings.confirm')}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
<!-- Manual time setting -->
|
||||
<dialog id="timeDialog" class="dialog-main" oncancel="cancelDialog">
|
||||
<div class="dialog-div" @swipe="handleSwipe">
|
||||
<div class="inner-title">
|
||||
<text>{{$t('strings.time')}}</text>
|
||||
</div>
|
||||
<div class="inner-txt">
|
||||
<picker-view class="time-picker" type="time" hours="24"
|
||||
selected="{{currentTime}}" @change="handleTimeChange"></picker-view>
|
||||
</div>
|
||||
<div class="inner-btn">
|
||||
<button type="text" onclick="cancelSchedule" class="btn-txt">{{$t('strings.cancel')}}</button>
|
||||
<button type="text" onclick="setTimeSchedule" class="btn-txt">{{$t('strings.confirm')}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
</div>
|
212
entry/src/main/js/default/pages/dateAndTime/dateAndTime.js
Executable file
@ -0,0 +1,212 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import BaseParseConfModel from '../../model/baseParseConfImpl/BaseParseConfModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
import DateAndTimeUtil from '../../common/baseUtil/DateAndTimeUtil.js';
|
||||
import systemTime from '@ohos.systemTime';
|
||||
|
||||
let logUtil = new LogUtil();
|
||||
let dateAndTimeUtil = null;
|
||||
let baseParseConfModel = new BaseParseConfModel();
|
||||
|
||||
globalThis.$globalT = null;
|
||||
|
||||
export default {
|
||||
data: {
|
||||
date: '', //The date displayed on the current page
|
||||
time: '', //The time displayed on the current page
|
||||
currentDate: '',
|
||||
currentTime: '',
|
||||
inner_title: '', //Title information on the time frame
|
||||
intervalFlag: '', //Timer flag
|
||||
dateAndTimeList: [],
|
||||
dateAndTimeListData: 'dateAndTimeList',
|
||||
},
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
onInit() {
|
||||
logUtil.info('settings dateAndTime onInit start')
|
||||
globalThis.$globalT = this.$t.bind(this);
|
||||
dateAndTimeUtil = new DateAndTimeUtil();
|
||||
this.dateAndTimeList = baseParseConfModel.getJsonData('/data/accounts/account_0/applications/com.ohos.settings/com.ohos.settings/assets/entry/resources/rawfile/dateAndTime.json');
|
||||
for (let key in this.dateAndTimeList) {
|
||||
var settingAlias = this.dateAndTimeList[key].settingAlias
|
||||
this.dateAndTimeList[key].settingTitle = this.$t('strings.'.concat(settingAlias))
|
||||
}
|
||||
logUtil.info('settings dateAndTime onInit dateAndTimeList:' + JSON.stringify(this.dateAndTimeList));
|
||||
const dateTime = new Date();
|
||||
const year = dateTime.getFullYear();
|
||||
const month = dateTime.getMonth() + 1;
|
||||
const day = dateTime.getDate();
|
||||
this.date = dateAndTimeUtil.concatDate(year, month, day);
|
||||
this.time = dateAndTimeUtil.now();
|
||||
this.changeValue();
|
||||
let that = this
|
||||
this.intervalFlag = setInterval(function () {
|
||||
that.time = dateAndTimeUtil.now();
|
||||
that.changeValue();
|
||||
}, 1000);
|
||||
logUtil.info('settings dateAndTime onInit end:' + JSON.stringify(this.dateAndTimeList));
|
||||
},
|
||||
/**
|
||||
* Stop refresh
|
||||
*/
|
||||
onDestroy() {
|
||||
logUtil.info('setting dateAndTime onDestroy start')
|
||||
clearInterval(this.intervalFlag)
|
||||
logUtil.info('setting dateAndTime onDestroy end')
|
||||
},
|
||||
/**
|
||||
* Assignment conversion
|
||||
*/
|
||||
changeValue() {
|
||||
|
||||
for (let key in this.dateAndTimeList) {
|
||||
let settingAlias = this.dateAndTimeList[key].settingAlias;
|
||||
if (settingAlias == 'date') {
|
||||
this.dateAndTimeList[key].settingValue = this.date;
|
||||
} else if (settingAlias == 'time') {
|
||||
this.dateAndTimeList[key].settingValue = this.time;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Enter to select sub-page details
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
clickToDetail(index) {
|
||||
logUtil.info('setting dateAndTime clickToDetail start')
|
||||
let settingAlias = this.dateAndTimeList[index].settingAlias;
|
||||
if (settingAlias == 'date') {
|
||||
const datetime = new Date();
|
||||
const y = datetime.getFullYear();
|
||||
const m = datetime.getMonth() + 1;
|
||||
const d = datetime.getDate();
|
||||
this.currentDate = this.date;
|
||||
this.inner_title = this.currentDate + dateAndTimeUtil.convert(y, m, d);
|
||||
this.$element('dateDialog').show();
|
||||
}
|
||||
else if (settingAlias == 'time') {
|
||||
this.currentTime = this.time;
|
||||
this.$element('timeDialog').show();
|
||||
}
|
||||
else {
|
||||
}
|
||||
logUtil.info('setting dateAndTime clickToDetail end')
|
||||
},
|
||||
/**
|
||||
* Cancel the bullet box
|
||||
* @return
|
||||
*/
|
||||
cancelSchedule() {
|
||||
logUtil.info('setting dateAndTime cancelSchedule start')
|
||||
this.$element('dateDialog').close()
|
||||
this.$element('timeDialog').close()
|
||||
logUtil.info('setting dateAndTime cancelSchedule end')
|
||||
},
|
||||
/**
|
||||
* Modify date
|
||||
* @return
|
||||
*/
|
||||
setDateSchedule() {
|
||||
logUtil.info('setting dateAndTime setDateSchedule start')
|
||||
this.$element('dateDialog').close();
|
||||
if (this.currentDate != this.date) {
|
||||
logUtil.info('dateDialog init start:: current date is' + this.currentDate);
|
||||
this.date = this.currentDate;
|
||||
this.inner_title = this.date + this.week;
|
||||
this.changeValue();
|
||||
}
|
||||
logUtil.info('setting dateAndTime setDateSchedule end')
|
||||
},
|
||||
/**
|
||||
* Modify time
|
||||
* @return
|
||||
*/
|
||||
setTimeSchedule() {
|
||||
logUtil.info('setting dateAndTime setTimeSchedule start')
|
||||
this.$element('timeDialog').close();
|
||||
if (this.currentTime != this.time) {
|
||||
logUtil.info('timeDialog init start:: current time is' + this.currentTime);
|
||||
const datetime = new Date();
|
||||
const y = datetime.getFullYear();
|
||||
const m = datetime.getMonth() + 1;
|
||||
const d = datetime.getDate();
|
||||
const str = y + "/" + dateAndTimeUtil.fill(m) + "/" + dateAndTimeUtil.fill(d) + " " + this.currentTime + ":" + "00"
|
||||
logUtil.info('timeDialog init start::' + str);
|
||||
const s = (new Date(str)).getTime();
|
||||
logUtil.info('timeDialog time::' + s);
|
||||
this.setTime(s);
|
||||
this.time = this.currentTime;
|
||||
logUtil.info('timeDialog time::' + this.time);
|
||||
this.changeValue();
|
||||
}
|
||||
logUtil.info('setting dateAndTime setTimeSchedule end')
|
||||
},
|
||||
setTime(time) {
|
||||
console.log('setting dateAndTime setTime start');
|
||||
systemTime.setTime(time).then(data =>
|
||||
console.log('setting dateAndTime AceApplication promise1::then ' + data))
|
||||
.catch(error =>
|
||||
console.log('setting dateAndTime AceApplication promise1::catch ' + error));
|
||||
console.log('setting dateAndTime setTime end');
|
||||
},
|
||||
/**
|
||||
* Date drag
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
handleDateChange(data) {
|
||||
logUtil.info('setting dateAndTime handleDateChange start')
|
||||
this.currentDate = dateAndTimeUtil.concatDate(data.year, data.month + 1, data.day);
|
||||
this.inner_title = this.currentDate + dateAndTimeUtil.convert(data.year, data.month + 1, data.day);
|
||||
logUtil.info('setting dateAndTime handleDateChange end')
|
||||
},
|
||||
/**
|
||||
* Time drag
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
handleTimeChange(data) {
|
||||
logUtil.info('setting dateAndTime handleTimeChange start')
|
||||
this.currentTime = dateAndTimeUtil.concatTime(data.hour, data.minute);
|
||||
logUtil.info('setting dateAndTime handleTimeChange end')
|
||||
},
|
||||
/**
|
||||
* Return to the previous menu
|
||||
*/
|
||||
back() {
|
||||
logUtil.info('settings dateAndTime back start:')
|
||||
router.back();
|
||||
logUtil.info('settings dateAndTime back end:')
|
||||
},
|
||||
onCreate() {
|
||||
logUtil.info('settings dateAndTime onCreate')
|
||||
},
|
||||
onReady() {
|
||||
logUtil.info('settings dateAndTime onReady')
|
||||
},
|
||||
onHide() {
|
||||
logUtil.info('settings dateAndTime onHide')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
88
entry/src/main/js/default/pages/searchInfo/searchInfo.css
Executable file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.search {
|
||||
height: 90px;
|
||||
align-items: center;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 20%;
|
||||
height: 120px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.body {
|
||||
width: 30%;
|
||||
height: 120px;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.status {
|
||||
width: 35%;
|
||||
height: 120px;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.more-div {
|
||||
padding-right: 20px;
|
||||
padding-top: 20px;
|
||||
width: 15%;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
width: 60px;
|
||||
height: 90px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.settings-body {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.app-bar-info {
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
flex-direction: row;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.app-bar-image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin-left: 30px;
|
||||
}
|
26
entry/src/main/js/default/pages/searchInfo/searchInfo.hml
Executable file
@ -0,0 +1,26 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='settings-list-component' src='../component/settingsListComponent/settingsListComponent.hml'></element>
|
||||
<div class="container">
|
||||
<div class="app-bar-info">
|
||||
<image class="app-bar-image" src="{{$t('png.info.back')}}" onclick="searchBack"></image>
|
||||
<div class="search">
|
||||
<search id="search" focusable="true" style="height: 60px;" hint="{{$t('strings.search')}}"
|
||||
onchange="getValue" ></search>
|
||||
</div>
|
||||
</div>
|
||||
<!--list item-->
|
||||
<settings-list-component parent-data="{{searchList}}"></settings-list-component>
|
||||
</div>
|
84
entry/src/main/js/default/pages/searchInfo/searchInfo.js
Executable file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
|
||||
const DATA_PAGE_SOURCE_HOME_PAGE = 'homePage';
|
||||
const DATA_PAGE_SOURCE_APP_PAGE = 'appPage';
|
||||
|
||||
export default {
|
||||
data: {
|
||||
/**
|
||||
* setting homepage date list
|
||||
*/
|
||||
settingsList: [],
|
||||
/**
|
||||
* Application management list
|
||||
*/
|
||||
appList: [],
|
||||
/**
|
||||
* search result list
|
||||
*/
|
||||
searchList: [],
|
||||
/**
|
||||
* Page source
|
||||
* homePage:homePage, appManage:appPage
|
||||
*/
|
||||
type: null,
|
||||
},
|
||||
onInit() {
|
||||
this.settingsList = this.data;
|
||||
this.appList = this.appData;
|
||||
this.type = this.type;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the value in the search box
|
||||
*/
|
||||
getValue: function (e) {
|
||||
this.clickSearch(e.text);
|
||||
},
|
||||
|
||||
/**
|
||||
* Search app
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
clickSearch(e) {
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
this.searchList = [];
|
||||
if (this.type == DATA_PAGE_SOURCE_HOME_PAGE) {
|
||||
this.settingsList.forEach((element) => {
|
||||
if ((element.settingTitle).includes(e) && '' != e) {
|
||||
this.searchList.push(element);
|
||||
}
|
||||
})
|
||||
}
|
||||
else if (this.type == DATA_PAGE_SOURCE_APP_PAGE) {
|
||||
this.appList.forEach((element) => {
|
||||
if ((element.settingTitle).includes(e) && '' != e) {
|
||||
this.searchList.push(element);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
searchBack() {
|
||||
router.back();
|
||||
},
|
||||
onBackPress() {
|
||||
router.back();
|
||||
}
|
||||
}
|
75
entry/src/main/js/default/pages/settingList/settingList.css
Executable file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
align-items: center;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 20%;
|
||||
height: 120px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.body {
|
||||
width: 30%;
|
||||
height: 120px;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.status {
|
||||
width: 35%;
|
||||
height: 120px;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.more-div {
|
||||
padding-right: 20px;
|
||||
padding-top: 20px;
|
||||
width: 15%;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
width: 60px;
|
||||
height: 90px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.settings-body {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
28
entry/src/main/js/default/pages/settingList/settingList.hml
Executable file
@ -0,0 +1,28 @@
|
||||
<!--/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/-->
|
||||
<element name='head-component' src='../component/headComponent/headComponent.hml'></element>
|
||||
<element name='settings-list-component' src='../component/settingsListComponent/settingsListComponent.hml'></element>
|
||||
<div class="container">
|
||||
<div style="padding-left: 30px;">
|
||||
<head-component title-name="{{$t('strings.setting')}}" back-is-show="false"></head-component>
|
||||
</div>
|
||||
<!-- search bar -->
|
||||
<div class="search" show="false">
|
||||
<search id="search" style="height: 60px;" hint="{{$t('strings.search')}}"
|
||||
ontouchstart="onClick" focusable="false"></search>
|
||||
</div>
|
||||
<!--list item-->
|
||||
<settings-list-component parent-data="{{settingsList}}"></settings-list-component>
|
||||
</div>
|
60
entry/src/main/js/default/pages/settingList/settingList.js
Executable file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
import SettingListModel from '../../model/settingListImpl/SettingListModel.js';
|
||||
import LogUtil from '../../common/baseUtil/LogUtil.js';
|
||||
|
||||
const DATA_PAGE_SOURCE_HOME_PAGE = 'homePage';
|
||||
let mSettingListModel = new SettingListModel();
|
||||
let logUtil = new LogUtil();
|
||||
|
||||
export default {
|
||||
data: {
|
||||
settingsList: [],
|
||||
switchChangeValue: false,
|
||||
switchDefaultChangeValue: false
|
||||
},
|
||||
onInit() {
|
||||
logUtil.info('settings settingList onInit start:');
|
||||
mSettingListModel.setSettingListener(this.settingsListData);
|
||||
for (let key in this.settingsList) {
|
||||
var settingAlias = this.settingsList[key].settingAlias
|
||||
if (settingAlias == 'wifiTab') {
|
||||
this.settingsList[key].settingValue = this.$t('strings.enabled')
|
||||
}
|
||||
this.settingsList[key].settingTitle = this.$t('strings.'.concat(settingAlias))
|
||||
}
|
||||
logUtil.info('settings settingList onInit end:');
|
||||
},
|
||||
settingsListData(data) {
|
||||
logUtil.info('settingList settingsListData data:' + JSON.stringify(data));
|
||||
this.settingsList = data
|
||||
},
|
||||
|
||||
/**
|
||||
* Click the search box to jump to the search page
|
||||
*/
|
||||
onClick() {
|
||||
logUtil.info('settings settingList onClick start:');
|
||||
router.push({
|
||||
uri: 'pages/searchInfo/searchInfo',
|
||||
params: {
|
||||
data: this.settingsList,
|
||||
type: DATA_PAGE_SOURCE_HOME_PAGE
|
||||
}
|
||||
});
|
||||
logUtil.info('settings settingList onClick end:');
|
||||
},
|
||||
}
|
BIN
entry/src/main/js/default/res/image/about.png
Executable file
After Width: | Height: | Size: 7.0 KiB |
BIN
entry/src/main/js/default/res/image/apply.jpg
Executable file
After Width: | Height: | Size: 9.8 KiB |
BIN
entry/src/main/js/default/res/image/arrow.jpg
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
entry/src/main/js/default/res/image/bright.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
entry/src/main/js/default/res/image/brightness.png
Executable file
After Width: | Height: | Size: 26 KiB |
BIN
entry/src/main/js/default/res/image/dateTime.jpg
Executable file
After Width: | Height: | Size: 10 KiB |
BIN
entry/src/main/js/default/res/image/head_icon.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
BIN
entry/src/main/js/default/res/image/ic_back.png
Executable file
After Width: | Height: | Size: 255 B |
BIN
entry/src/main/js/default/res/image/ic_settings_about.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
entry/src/main/js/default/res/image/ic_settings_advanced.png
Executable file
After Width: | Height: | Size: 4.7 KiB |
BIN
entry/src/main/js/default/res/image/ic_settings_applications.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
entry/src/main/js/default/res/image/ic_settings_arrow.png
Executable file
After Width: | Height: | Size: 391 B |
BIN
entry/src/main/js/default/res/image/ic_settings_brightness_maximum.png
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
entry/src/main/js/default/res/image/ic_settings_brightness_minimum.png
Executable file
After Width: | Height: | Size: 2.8 KiB |
BIN
entry/src/main/js/default/res/image/ic_settings_display.png
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
entry/src/main/js/default/res/image/icon_brightness_after.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
entry/src/main/js/default/res/image/icon_brightness_before.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
12
entry/src/main/resources/base/element/string.json
Executable file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "Settings"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "JS_Phone_Empty Feature Ability"
|
||||
}
|
||||
]
|
||||
}
|
BIN
entry/src/main/resources/base/media/icon.png
Executable file
After Width: | Height: | Size: 77 KiB |
42
entry/src/main/resources/rawfile/aboutDevice.json
Executable file
@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingType": 0,
|
||||
"settingAlias": "systemName",
|
||||
"settingTitle": "",
|
||||
"settingValue": "OpenHarmony",
|
||||
"settingShowDivider": true
|
||||
},
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingType": 0,
|
||||
"settingAlias": "model",
|
||||
"settingTitle": "",
|
||||
"settingValue": "",
|
||||
"settingShowDivider": true
|
||||
},
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingType": 0,
|
||||
"settingAlias": "companyInfo",
|
||||
"settingTitle": "",
|
||||
"settingValue": "",
|
||||
"settingShowDivider": true
|
||||
},
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingType": 0,
|
||||
"settingAlias": "deviceId",
|
||||
"settingTitle": "",
|
||||
"settingValue": "00000000000000",
|
||||
"settingShowDivider": true
|
||||
},
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingType": 0,
|
||||
"settingAlias": "softwareVersion",
|
||||
"settingTitle": "",
|
||||
"settingValue": "",
|
||||
"settingShowDivider": true
|
||||
}
|
||||
]
|
12
entry/src/main/resources/rawfile/brightness.json
Executable file
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingTitle": "",
|
||||
"settingAlias": "brightnessMode",
|
||||
"settingDefaultValue": false,
|
||||
"settingSwitchValue": true,
|
||||
"settingSwitchModeValue": 1,
|
||||
"settingValue": "",
|
||||
"settingType": 2
|
||||
}
|
||||
]
|
26
entry/src/main/resources/rawfile/dateAndTime.json
Executable file
@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingAlias": "date",
|
||||
"settingItemIsShow": true,
|
||||
"settingTitle": "",
|
||||
"settingSummary": "",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": false,
|
||||
"settingShowDivider": true,
|
||||
"settingType": 1
|
||||
},
|
||||
{
|
||||
"settingIcon": "",
|
||||
"settingAlias": "time",
|
||||
"settingItemIsShow": true,
|
||||
"settingTitle": "",
|
||||
"settingSummary": "",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": false,
|
||||
"settingShowDivider": true,
|
||||
"settingType": 1
|
||||
}
|
||||
]
|
50
entry/src/main/resources/rawfile/settinglist.json
Executable file
@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"settingIcon": "/res/image/ic_settings_display.png",
|
||||
"settingTitle": "",
|
||||
"settingAlias": "brightnessTab",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": false,
|
||||
"settingSummary": "",
|
||||
"settingShowDivider": true,
|
||||
"settingType": 1,
|
||||
"settingUri": "pages/brightness/brightnessSettings"
|
||||
},
|
||||
{
|
||||
"settingIcon": "/res/image/ic_settings_applications.png",
|
||||
"settingTitle": "",
|
||||
"settingAlias": "applyTab",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": true,
|
||||
"settingSummary": "",
|
||||
"settingShowDivider": true,
|
||||
"settingType": 1,
|
||||
"settingUri": "pages/appManagement/appManagement"
|
||||
},
|
||||
{
|
||||
"settingIcon": "/res/image/ic_settings_advanced.png",
|
||||
"settingTitle": "",
|
||||
"settingAlias": "dateAndTimeTab",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": true,
|
||||
"settingSummary": "",
|
||||
"settingShowDivider": true,
|
||||
"settingType": 1,
|
||||
"settingUri": "pages/dateAndTime/dateAndTime"
|
||||
},
|
||||
{
|
||||
"settingIcon": "/res/image/ic_settings_about.png",
|
||||
"settingTitle": "",
|
||||
"settingAlias": "aboutTab",
|
||||
"settingValue": "",
|
||||
"settingArrow": "/res/image/ic_settings_arrow.png",
|
||||
"settingDefaultValue": true,
|
||||
"settingSummary": "",
|
||||
"settingShowDivider": false,
|
||||
"settingType": 1,
|
||||
"settingUri": "pages/aboutDevice/aboutDevice"
|
||||
}
|
||||
]
|
BIN
figures/en-us_image_0000001153225717.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
figures/zh-cn_image_0000001153225717.png
Executable file
After Width: | Height: | Size: 18 KiB |
25
gradle.properties
Executable file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. DevEco Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# If the Chinese output is garbled, please configure the following parameter.
|
||||
# org.gradle.jvmargs=-Dfile.encoding=GBK
|
183
gradlew
vendored
Executable file
@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
103
gradlew.bat
vendored
Executable file
@ -0,0 +1,103 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
25
local.properties
Executable file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Tue Mar 02 14:17:16 CST 2021
|
||||
hwsdk.dir=XXX
|
||||
native.dir=XXX
|
||||
nodejs.dir=XXX
|
16
settings.gradle
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
include ':entry'
|