update launcher code
Signed-off-by: LiuZhenyu2021 <liuzhenyu.liuzhenyu@huawei.com>
19
OAT.xml
@ -55,15 +55,18 @@
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath" name="launcher/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="launcher/src/main/js/default/common/pics/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="launcher/src/main/js/default/common/pics/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="product/phone/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="product/phone/src/main/ets/default/common/pics/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="product/phone/src/main/ets/default/common/pics/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/recents/src/main/ets/default/common/pics/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/recents/src/main/ets/default/common/pics/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/recents/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/recents/src/main/resources/base/media/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/settings/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="figures/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="settings/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="recents/src/main/js/default/common/pics/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="launcher/src/main/js/default/common/pics/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="recents/src/main/js/default/common/pics/.*.jpg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="recents/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/layoutmanager/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="feature/settings/src/main/resources/base/media/.*.svg" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="common/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
|
269
README_zh.md
@ -5,66 +5,72 @@ Launcher 采用纯 JS 语言开发,开发过程中不涉及任何 Java 部分
|
||||
## 2. 工程结构
|
||||
### 目录结构
|
||||
```
|
||||
/applications/standard/launcher/
|
||||
├── launcher # 主launcher模块目录
|
||||
/applications
|
||||
├── common # 公共模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── js # JS代码目录
|
||||
│ ├── ets # ets代码目录
|
||||
│ ├── default
|
||||
│ ├── common # JS代码目录
|
||||
│ ├── cache # 缓存目录
|
||||
│ ├── colors # 颜色目录
|
||||
│ ├── component # 自定义组件目录
|
||||
│ ├── configs # 应用配置对象目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── css # 样式目录
|
||||
│ ├── model # Model层代码目录
|
||||
│ ├── pics # 应用图片目录
|
||||
│ ├── utils # 工具类代码目录
|
||||
│ ├── i18n # 国际化目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── AppGridView # 图标网格的View目录
|
||||
│ ├── AppListView # 图标列表的View目录
|
||||
│ ├── EntryView # 应用入口的View目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── app # 应用管理业务代码目录
|
||||
│ ├── entry # 应用入口业务代码目录
|
||||
│ ├── base # 公共presenter层代码目录
|
||||
│ ├── cache # 缓存目录
|
||||
│ ├── common # ets代码目录
|
||||
│ ├── configs # 应用配置对象目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── model # Model层代码目录
|
||||
│ ├── manager # manager代码目录
|
||||
│ ├── uicomponents # 自定义组件目录
|
||||
│ ├── utils # 工具类代码目录
|
||||
│ ├── resources # 资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
├── recents # 最近任务模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── js # JS代码目录
|
||||
│ ├── default
|
||||
│ ├── common # JS代码目录
|
||||
│ ├── component # 自定义组件目录
|
||||
│ ├── css # 样式目录
|
||||
│ ├── model # Model层代码目录
|
||||
│ ├── pics # 应用图片目录
|
||||
│ ├── i18n # 国际化目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── recent # 最近任务的View目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── recent # 最近任务业务代码目录
|
||||
│ ├── resources # 最近任务模块资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
├── settings # 桌面设置模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── js # JS代码目录
|
||||
│ ├── default
|
||||
│ ├── common # JS代码目录
|
||||
│ ├── configs # 应用配置对象目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── model # Model层代码目录
|
||||
│ ├── pics # 应用图片目录
|
||||
│ ├── i18n # 国际化目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── settings # 最近任务的View目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── settings # 最近任务业务代码目录
|
||||
│ ├── resources # 最近任务模块资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
├── feature # feature层模块目录
|
||||
│ └── layoutmanager # 主launcher模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── ets # ets代码目录
|
||||
│ ├── default
|
||||
│ ├── common # ets代码目录
|
||||
│ ├── configs # 应用配置对象目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── layout # 业务特性的View层目录
|
||||
│ ├── resources # 资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
│ └── recents # 最近任务模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── ets # ets代码目录
|
||||
│ ├── default
|
||||
│ ├── common # ets代码目录
|
||||
│ ├── model # Model层代码目录
|
||||
│ ├── pics # 应用图片目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── resources # 资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
│ └── settings # 桌面设置模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── ets # ets代码目录
|
||||
│ ├── default
|
||||
│ ├── common # ets代码目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── presenter # presenter层代码目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── resources # 资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
├── product # 产品层模块目录
|
||||
│ └── phone # phone模式模块目录
|
||||
│ └── src
|
||||
│ └── main
|
||||
│ ├── ets # ets代码目录
|
||||
│ ├── default
|
||||
│ ├── common # ets代码目录
|
||||
│ ├── configs # 应用配置对象目录
|
||||
│ ├── constants # 应用常量对象目录
|
||||
│ ├── pics # 应用图片目录
|
||||
│ ├── pages # 业务特性的View层目录
|
||||
│ ├── resources # 资源目录
|
||||
│ ├── config.json # 项目配置信息
|
||||
```
|
||||
### 整体架构
|
||||
![](./figures/launcherl2-en.png)
|
||||
@ -95,80 +101,8 @@ Launcher 整体以 OpenHarmony 既有的 MVVM 的 App 架构设计为基础,
|
||||
|settings|展现层|SettingsPresenter|设置桌面画面的业务逻辑类,主要职责是处理来自视图层的请求,业务逻辑处理后实现功能或者向模型层发送请求。|
|
||||
|settings|模型层|SettingsModel|接收展现层EntryPresenter和SettingsPresenter发送过来的请求,为其提供所需要的数据或实现其请求的功能。|
|
||||
|
||||
## 3. 代码使用
|
||||
### 代码下载
|
||||
基于L2的 Launcher 代码可以采用从码云上克隆的方式下载。
|
||||
[下载地址](https://gitee.com/openharmony/applications_launcher)
|
||||
#### 从码云克隆代码
|
||||
##### 1.配置SSH公钥
|
||||
1. 通过[登录网址](https://gitee.com/login)登录码云
|
||||
2. 在码云的个人设置中设置SSH公钥
|
||||
1. 生成SSH公私钥
|
||||
在命令窗口输入以下命令,邮箱地址替换为自己的邮箱地址,一直回车直至完成为止。
|
||||
```
|
||||
ssh-keygen -t rsa -C "xxxx@xxxx.com"
|
||||
```
|
||||
> 执行完成后,会在用户目录下的.ssh文件夹内生成 `id_rsa` 与 `id_rsa.pub` 两个文件,其中的 `id_rsa.pub` 即为生成的 SSH公钥
|
||||
> ![](./figures/git_ssh_pub_key.png)
|
||||
2. 复制公钥内容
|
||||
输入`cat .ssh/id_rsa.pub`,复制打印内容。
|
||||
![](./figures/git_ssh_pub_key_content.png)
|
||||
3. 在设置->安全设置->SSH公钥 中设置 SSH公钥
|
||||
将第二步中复制的内容按照画面提示粘贴到码云上相应的内容区域,并点击确定。
|
||||
![](./figures/gitee_ssh_key_setting.png)
|
||||
> 注意,在码云中,添加SSH公钥之后,需要进行账号的密码验证,验证通过才能成功添加。
|
||||
##### 2.下载代码
|
||||
1. 浏览器打开[下载地址](https://gitee.com/openharmony/applications_launcher)。
|
||||
2. 点击“克隆/下载”按钮,选择 SSH,点击“复制”按钮。
|
||||
![](./figures/source_download_1.png)
|
||||
3. 在本地新建 Launcher 目录,在 Launcher 目录中执行如下命令
|
||||
```
|
||||
git clone 步骤2中复制的地址
|
||||
```
|
||||
![](./figures/git_clone_done.png)
|
||||
### 环境搭建
|
||||
#### 1. 下载安装 DevEco Studio
|
||||
Launcher 使用 DevEco Studio 进行开发,开发前需要下载 DevEco Studio 。
|
||||
|
||||
**下载**
|
||||
|
||||
在下载页面下载 DevEco Studio 的安装包压缩文件([下载地址](https://developer.harmonyos.com/cn/develop/deveco-studio#download))。
|
||||
下载页面如下:
|
||||
|
||||
![](./figures/ds_download.png)
|
||||
|
||||
> 注:下载 DevEco Studio 需要注册华为账号。
|
||||
> ![](figures/hw_register.png)
|
||||
|
||||
**安装**
|
||||
|
||||
将下载下来的压缩包解压,得到安装文件如图:
|
||||
|
||||
![](./figures/ds_exe.png)
|
||||
|
||||
双击安装文件进行安装,安装过程如图所示:
|
||||
|
||||
![](./figures/ds_install_1.png)
|
||||
|
||||
![](./figures/ds_install_2.png)
|
||||
|
||||
#### 2. 安装开发 SDK
|
||||
DevEco Studio 在安装完成之后会自动下载开发 SDK 下载过程如下图所示:
|
||||
|
||||
![](./figures/sdk_downloading.png)
|
||||
|
||||
|
||||
File → Open 选择工程目录,点击 OK。
|
||||
|
||||
![](./figures/ds_import_project.png)
|
||||
|
||||
![](./figures/ds_import_project_ok.png)
|
||||
|
||||
选择Build → Build Haps(s)/APP(s) → Build Hap(s)
|
||||
|
||||
![](./figures/ds_build_haps.png)
|
||||
|
||||
## 4. 基础开发说明
|
||||
## 3. 基础开发说明
|
||||
### 异步回调的使用
|
||||
在JS工程中,异步回调的使用是一个非常常见的编码需求,在 OpenHarmony 的开发中也不例外,这里以获取应用列表信息为例,演示如何在 OpenHarmony 的应用开发中使用回调方法。
|
||||
|
||||
@ -184,7 +118,7 @@ export default class AppModel {
|
||||
getApplicationInfos(callback) {
|
||||
|
||||
// callback 为传入的异步回调方法
|
||||
BundleMgr.getBundleInfos().then(data => {
|
||||
BundleMgr.getAllBundleInfo().then(data => {
|
||||
|
||||
// 在获取数据成功后,执行回调方法
|
||||
callback(data);
|
||||
@ -234,46 +168,19 @@ export default {
|
||||
|
||||
这样,在 `AppModel.js` 中获取数据的方法 `getApplicationInfos` 异步执行成功后,就会将数据通过我们绑定的回调方法,回传到 `AppView.js` 中。
|
||||
|
||||
### 多语言支持
|
||||
### 资源引用
|
||||
#### 定义资源文件
|
||||
- 在 `src/main/js/default/i18n/`目录下,根据不同的语言定义 `.json` 资源文件。
|
||||
![](./figures/ds_i18n_files.png)
|
||||
- 在 `src/main/resources/`目录下,根据不同的资源类型,定义资源文件。
|
||||
#### 引用资源
|
||||
- 在有对应page的js文件中,可直接通过`$t()`引用。
|
||||
- 在有对应page的js文件中,可直接通过`$r()`引用。
|
||||
```` JavaScript
|
||||
this.title = this.$t('strings.world');
|
||||
this.title = this.$r('app.string.title');
|
||||
|
||||
````
|
||||
- 在没有对应page的js文件中,需要参考如下代码,通过有对应page的js文件引用。
|
||||
```` JavaScript
|
||||
// 在page页面中定义 globalThis.$globalT
|
||||
|
||||
globalThis.$globalT =null;
|
||||
export default {
|
||||
data: {
|
||||
title: 'World'
|
||||
},
|
||||
onInit(){
|
||||
globalThis.$globalT =this.$t.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
````
|
||||
```` JavaScript
|
||||
// 在非page页面使用方式
|
||||
|
||||
globalThis.$globalT =null;
|
||||
export default class TestClass {
|
||||
constructor{
|
||||
this.title = globalThis.$globalT('strings.world');
|
||||
}
|
||||
}
|
||||
|
||||
````
|
||||
## 5. 典型接口的使用
|
||||
## 4. 典型接口的使用
|
||||
1. 启动 Ability
|
||||
```JS
|
||||
import FeatureAbility from '@ohos.ability.featureability';
|
||||
import FeatureAbility from '@ohos.ability.featureAbility';
|
||||
//参数paramAbilityname, paramBundleName 是对应应用的abilityname,bundleName
|
||||
startAbility(paramAbilityname, paramBundleName) {
|
||||
FeatureAbility.startAbility({
|
||||
@ -320,8 +227,8 @@ getBundleInfo(bundleName) {
|
||||
import BundleMgr from '@ohos.bundle';
|
||||
|
||||
getApplicationInfos() {
|
||||
BundleMgr.getBundleInfos().then((data) => {
|
||||
console.info('Launcher getApplicationInfos '+JSON.stringify(data));
|
||||
BundleMgr.getAllBundleInfo().then((data) => {
|
||||
console.info('Launcher getAllBundleInfo '+JSON.stringify(data));
|
||||
});
|
||||
}
|
||||
```
|
||||
@ -334,6 +241,7 @@ uninstallApp(bundleName) {
|
||||
data.uninstall(bundleName,{
|
||||
param: {
|
||||
userId: 0,
|
||||
installFlag: 0,
|
||||
isKeepData: false
|
||||
}
|
||||
})
|
||||
@ -362,7 +270,7 @@ get() {
|
||||
|
||||
6. 获取最近任务列表
|
||||
```JS
|
||||
import NapiAbilityManager from '@ohos.app.abilitymanager';
|
||||
import NapiAbilityManager from '@ohos.app.abilityManager';
|
||||
|
||||
getRecentMissions() {
|
||||
NapiAbilityManager.queryRunningAbilityMissionInfos().then((data) => {
|
||||
@ -373,7 +281,7 @@ getRecentMissions() {
|
||||
|
||||
7. 移除指定任务
|
||||
```JS
|
||||
import NapiAbilityManager from '@ohos.app.abilitymanager';
|
||||
import NapiAbilityManager from '@ohos.app.abilityManager';
|
||||
//参数missionId是所选择的最近任务的missionId
|
||||
removeMission() {
|
||||
NapiAbilityManager.removeMission(missionId).then((data) => {
|
||||
@ -382,7 +290,7 @@ removeMission() {
|
||||
}
|
||||
```
|
||||
|
||||
## 6. 签名打包
|
||||
## 5. 签名打包
|
||||
### 签名
|
||||
#### 签名文件的获取
|
||||
1. 拷贝 OpenHarmony 标准版的 prebuilts\signcenter 目录到操作目录。
|
||||
@ -406,19 +314,6 @@ DevEco Studio 支持 debug 与 release 两种打包类型。可以在 OhosBuild
|
||||
|
||||
![](./figures/ds_ohosbuild_variants.png)
|
||||
|
||||
#### debug打包
|
||||
1. 代码准备完成后,在 OhosBuild Variants 窗口的 Selected Variant 中选择 debug。
|
||||
|
||||
![](./figures/ds_ohosbuild_variants_debug.png)
|
||||
|
||||
2. 选择Build → Build Haps(s)/APP(s) → Build Hap(s)
|
||||
|
||||
![](./figures/ds_build_haps.png)
|
||||
|
||||
3. 编译完成后,hap包会生成在工程目录下的 `\build\outputs\hap\debug\phone\`路径下(如果没有配置签名,则只会生成未签名的hap包)
|
||||
|
||||
![](./figures/ds_ohosbuild_output_dir_debug.png)
|
||||
|
||||
#### release打包
|
||||
1. 代码准备完成后,在 OhosBuild Variants 窗口的 Selected Variant 中选择 release
|
||||
|
||||
@ -428,22 +323,22 @@ DevEco Studio 支持 debug 与 release 两种打包类型。可以在 OhosBuild
|
||||
|
||||
![](./figures/ds_build_haps.png)
|
||||
|
||||
3. 编译完成后,hap包会生成在工程目录下的 `\build\outputs\hap\debug\phone\`路径下(如果没有配置签名,则只会生成未签名的hap包)
|
||||
3. 编译完成后,hap包会生成在工程目录下的 `\build\outputs\hap\release\`路径下(如果没有配置签名,则只会生成未签名的hap包)
|
||||
|
||||
![](./figures/ds_ohosbuild_output_dir_debug.png)
|
||||
![](./figures/ds_ohosbuild_output_dir_release.png)
|
||||
|
||||
|
||||
## 7. 安装、运行、调试
|
||||
## 6. 安装、运行、调试
|
||||
### 应用安装
|
||||
配置 hdc:
|
||||
进入SDK目录中的toolchains文件夹下,获取文件路径:
|
||||
|
||||
![](./figures/screenshot-20210521-105407.png)
|
||||
![](./figures/sdk_catalogue.png)
|
||||
|
||||
|
||||
并将此路径配置到环境变量中:
|
||||
|
||||
![](./figures/screenshot-20210521-111223.png)
|
||||
![](./figures/sdk_environment_variable.png)
|
||||
|
||||
重启电脑使环境变量生效
|
||||
|
||||
@ -464,10 +359,8 @@ DevEco Studio 支持 debug 与 release 两种打包类型。可以在 OhosBuild
|
||||
获取 root 权限与读写权限:
|
||||
|
||||
```
|
||||
hdc smode
|
||||
hdc target mount
|
||||
```
|
||||
> hdc smode 命令的作用是获取 root 权限,但是该命令在当前版本下可能仍不稳定,执行此命令可能导致后续的 hdc target mount 失败,在这里为可选命令
|
||||
|
||||
***T.B.D smode 不执行的情况下,hdc target mount 能否正常执行?***
|
||||
|
||||
@ -540,7 +433,7 @@ hilog | grep 过滤信息
|
||||
```
|
||||
hilog | grep Label
|
||||
```
|
||||
## 8. 贡献代码
|
||||
## 7. 贡献代码
|
||||
### Fork 代码仓库
|
||||
1. 在码云上打开 Launcher 代码仓库([仓库地址](https://gitee.com/openharmony/applications_launcher))。
|
||||
2. 点击仓库右上角的 Forked 按钮
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AppModel from '../common/model/AppModel.ets'
|
||||
import SettingsModel from '../common/model/SettingsModel.ets'
|
||||
import AppListInfoCacheManager from '../cache/AppListInfoCacheManager.ets'
|
||||
|
@ -29,11 +29,11 @@ export default class AppListInfoCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache from disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache get from the memory or disk
|
||||
*/
|
||||
* Get cache from disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache get from the memory or disk
|
||||
*/
|
||||
getCache(key) {
|
||||
console.info("Launcher AppListInfoCacheManager getCache key = " + key);
|
||||
let cache = this.lruCache.getCache(key);
|
||||
@ -45,11 +45,11 @@ export default class AppListInfoCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache to disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
* Set cache to disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
setCache(key, value) {
|
||||
console.info("Launcher AppListInfoCacheManager setCache key = " + key + " value = " + value);
|
||||
this.lruCache.putCache(key, value);
|
||||
@ -57,8 +57,8 @@ export default class AppListInfoCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache of both disk and memory.
|
||||
*/
|
||||
* Clear cache of both disk and memory.
|
||||
*/
|
||||
clearCache() {
|
||||
console.info("Launcher AppListInfoCacheManager clearCache");
|
||||
this.lruCache.clear();
|
||||
|
@ -32,11 +32,11 @@ export default class AppResourceCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache from disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache get from memory or disk
|
||||
*/
|
||||
* Get cache from disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache get from memory or disk
|
||||
*/
|
||||
getCache(bundleName, key) {
|
||||
console.info("Launcher AppResourceCacheManager getCache bundleName = " + bundleName + " key = " + key);
|
||||
let cache = this.getCacheFromMemory(bundleName, key);
|
||||
@ -53,11 +53,11 @@ export default class AppResourceCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache to disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
* Set cache to disk or memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
setCache(bundleName, key, value) {
|
||||
console.info("Launcher AppResourceCacheManager setCache bundleName = " + bundleName + " key = " + key);
|
||||
this.setCacheToMemory(bundleName, key, value);
|
||||
@ -67,8 +67,8 @@ export default class AppResourceCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache of both disk and memory.
|
||||
*/
|
||||
* Clear cache of both disk and memory.
|
||||
*/
|
||||
clearCache() {
|
||||
console.info("Launcher AppResourceCacheManager clearCache");
|
||||
this.memoryCache.clear();
|
||||
|
@ -29,8 +29,8 @@ export default class DiskLruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the cache whether the file has data.
|
||||
*/
|
||||
* Init the cache whether the file has data.
|
||||
*/
|
||||
initMap() {
|
||||
console.info("Launcher DiskLruCache initMap start execution");
|
||||
try {
|
||||
@ -45,11 +45,11 @@ export default class DiskLruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache from disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - target cache object
|
||||
*/
|
||||
* Get cache from disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - target cache object
|
||||
*/
|
||||
getCache(key) {
|
||||
if (this.cache.has(key)) {
|
||||
// exist and update
|
||||
@ -66,11 +66,11 @@ export default class DiskLruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Put cache to disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
* Put cache to disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
putCache(key, value) {
|
||||
if (this.cache.has(key)) {
|
||||
// exist and update
|
||||
@ -89,18 +89,18 @@ export default class DiskLruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove cache of corresponding key.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
*/
|
||||
* Remove cache of corresponding key.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
*/
|
||||
remove(key) {
|
||||
this.cache.delete(key);
|
||||
DiskLruFileUtils.removeFile(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache of disk.
|
||||
*/
|
||||
* Clear cache of disk.
|
||||
*/
|
||||
clear() {
|
||||
this.cache.forEach(function (value, key) {
|
||||
DiskLruFileUtils.removeFile(key);
|
||||
|
@ -25,11 +25,11 @@ const READ_DATA_SIZE = 4096;
|
||||
export default class DiskLruFileUtils {
|
||||
|
||||
/**
|
||||
* Read Json file from disk by bundleName.
|
||||
*
|
||||
* @param {string} bundleName - bundleName of the target file
|
||||
* @return {object} read object from file
|
||||
*/
|
||||
* Read Json file from disk by bundleName.
|
||||
*
|
||||
* @param {string} bundleName - bundleName of the target file
|
||||
* @return {object} read object from file
|
||||
*/
|
||||
static readJsonObj(bundleName) {
|
||||
console.info("Launcher FileUtil readJsonObj start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
@ -37,11 +37,11 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Json file from disk by file path.
|
||||
*
|
||||
* @param {string} path - path of the target file.
|
||||
* @return {object} read object from file
|
||||
*/
|
||||
* Read Json file from disk by file path.
|
||||
*
|
||||
* @param {string} path - path of the target file.
|
||||
* @return {object} read object from file
|
||||
*/
|
||||
static readJsonFile(path) {
|
||||
console.info("Launcher FileUtil readJsonFile start execution");
|
||||
let readStreamSync = null;
|
||||
@ -58,11 +58,11 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Write Json object to a file.
|
||||
*
|
||||
* @param {object} jsonObj - target JSON object will be written
|
||||
* @param {string} bundleName - use bundleName as target file name
|
||||
*/
|
||||
* Write Json object to a file.
|
||||
*
|
||||
* @param {object} jsonObj - target JSON object will be written
|
||||
* @param {string} bundleName - use bundleName as target file name
|
||||
*/
|
||||
static writeJsonObj(jsonObj, bundleName) {
|
||||
console.info("Launcher FileUtil writeJsonObj start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
@ -80,10 +80,10 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a key that maps the image as value.
|
||||
*
|
||||
* @param {string} content - the key maps the image file
|
||||
*/
|
||||
* Record a key that maps the image as value.
|
||||
*
|
||||
* @param {string} content - the key maps the image file
|
||||
*/
|
||||
static writeJournal(content) {
|
||||
let writeStreamSync = null;
|
||||
try {
|
||||
@ -99,10 +99,10 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the keys that map the images.
|
||||
*
|
||||
* @return {object} object read from file
|
||||
*/
|
||||
* Get the keys that map the images.
|
||||
*
|
||||
* @return {object} object read from file
|
||||
*/
|
||||
static readJournal() {
|
||||
console.info("Launcher FileUtil readJournal start execution");
|
||||
let readStreamSync = null;
|
||||
@ -118,11 +118,11 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read JSON object from a file.
|
||||
*
|
||||
* @param {object} readStreamSync - stream of target file
|
||||
* @return {object} object read from file stream
|
||||
*/
|
||||
* Read JSON object from a file.
|
||||
*
|
||||
* @param {object} readStreamSync - stream of target file
|
||||
* @return {object} object read from file stream
|
||||
*/
|
||||
static getContent(readStreamSync) {
|
||||
console.info("Launcher FileUtil getContent start");
|
||||
let bufArray = [];
|
||||
@ -155,10 +155,10 @@ export default class DiskLruFileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove file.
|
||||
*
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
*/
|
||||
* Remove file.
|
||||
*
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
*/
|
||||
static removeFile(bundleName) {
|
||||
try {
|
||||
console.info("Launcher FileUtil removeFile")
|
||||
|
32
common/src/main/ets/default/cache/LruCache.ets
vendored
@ -26,11 +26,11 @@ export default class LruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache from memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache from memory
|
||||
*/
|
||||
* Get cache from memory.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @return {object} - cache from memory
|
||||
*/
|
||||
getCache(key) {
|
||||
if (this.cache.has(key)) {
|
||||
// exist and update
|
||||
@ -45,11 +45,11 @@ export default class LruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Put cache to disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
* Put cache to disk.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
* @param {object} value - value of the cache map
|
||||
*/
|
||||
putCache(key, value) {
|
||||
if (this.cache.has(key)) {
|
||||
// exist and update
|
||||
@ -63,17 +63,17 @@ export default class LruCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove cache of corresponding key.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
*/
|
||||
* Remove cache of corresponding key.
|
||||
*
|
||||
* @param {string} key - key of the cache map
|
||||
*/
|
||||
remove(key) {
|
||||
this.cache.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache of memory.
|
||||
*/
|
||||
* Clear cache of memory.
|
||||
*/
|
||||
clear() {
|
||||
this.cache.clear();
|
||||
}
|
||||
|
@ -12,9 +12,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const DefaultLayoutConfig = {
|
||||
DefaultAppPageStartConfig: 'Grid',
|
||||
DefaultLayoutOptions: [{ name: 'List', value: 'List', checked: false }, { name: 'Grid', value: 'Grid', checked: false }],
|
||||
DefaultLayoutOptions: [
|
||||
{ name: 'List', value: 'List', checked: false },
|
||||
{ name: 'Grid', value: 'Grid', checked: false }
|
||||
],
|
||||
DefaultGridConfig: 0,
|
||||
DefaultRecentProcessLimit: 20,
|
||||
DefaultRecentProcessLimitArray: [
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const GridLayoutConfigs = {
|
||||
GridLayoutTable: [
|
||||
{
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const SystemApplication = {
|
||||
SystemApplicationName: 'com.ohos.launcher,com.ohos.systemui,com.ohos.devicemanagerui,com.ohos.callui,com.example.kikakeyboard'
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
public static DEFAULT_FONT_COLOR: string = '#ffffff'
|
||||
public static DEFAULT_ICON: string = '/common/pics/icon.png'
|
||||
@ -21,6 +22,7 @@ export default class StyleConstants {
|
||||
public static DEFAULT_APP_ITEM_HEIGHT: number = 95;
|
||||
public static PERCENTAGE_100: string = '100%'
|
||||
public static PERCENTAGE_85: string = '85%'
|
||||
public static PERCENTAGE_70: string = '70%'
|
||||
public static PERCENTAGE_15: string = '15%'
|
||||
public static DEFAULT_APP_IMAGE:string = '/common/pics/img_app_default.png'
|
||||
public static DEFAULT_DELETE_IMAGE:string = '/common/pics/ic_recent_delete.png'
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import BundleMgr from '@ohos.bundle';
|
||||
import FeatureAbility from '@ohos.ability.featureAbility';
|
||||
import Subscriber from '@ohos.commonevent';
|
||||
@ -114,10 +115,10 @@ export default class AppModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister install listener.
|
||||
*
|
||||
* @param {object} listener - install listener
|
||||
*/
|
||||
* Unregister install listener.
|
||||
*
|
||||
* @param {object} listener - install listener
|
||||
*/
|
||||
unregisterAppListInstallListener(listener) {
|
||||
let index = this.mAppListInstallListener.indexOf(listener);
|
||||
if (index != -1) {
|
||||
@ -126,10 +127,10 @@ export default class AppModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register uninstall listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
* Register uninstall listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
registerAppListUninstallListener(listener) {
|
||||
if (this.mAppListUninstallListener.indexOf(listener) == -1) {
|
||||
this.mAppListUninstallListener.push(listener);
|
||||
@ -137,10 +138,10 @@ export default class AppModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister uninstall listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
* Unregister uninstall listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
unregisterAppListUninstallListener(listener) {
|
||||
let index = this.mAppListUninstallListener.indexOf(listener);
|
||||
if (index != -1) {
|
||||
@ -149,10 +150,10 @@ export default class AppModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register change listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
* Register change listener.
|
||||
*
|
||||
* @param {object} listener - uninstall listener
|
||||
*/
|
||||
registerAppListChangeListener(listener) {
|
||||
if (this.mAppListChangeListener.indexOf(listener) == -1) {
|
||||
this.mAppListChangeListener.push(listener);
|
||||
@ -160,10 +161,10 @@ export default class AppModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister change listener.
|
||||
*
|
||||
* @param {object} listener - change listener
|
||||
*/
|
||||
* Unregister change listener.
|
||||
*
|
||||
* @param {object} listener - change listener
|
||||
*/
|
||||
unregisterAppListChangeListener(listener) {
|
||||
let index = this.mAppListChangeListener.indexOf(listener);
|
||||
if (index != -1) {
|
||||
@ -201,7 +202,8 @@ export default class AppModel {
|
||||
this.reportAppInstallEvent(callbackData.event, callbackData);
|
||||
return;
|
||||
}
|
||||
BundleMgr.getBundleInfo(callbackData.bundleName, IF_GET_ABILITY).then(data => {
|
||||
BundleMgr.getBundleInfo(callbackData.bundleName, IF_GET_ABILITY)
|
||||
.then(data => {
|
||||
console.info('Launcher AppModel installation subscriber getBundleInfo ' + JSON.stringify(data));
|
||||
let bundleInfo = {
|
||||
System: data.appInfo.systemApp,
|
||||
@ -213,7 +215,8 @@ export default class AppModel {
|
||||
abilityName: data.abilityInfos[0].name,
|
||||
};
|
||||
this.reportAppInstallEvent(callbackData.event, bundleInfo);
|
||||
}).catch(e => {
|
||||
})
|
||||
.catch(e => {
|
||||
console.error("Launcher AppModel installation subscriber getBundleInfo error ");
|
||||
});
|
||||
} else {
|
||||
|
@ -12,83 +12,84 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class ILayoutConfig {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the layout view type.
|
||||
*
|
||||
* @return {string} Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
* Get the layout view type.
|
||||
*
|
||||
* @return {string} Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
public getAppPageStartConfig() {
|
||||
return this.loadAppPageStartConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the layout view type.
|
||||
*
|
||||
* @param {string} type - Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
* Set the layout view type.
|
||||
*
|
||||
* @param {string} type - Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
public setAppPageStartConfig(type) {
|
||||
this.saveAppPageStartConfig(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grid layout config id.
|
||||
*
|
||||
* @return {number} grid layout config id.
|
||||
*/
|
||||
* Get grid layout config id.
|
||||
*
|
||||
* @return {number} grid layout config id.
|
||||
*/
|
||||
public getGridConfig(): number {
|
||||
return this.loadGridConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grid layout config id.
|
||||
*
|
||||
* @param {number} id - layout config id.
|
||||
*/
|
||||
* Set grid layout config id.
|
||||
*
|
||||
* @param {number} id - layout config id.
|
||||
*/
|
||||
public setGridConfig(id) {
|
||||
this.saveGridConfig(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recent process max limit.
|
||||
*
|
||||
* @return {number} recent process max limit.
|
||||
*/
|
||||
* Get recent process max limit.
|
||||
*
|
||||
* @return {number} recent process max limit.
|
||||
*/
|
||||
public getRecentProcessLimit() {
|
||||
return this.loadRecentProcessLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set recent process max limit.
|
||||
*
|
||||
* @param {number} num - Recent process max limit.
|
||||
*/
|
||||
* Set recent process max limit.
|
||||
*
|
||||
* @param {number} num - Recent process max limit.
|
||||
*/
|
||||
public setRecentProcessLimit(num) {
|
||||
this.saveRecentProcessLimit(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get layout information of grid view.
|
||||
*
|
||||
* @return {object} layout information.
|
||||
*/
|
||||
* Get layout information of grid view.
|
||||
*
|
||||
* @return {object} layout information.
|
||||
*/
|
||||
public getGridLayoutInfo() {
|
||||
return this.loadGridLayoutInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set layout information of grid view.
|
||||
*/
|
||||
* Set layout information of grid view.
|
||||
*/
|
||||
public setGridLayoutInfo(layoutInfo) {
|
||||
this.saveGridLayoutInfo(layoutInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove layout information of grid view.
|
||||
*/
|
||||
* Remove layout information of grid view.
|
||||
*/
|
||||
public deleteGridLayoutInfo() {
|
||||
this.removeGridLayoutInfo();
|
||||
}
|
||||
@ -102,56 +103,56 @@ export default class ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the launcher layout view type.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the launcher layout view type.
|
||||
*/
|
||||
public loadAppPageStartConfig() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the launcher layout view type.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the launcher layout view type.
|
||||
*/
|
||||
public saveAppPageStartConfig(type) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the launcher grid view layout config id.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the launcher grid view layout config id.
|
||||
*/
|
||||
public loadGridConfig(): any {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the launcher grid view layout config id.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the launcher grid view layout config id.
|
||||
*/
|
||||
public saveGridConfig(id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the recent process max limit.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the recent process max limit.
|
||||
*/
|
||||
public loadRecentProcessLimit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the recent process max limit.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the recent process max limit.
|
||||
*/
|
||||
public saveRecentProcessLimit(num) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the layout information of grid view.
|
||||
*/
|
||||
public loadGridLayoutInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the layout information of grid view.
|
||||
*/
|
||||
public saveGridLayoutInfo(layoutInfo) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , remove layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , remove layout information of grid view.
|
||||
*/
|
||||
public removeGridLayoutInfo() {
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import FeatureAbility from '@ohos.ability.featureAbility';
|
||||
import GridLayoutConfigs from '../configs/GridLayoutConfigs.ets'
|
||||
import LayoutConfigManager from '../../manager/LayoutConfigManager.ets'
|
||||
import FileUtils from '../../utils/FileUtils.ets'
|
||||
import ILayoutConfig from './ILayoutConfig.ets'
|
||||
import FeatureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
const defaultLayoutInfoFilePath = "/data/accounts/account_0/applications/com.ohos.launcher/com.ohos.launcher/assets/launcher/resources/rawfile/layoutInfo.json";
|
||||
|
||||
@ -36,33 +37,33 @@ export default class SettingsModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the grid view presetting collection of layout config information table.
|
||||
*
|
||||
* @return {object} Grid view presetting collection object.
|
||||
*/
|
||||
* Get the grid view presetting collection of layout config information table.
|
||||
*
|
||||
* @return {object} Grid view presetting collection object.
|
||||
*/
|
||||
public getGridLayoutTable(): any {
|
||||
return this.mGridLayoutTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default layout information of grid view.
|
||||
*
|
||||
* @return {object} Default layout information of grid view.
|
||||
*/
|
||||
* Get default layout information of grid view.
|
||||
*
|
||||
* @return {object} Default layout information of grid view.
|
||||
*/
|
||||
public getDefaultLayoutInfo(): any {
|
||||
return FileUtils.readJsonFile(defaultLayoutInfoFilePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get layout config of grid view.
|
||||
*
|
||||
* @return {object} Layout config of grid view.
|
||||
*/
|
||||
* Get layout config of grid view.
|
||||
*
|
||||
* @return {object} Layout config of grid view.
|
||||
*/
|
||||
public getGridConfig(): any {
|
||||
this.mGridConfig = this.mLayoutConfig.getGridConfig();
|
||||
let gridLayout = this.mGridLayoutTable[0];
|
||||
for(let i = 0; i < this.mGridLayoutTable.length; i++) {
|
||||
if(this.mGridLayoutTable[i].id == this.mGridConfig) {
|
||||
for (let i = 0; i < this.mGridLayoutTable.length; i++) {
|
||||
if (this.mGridLayoutTable[i].id == this.mGridConfig) {
|
||||
gridLayout = this.mGridLayoutTable[i];
|
||||
break;
|
||||
}
|
||||
@ -71,76 +72,76 @@ export default class SettingsModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set layout config id of grid view.
|
||||
*
|
||||
* @param {string} id - Layout config id of grid view.
|
||||
*/
|
||||
* Set layout config id of grid view.
|
||||
*
|
||||
* @param {string} id - Layout config id of grid view.
|
||||
*/
|
||||
public setGridConfig(id) {
|
||||
this.mLayoutConfig.setGridConfig(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recent process max limit.
|
||||
*
|
||||
* @return {number} recent process max limit.
|
||||
*/
|
||||
* Get recent process max limit.
|
||||
*
|
||||
* @return {number} recent process max limit.
|
||||
*/
|
||||
public getRecentProcessLimit(): any {
|
||||
return this.mLayoutConfig.getRecentProcessLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set recent process max limit.
|
||||
*
|
||||
* @param {number} num - Recent process max limit.
|
||||
*/
|
||||
* Set recent process max limit.
|
||||
*
|
||||
* @param {number} num - Recent process max limit.
|
||||
*/
|
||||
public setRecentProcessLimit(num) {
|
||||
this.mLayoutConfig.setRecentProcessLimit(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the layout view type.
|
||||
*
|
||||
* @return {string} Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
* Get the layout view type.
|
||||
*
|
||||
* @return {string} Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
public getAppPageStartConfig(): any {
|
||||
return this.mLayoutConfig.getAppPageStartConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the layout view type.
|
||||
*
|
||||
* @param {string} type - Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
* Set the layout view type.
|
||||
*
|
||||
* @param {string} type - Layout view type, should one of 'Grid' or 'List' which is stored in LayoutConstants class.
|
||||
*/
|
||||
public setAppPageStartConfig(type) {
|
||||
this.mLayoutConfig.setAppPageStartConfig(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get layout information of grid view.
|
||||
*
|
||||
* @return {object} layout information.
|
||||
*/
|
||||
* Get layout information of grid view.
|
||||
*
|
||||
* @return {object} layout information.
|
||||
*/
|
||||
public getLayoutInfo(): any {
|
||||
return this.mLayoutConfig.getGridLayoutInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set layout information of grid view.
|
||||
*/
|
||||
* Set layout information of grid view.
|
||||
*/
|
||||
public setLayoutInfo(layoutInfo) {
|
||||
this.mLayoutConfig.setGridLayoutInfo(layoutInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove layout information of grid view.
|
||||
*/
|
||||
* Remove layout information of grid view.
|
||||
*/
|
||||
public deleteLayoutInfo() {
|
||||
this.mLayoutConfig.deleteGridLayoutInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close settings.
|
||||
*/
|
||||
* Close settings.
|
||||
*/
|
||||
closeSettings() {
|
||||
console.info("Launcher settings SettingsModel closeSettings start")
|
||||
FeatureAbility.terminateAbility()
|
||||
|
@ -12,8 +12,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ILayoutConfig from './ILayoutConfig.ets'
|
||||
|
||||
import Storage from '@ohos.data.storage';
|
||||
import ILayoutConfig from './ILayoutConfig.ets'
|
||||
import DefaultLayoutConfig from '../configs/DefaultLayoutConfig.ets'
|
||||
|
||||
const QEUIPMENT_TYPE = 'EquipmentType';
|
||||
@ -40,8 +41,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the launcher layout view type.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the launcher layout view type.
|
||||
*/
|
||||
public loadAppPageStartConfig() {
|
||||
console.info('Launcher mPreferences get APP_PAGE_START_CONFIG');
|
||||
let data = mPreferences.getSync(APP_PAGE_START_CONFIG, DefaultLayoutConfig.DefaultAppPageStartConfig);
|
||||
@ -50,8 +51,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the launcher layout view type.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the launcher layout view type.
|
||||
*/
|
||||
public saveAppPageStartConfig(type) {
|
||||
console.info('Launcher mPreferences put type' + type);
|
||||
mPreferences.putSync(APP_PAGE_START_CONFIG, type);
|
||||
@ -60,8 +61,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the launcher grid view layout config id.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the launcher grid view layout config id.
|
||||
*/
|
||||
public loadGridConfig() {
|
||||
console.info('Launcher mPreferences get GRID_CONFIG');
|
||||
let data = mPreferences.getSync(GRID_CONFIG, DefaultLayoutConfig.DefaultGridConfig);
|
||||
@ -70,8 +71,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the launcher grid view layout config id.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the launcher grid view layout config id.
|
||||
*/
|
||||
public saveGridConfig(id) {
|
||||
console.info('Launcher mPreferences put id' + id);
|
||||
mPreferences.putSync(GRID_CONFIG, id);
|
||||
@ -80,8 +81,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the recent process max limit.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the recent process max limit.
|
||||
*/
|
||||
public loadRecentProcessLimit() {
|
||||
console.info('Launcher mPreferences get');
|
||||
let data = mPreferences.getSync(RECENT_PROCESS_LIMIT, DefaultLayoutConfig.DefaultRecentProcessLimit);
|
||||
@ -90,8 +91,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the recent process max limit.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the recent process max limit.
|
||||
*/
|
||||
public saveRecentProcessLimit(num) {
|
||||
console.info('Launcher mPreferences put num' + num);
|
||||
mPreferences.putSync(RECENT_PROCESS_LIMIT, num);
|
||||
@ -100,8 +101,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , load the layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , load the layout information of grid view.
|
||||
*/
|
||||
public loadGridLayoutInfo() {
|
||||
console.info('Launcher StorageLayoutConfig loadGridLayoutInfo start');
|
||||
let data: any = mPreferences.getSync(GRID_LAYOUT_INFO, '');
|
||||
@ -114,8 +115,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , save the layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , save the layout information of grid view.
|
||||
*/
|
||||
public saveGridLayoutInfo(layoutInfo) {
|
||||
console.info('Launcher StorageLayoutConfig saveGridLayoutInfo start');
|
||||
mPreferences.putSync(GRID_LAYOUT_INFO, JSON.stringify(layoutInfo));
|
||||
@ -124,8 +125,8 @@ export default class StorageLayoutConfig extends ILayoutConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Should overridden by sub-classes , remove layout information of grid view.
|
||||
*/
|
||||
* Should overridden by sub-classes , remove layout information of grid view.
|
||||
*/
|
||||
public removeGridLayoutInfo() {
|
||||
console.info('Launcher StorageLayoutConfig removeGridLayoutInfo start');
|
||||
mPreferences.deleteSync(GRID_LAYOUT_INFO);
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import StorageLayoutConfig from '../common/model/StorageLayoutConfig.ets'
|
||||
|
||||
export default class LayoutConfigManager {
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Resmgr from '@ohos.resourceManager';
|
||||
import AppResourceCacheManager from '../cache/AppResourceCacheManager.ets'
|
||||
import CheckEmptyUtils from '../utils/CheckEmptyUtils.ets'
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ResourceManager from '../manager/ResourceManager.ets'
|
||||
import DefaultConstants from '../common/constants/DefaultConstants.ets'
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ResourceManager from '../manager/ResourceManager.ets'
|
||||
import DefaultConstants from '../common/constants/DefaultConstants.ets'
|
||||
|
||||
|
@ -12,9 +12,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ResourceManager from '../manager/ResourceManager.ets'
|
||||
import DefaultConstants from '../common/constants/DefaultConstants.ets'
|
||||
|
||||
const LOOP_TIME = 500;
|
||||
|
||||
@Component
|
||||
export default
|
||||
struct ListName {
|
||||
@ -28,6 +31,9 @@ struct ListName {
|
||||
public aboutToAppear(): void {
|
||||
this.mResourceManager = ResourceManager.getInstance();
|
||||
this.mResourceManager.getAppName(this.labelId, this.bundleName, this.appName, this.appNameLoadCallback.bind(this));
|
||||
setInterval(() => {
|
||||
this.updateName();
|
||||
}, LOOP_TIME);
|
||||
}
|
||||
|
||||
public appNameLoadCallback(name: string) {
|
||||
|
@ -15,34 +15,34 @@
|
||||
|
||||
export default {
|
||||
|
||||
/**
|
||||
* Check obj is empty.
|
||||
*
|
||||
* @param {object} obj
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
isEmpty(obj) {
|
||||
return (typeof obj === 'undefined' || obj == null || obj === '');
|
||||
},
|
||||
/**
|
||||
* Check obj is empty.
|
||||
*
|
||||
* @param {object} obj
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
isEmpty(obj) {
|
||||
return (typeof obj === 'undefined' || obj == null || obj === '');
|
||||
},
|
||||
|
||||
/**
|
||||
* Check str is empty.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
checkStrIsEmpty(str) {
|
||||
return str.trim().length == 0;
|
||||
},
|
||||
/**
|
||||
* Check str is empty.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
checkStrIsEmpty(str) {
|
||||
return str.trim().length == 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Check array is empty.
|
||||
*
|
||||
* @param {Array}arr
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
isEmptyArr(arr) {
|
||||
return arr.length == 0;
|
||||
}
|
||||
/**
|
||||
* Check array is empty.
|
||||
*
|
||||
* @param {Array}arr
|
||||
* @return {boolean} true(empty)
|
||||
*/
|
||||
isEmptyArr(arr) {
|
||||
return arr.length == 0;
|
||||
}
|
||||
}
|
||||
|
@ -23,106 +23,105 @@ const READ_DATA_SIZE = 4096;
|
||||
|
||||
export default class FileUtils {
|
||||
|
||||
/**
|
||||
* Read Json file from disk by file path.
|
||||
*
|
||||
* @param {string} path - path of the target file.
|
||||
* @return {object} - read object from file
|
||||
*/
|
||||
static readJsonFile(path) {
|
||||
console.info("Launcher FileUtil readJsonFile start execution");
|
||||
let readStreamSync = null;
|
||||
try {
|
||||
readStreamSync = Fileio.createStreamSync(path, "r");
|
||||
let content = this.getContent(readStreamSync);
|
||||
console.info("Launcher FileUtil readJsonFile finish execution" + content);
|
||||
return JSON.parse(content);
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil readJsonFile " + e);
|
||||
} finally {
|
||||
readStreamSync.closeSync();
|
||||
}
|
||||
/**
|
||||
* Read Json file from disk by file path.
|
||||
*
|
||||
* @param {string} path - path of the target file.
|
||||
* @return {object} - read object from file
|
||||
*/
|
||||
static readJsonFile(path) {
|
||||
console.info("Launcher FileUtil readJsonFile start execution");
|
||||
let readStreamSync = null;
|
||||
try {
|
||||
readStreamSync = Fileio.createStreamSync(path, "r");
|
||||
let content = this.getContent(readStreamSync);
|
||||
console.info("Launcher FileUtil readJsonFile finish execution" + content);
|
||||
return JSON.parse(content);
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil readJsonFile " + e);
|
||||
} finally {
|
||||
readStreamSync.closeSync();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read String from disk by bundleName.
|
||||
*
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
* @return {string} - read string from file
|
||||
*/
|
||||
static readStringFromFile(bundleName) {
|
||||
console.info("Launcher FileUtil readStringFromFile start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
let readStreamSync = null;
|
||||
try {
|
||||
readStreamSync = Fileio.createStreamSync(filePath, "r");
|
||||
let content = this.getContent(readStreamSync);
|
||||
console.info("Launcher FileUtil readStringFromFile finish execution" + content);
|
||||
return content;
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil readStringFromFile " + e);
|
||||
} finally {
|
||||
readStreamSync.closeSync();
|
||||
}
|
||||
/**
|
||||
* Read String from disk by bundleName.
|
||||
*
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
* @return {string} - read string from file
|
||||
*/
|
||||
static readStringFromFile(bundleName) {
|
||||
console.info("Launcher FileUtil readStringFromFile start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
let readStreamSync = null;
|
||||
try {
|
||||
readStreamSync = Fileio.createStreamSync(filePath, "r");
|
||||
let content = this.getContent(readStreamSync);
|
||||
console.info("Launcher FileUtil readStringFromFile finish execution" + content);
|
||||
return content;
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil readStringFromFile " + e);
|
||||
} finally {
|
||||
readStreamSync.closeSync();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write string to a file.
|
||||
*
|
||||
* @param {string} string - target string will be written to file
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
*/
|
||||
static writeStringToFile(string, bundleName) {
|
||||
console.info("Launcher FileUtil writeStringToFile start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
let writeStreamSync = null;
|
||||
try {
|
||||
writeStreamSync = Fileio.createStreamSync(filePath, "w+");
|
||||
writeStreamSync.writeSync(string);
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil writeStringToFile error: " + e);
|
||||
} finally {
|
||||
writeStreamSync.closeSync();
|
||||
console.info("Launcher FileUtil writeStringToFile close sync");
|
||||
}
|
||||
/**
|
||||
* Write string to a file.
|
||||
*
|
||||
* @param {string} string - target string will be written to file
|
||||
* @param {string} bundleName - bundleName as target file name
|
||||
*/
|
||||
static writeStringToFile(string, bundleName) {
|
||||
console.info("Launcher FileUtil writeStringToFile start execution");
|
||||
let filePath = writeFilePath + bundleName + ".json";
|
||||
let writeStreamSync = null;
|
||||
try {
|
||||
writeStreamSync = Fileio.createStreamSync(filePath, "w+");
|
||||
writeStreamSync.writeSync(string);
|
||||
} catch (e) {
|
||||
console.info("Launcher FileUtil writeStringToFile error: " + e);
|
||||
} finally {
|
||||
writeStreamSync.closeSync();
|
||||
console.info("Launcher FileUtil writeStringToFile close sync");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read JSON object from a file.
|
||||
*
|
||||
* @param {object} readStreamSync - stream of target file
|
||||
* @return {object} - object read from file stream
|
||||
*/
|
||||
static getContent(readStreamSync) {
|
||||
console.info("Launcher FileUtil getContent start");
|
||||
let bufArray = [];
|
||||
let totalLength = 0;
|
||||
let buf = new ArrayBuffer(READ_DATA_SIZE);
|
||||
let len = readStreamSync.readSync(buf);
|
||||
while (len != 0) {
|
||||
console.info("Launcher FileUtil getContent FileIO reading " + len);
|
||||
totalLength += len;
|
||||
if (len < READ_DATA_SIZE) {
|
||||
buf = buf.slice(0, len);
|
||||
bufArray.push(buf);
|
||||
break;
|
||||
}
|
||||
bufArray.push(buf);
|
||||
buf = new ArrayBuffer(READ_DATA_SIZE);
|
||||
len = readStreamSync.readSync(buf);
|
||||
}
|
||||
console.info("Launcher FileUtil getContent read finished " + totalLength);
|
||||
let contentBuf = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
for (let bufArr of bufArray) {
|
||||
console.info("Launcher FileUtil getContent collecting " + offset);
|
||||
let uInt8Arr = new Uint8Array(bufArr);
|
||||
contentBuf.set(uInt8Arr, offset);
|
||||
offset += uInt8Arr.byteLength;
|
||||
}
|
||||
let content = String.fromCharCode.apply(null, new Uint8Array(contentBuf));
|
||||
return content;
|
||||
/**
|
||||
* Read JSON object from a file.
|
||||
*
|
||||
* @param {object} readStreamSync - stream of target file
|
||||
* @return {object} - object read from file stream
|
||||
*/
|
||||
static getContent(readStreamSync) {
|
||||
console.info("Launcher FileUtil getContent start");
|
||||
let bufArray = [];
|
||||
let totalLength = 0;
|
||||
let buf = new ArrayBuffer(READ_DATA_SIZE);
|
||||
let len = readStreamSync.readSync(buf);
|
||||
while (len != 0) {
|
||||
console.info("Launcher FileUtil getContent FileIO reading " + len);
|
||||
totalLength += len;
|
||||
if (len < READ_DATA_SIZE) {
|
||||
buf = buf.slice(0, len);
|
||||
bufArray.push(buf);
|
||||
break;
|
||||
}
|
||||
bufArray.push(buf);
|
||||
buf = new ArrayBuffer(READ_DATA_SIZE);
|
||||
len = readStreamSync.readSync(buf);
|
||||
}
|
||||
|
||||
console.info("Launcher FileUtil getContent read finished " + totalLength);
|
||||
let contentBuf = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
for (let bufArr of bufArray) {
|
||||
console.info("Launcher FileUtil getContent collecting " + offset);
|
||||
let uInt8Arr = new Uint8Array(bufArr);
|
||||
contentBuf.set(uInt8Arr, offset);
|
||||
offset += uInt8Arr.byteLength;
|
||||
}
|
||||
let content = String.fromCharCode.apply(null, new Uint8Array(contentBuf));
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ class Pinyin {
|
||||
private full_dict;
|
||||
private polyphone;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -890,7 +889,6 @@ class Pinyin {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
getFullChar(ch) {
|
||||
for (let key in this.full_dict) {
|
||||
if (this.full_dict[key].indexOf(ch) != -1) {
|
||||
|
@ -20,12 +20,13 @@ import Pinyin from './Pinyin.ets'
|
||||
*/
|
||||
export default class PinyinSort {
|
||||
private pinyin;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param {boolean} checkPolyphone - Whether to check for polyphonic words.
|
||||
* @param {number} charCase - Output pinyin case mode, 0- first letter capitalization; 1- All lowercase; 2 - all uppercase.
|
||||
*/
|
||||
* Constructor.
|
||||
*
|
||||
* @param {boolean} checkPolyphone - Whether to check for polyphonic words.
|
||||
* @param {number} charCase - Output pinyin case mode, 0- first letter capitalization; 1- All lowercase; 2 - all uppercase.
|
||||
*/
|
||||
constructor(checkPolyphone = false, charCase = 1) {
|
||||
this.pinyin = new Pinyin({
|
||||
checkPolyphone: checkPolyphone,
|
||||
@ -34,21 +35,21 @@ export default class PinyinSort {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort data for appinfo,compared by appName.
|
||||
*
|
||||
* @param {object} a - appinfo for compare.
|
||||
* @return {object} b - appinfo for compare.
|
||||
*/
|
||||
* Sort data for appinfo,compared by appName.
|
||||
*
|
||||
* @param {object} a - appinfo for compare.
|
||||
* @return {object} b - appinfo for compare.
|
||||
*/
|
||||
sortByAppName(a, b) {
|
||||
return this.getChar(a.AppName) - this.getChar(b.AppName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first char for pinyin.
|
||||
*
|
||||
* @param {string} str - chinese string.
|
||||
* @return {char} charCode.
|
||||
*/
|
||||
* Get first char for pinyin.
|
||||
*
|
||||
* @param {string} str - chinese string.
|
||||
* @return {char} charCode.
|
||||
*/
|
||||
private getChar(str) {
|
||||
return this.pinyin.getFullChars(str).charCodeAt(0);
|
||||
}
|
||||
|
@ -13,55 +13,54 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import Router from '@system.router';
|
||||
|
||||
/**
|
||||
* An util that encapsulates methods from @system.router.
|
||||
*/
|
||||
let RouterUtil = function () {
|
||||
return {
|
||||
return {
|
||||
|
||||
/**
|
||||
* Push the page into the Router stack.
|
||||
*
|
||||
* @param {string} uri - uri of the page
|
||||
* @param {object} params - params while opening the page
|
||||
*/
|
||||
push: function (uri, params) {
|
||||
Router.push({
|
||||
uri: uri,
|
||||
params: params
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Push the page into the Router stack.
|
||||
*
|
||||
* @param {string} uri - uri of the page
|
||||
* @param {object} params - params while opening the page
|
||||
*/
|
||||
push: function (uri, params) {
|
||||
Router.push({
|
||||
uri: uri,
|
||||
params: params
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace original page to the current page.
|
||||
*
|
||||
* @param {string} uri - uri of the page
|
||||
* @param {object} params - params while opening the page
|
||||
*/
|
||||
replace: function (uri, params) {
|
||||
Router.replace({
|
||||
uri: uri,
|
||||
params: params
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Replace original page to the current page.
|
||||
*
|
||||
* @param {string} uri - uri of the page
|
||||
* @param {object} params - params while opening the page
|
||||
*/
|
||||
replace: function (uri, params) {
|
||||
Router.replace({
|
||||
uri: uri,
|
||||
params: params
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Back to previous page and pop current page.
|
||||
*/
|
||||
back: function () {
|
||||
Router.back();
|
||||
},
|
||||
/**
|
||||
* Back to previous page and pop current page.
|
||||
*/
|
||||
back: function () {
|
||||
Router.back();
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear router stack.
|
||||
*/
|
||||
clear: function () {
|
||||
Router.clear();
|
||||
}
|
||||
/**
|
||||
* Clear router stack.
|
||||
*/
|
||||
clear: function () {
|
||||
Router.clear();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
export default RouterUtil;
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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 DefaultLayoutConfig = {
|
||||
DefaultAppPageStartConfig: 'Grid',
|
||||
DefaultGridConfig: 1,
|
||||
DefaultRecentProcessLimit: 20,
|
||||
DefaultRecentProcessLimitArray: [5, 10, 15, 20],
|
||||
}
|
||||
|
||||
export default DefaultLayoutConfig;
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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 GridLayoutConfigs = {
|
||||
GridLayoutTable: [
|
||||
{
|
||||
id: 0,
|
||||
layout: '4X4',
|
||||
row: 4,
|
||||
column: 4
|
||||
},
|
||||
|
||||
{
|
||||
id: 1,
|
||||
layout: '5X4',
|
||||
row: 5,
|
||||
column: 4
|
||||
},
|
||||
|
||||
{
|
||||
id: 2,
|
||||
layout: '6X4',
|
||||
row: 6,
|
||||
column: 4
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export default GridLayoutConfigs;
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
public static DEFAULT_FONT_COLOR: string = '#ffffff'
|
||||
public static DEFAULT_ICON: string = '/common/pics/icon.png'
|
||||
|
@ -12,8 +12,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseAppPresenter from '../../../../../../../../common/src/main/ets/default/base/BaseAppPresenter.ets';
|
||||
|
||||
import Prompt from '@ohos.prompt';
|
||||
import BaseAppPresenter from '../../../../../../../../common/src/main/ets/default/base/BaseAppPresenter.ets';
|
||||
|
||||
const PROHIBITED = '禁止卸载'
|
||||
const UNINSTALL_SUCCEEDED = '卸载成功'
|
||||
@ -359,7 +360,6 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
column: Math.floor((i + existNumber) % (column * row) % column),
|
||||
});
|
||||
}
|
||||
// layoutDescription.pageCount = Math.ceil((newApp.length + existNumber) / (column * row));
|
||||
let pageCount = Math.ceil((newApp.length + existNumber) / (column * row));
|
||||
if (pageCount < this.mSettingsModel.getLayoutInfo().layoutDescription.pageCount) {
|
||||
layoutDescription.pageCount = this.mSettingsModel.getLayoutInfo().layoutDescription.pageCount;
|
||||
@ -472,17 +472,17 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
|
||||
|
||||
/**
|
||||
* Longpress event for launcher.
|
||||
*/
|
||||
* Longpress event for launcher.
|
||||
*/
|
||||
public onPageLongPress() {
|
||||
AppStorage.SetOrCreate('blankPageBtnText', this.getBlankPageBtnStr());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get strings for addBlankPageButton.
|
||||
*
|
||||
* @return {string} AddBlankPageButton Strings.
|
||||
*/
|
||||
* Get strings for addBlankPageButton.
|
||||
*
|
||||
* @return {string} AddBlankPageButton Strings.
|
||||
*/
|
||||
public getBlankPageBtnStr() {
|
||||
return this.isBlankPage() ? $r('app.string.deleteBlankPage') : $r('app.string.addBlankPage');
|
||||
}
|
||||
@ -507,8 +507,8 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or delete the choosen blank page.
|
||||
*/
|
||||
* Add or delete the choosen blank page.
|
||||
*/
|
||||
public addOrDeleteBlankPage() {
|
||||
if (this.isBlankPage()) {
|
||||
this.deleteBlankPage();
|
||||
@ -518,8 +518,8 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a blank page.
|
||||
*/
|
||||
* Add a blank page.
|
||||
*/
|
||||
public addBlankPage() {
|
||||
console.info("Launcher AppGridView addBlankPage");
|
||||
let allPageCount = this.getGridPageCount() + 1;
|
||||
@ -530,19 +530,19 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pageCount.
|
||||
*
|
||||
* @return {number} PageCount.
|
||||
*/
|
||||
* Get pageCount.
|
||||
*
|
||||
* @return {number} PageCount.
|
||||
*/
|
||||
public getGridPageCount() {
|
||||
return this.mSettingsModel.getLayoutInfo().layoutDescription.pageCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pageCount.
|
||||
*
|
||||
* @param {number} pageCount - PageCount.
|
||||
*/
|
||||
* Set pageCount.
|
||||
*
|
||||
* @param {number} pageCount - PageCount.
|
||||
*/
|
||||
private setGridPageCount(pageCount) {
|
||||
let gridLayoutInfo = this.mSettingsModel.getLayoutInfo();
|
||||
gridLayoutInfo.layoutDescription.pageCount = pageCount;
|
||||
@ -550,8 +550,8 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the choosen blank page.
|
||||
*/
|
||||
* Delete the choosen blank page.
|
||||
*/
|
||||
private deleteBlankPage() {
|
||||
console.info("Launcher AppGridView deleteBlankPage");
|
||||
this.deleteGridPage(this.pageIndex);
|
||||
@ -562,10 +562,10 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete blank page.
|
||||
*
|
||||
* @param {number} pageIndex - Index of the page which is to be deleted.
|
||||
*/
|
||||
* Delete blank page.
|
||||
*
|
||||
* @param {number} pageIndex - Index of the page which is to be deleted.
|
||||
*/
|
||||
private deleteGridPage(pageIndex) {
|
||||
let info = this.mSettingsModel.getLayoutInfo();
|
||||
let layoutInfo = info.layoutInfo;
|
||||
@ -761,14 +761,14 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Icons go forwards.
|
||||
*
|
||||
* @param {object} source - Start position information.
|
||||
* @param {object} destination - End position information.
|
||||
* @param {object} layoutInfo - Current layout information.
|
||||
* @param {object} startInfo - Recursion start position information.
|
||||
* @return {boolean} Move result.
|
||||
*/
|
||||
* Icons go forwards.
|
||||
*
|
||||
* @param {object} source - Start position information.
|
||||
* @param {object} destination - End position information.
|
||||
* @param {object} layoutInfo - Current layout information.
|
||||
* @param {object} startInfo - Recursion start position information.
|
||||
* @return {boolean} Move result.
|
||||
*/
|
||||
private moveLayoutForward = (source, destination, layoutInfo, startInfo) => {
|
||||
this.mGridConfig = this.mSettingsModel.getGridConfig();
|
||||
let startLayoutInfo = layoutInfo.find(item => {
|
||||
@ -798,14 +798,14 @@ export default class AppGridPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Icons go backwards.
|
||||
*
|
||||
* @param {object} source - Start position information.
|
||||
* @param {object} destination - End position information.
|
||||
* @param {object} layoutInfo - Current layout information.
|
||||
* @param {object} startInfo - Recursion start position information.
|
||||
* @return {boolean} Move result.
|
||||
*/
|
||||
* Icons go backwards.
|
||||
*
|
||||
* @param {object} source - Start position information.
|
||||
* @param {object} destination - End position information.
|
||||
* @param {object} layoutInfo - Current layout information.
|
||||
* @param {object} startInfo - Recursion start position information.
|
||||
* @return {boolean} Move result.
|
||||
*/
|
||||
private moveLayoutBackward = (source, destination, layoutInfo, startInfo) => {
|
||||
this.mGridConfig = this.mSettingsModel.getGridConfig();
|
||||
let startLayoutInfo = layoutInfo.find(item => {
|
||||
|
@ -12,9 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Prompt from '@ohos.prompt';
|
||||
import BaseAppPresenter from '../../../../../../../../common/src/main/ets/default/base/BaseAppPresenter.ets';
|
||||
import PinyinSort from '../../../../../../../../common/src/main/ets/default/utils/PinyinSort.ets'
|
||||
import Prompt from '@ohos.prompt';
|
||||
|
||||
const PROHIBITED = '禁止卸载'
|
||||
const UNINSTALL_SUCCEEDED = '卸载成功'
|
||||
@ -43,20 +44,21 @@ export default class AppListPresenter extends BaseAppPresenter {
|
||||
}
|
||||
|
||||
public getListCallback(list) {
|
||||
let count = 0;
|
||||
let cached = true;
|
||||
for (let item of list) {
|
||||
let appName = this.mResourceManager.getAppResourceCache(item.bundleName, KEY_NAME);
|
||||
console.info("Launcher AppListPresenter regroupDataAfterInstall + appName = " + appName);
|
||||
if (appName != null) {
|
||||
count++;
|
||||
cached = false;
|
||||
item.AppName = appName;
|
||||
}
|
||||
}
|
||||
if (count == 0) {
|
||||
if (cached) {
|
||||
list = this.mAppListInfoCacheManager.getCache(KEY_APP_LIST);
|
||||
} else {
|
||||
list.sort(this.mPinyinSort.sortByAppName.bind(this.mPinyinSort));
|
||||
this.mAppListInfoCacheManager.setCache(KEY_APP_LIST, list);
|
||||
}
|
||||
list.sort(this.mPinyinSort.sortByAppName.bind(this.mPinyinSort));
|
||||
this.mAppListInfoCacheManager.setCache(KEY_APP_LIST, list);
|
||||
AppStorage.SetOrCreate('listInfo', list);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AppGridPresenter from '../common/presenter/AppGridPresenter.ets'
|
||||
import GridName from '../../../../../../../common/src/main/ets/default/uicomponents/GridName.ets'
|
||||
import AppIcon from '../../../../../../../common/src/main/ets/default/uicomponents/AppIcon.ets'
|
||||
@ -41,12 +42,11 @@ struct GridLayout {
|
||||
@State moveAppY: number = 0;
|
||||
@State moveAppShow: boolean = false;
|
||||
@State moveAppInfo: any = {};
|
||||
@Prop@Watch('changeGridConfig') gridConfig: string;
|
||||
@Prop @Watch('changeGridConfig') gridConfig: string;
|
||||
@Prop equipment: string;
|
||||
@State ScreenMagnification: number = 1.0;
|
||||
@Prop SwiperProportion: string;
|
||||
@Prop BottomBarProportion: string;
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: ShowDialog(),
|
||||
cancel: this.cancelDialog,
|
||||
@ -184,7 +184,7 @@ struct SwiperPage {
|
||||
@Link moveAppY: number;
|
||||
@Link moveAppShow: boolean;
|
||||
@Link moveAppInfo: any;
|
||||
@Prop@Watch('changeColumnAndRow') gridConfig: string;
|
||||
@Prop @Watch('changeColumnAndRow') gridConfig: string;
|
||||
private mAppBottomBarInfo;
|
||||
private mAppListInfo;
|
||||
|
||||
@ -299,12 +299,13 @@ struct AppItem {
|
||||
.gesture(
|
||||
LongPressGesture({ repeat: false })
|
||||
.onAction((event: GestureEvent) => {
|
||||
this.item.AppName = mAppGridPresenter.getAppName(this.item.bundleName);
|
||||
let appName = mAppGridPresenter.getAppName(this.item.bundleName);
|
||||
if(appName != null){
|
||||
this.item.AppName = appName;
|
||||
}
|
||||
AppStorage.SetOrCreate('uninstallAppInfo', this.item)
|
||||
this.dialogController.open();
|
||||
this.isLongPress = true;
|
||||
this.moveAppShow = true;
|
||||
this.isShow = false;
|
||||
})
|
||||
)
|
||||
.onTouch((event: TouchEvent) => {
|
||||
@ -327,6 +328,8 @@ struct AppItem {
|
||||
if (event.type == 2 && this.isLongPress) {
|
||||
|
||||
this.dialogController.close();
|
||||
this.moveAppShow = true;
|
||||
this.isShow = false;
|
||||
this.moveAppX = event.touches[0].screenX;
|
||||
this.moveAppY = event.touches[0].screenY;
|
||||
let moveX = this.moveAppX * mScreenMagnification;
|
||||
@ -444,6 +447,7 @@ struct UninstallDialog {
|
||||
Text($r('app.string.uninstall'))
|
||||
Text(this.AppInfo.AppName + ' ?')
|
||||
}
|
||||
|
||||
Row() {
|
||||
Button() {
|
||||
Text($r('app.string.submit'))
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AppListPresenter from '../common/presenter/AppListPresenter.ets'
|
||||
import ListName from '../../../../../../../common/src/main/ets/default/uicomponents/ListName.ets'
|
||||
import AppIcon from '../../../../../../../common/src/main/ets/default/uicomponents/AppIcon.ets'
|
||||
@ -83,7 +84,12 @@ struct ListLayout {
|
||||
.backgroundColor(DefaultConstants.LIGHT_BLACK)
|
||||
.borderRadius(DefaultConstants.DEFAULT_20)
|
||||
.padding({ left: DefaultConstants.DEFAULT_5 })
|
||||
.margin({ top: DefaultConstants.DEFAULT_5, left: DefaultConstants.DEFAULT_30, bottom: DefaultConstants.DEFAULT_5, right: DefaultConstants.DEFAULT_30 })
|
||||
.margin({
|
||||
top: DefaultConstants.DEFAULT_5,
|
||||
left: DefaultConstants.DEFAULT_30,
|
||||
bottom: DefaultConstants.DEFAULT_5,
|
||||
right: DefaultConstants.DEFAULT_30
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
|
@ -12,12 +12,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import GridName from '../../../../../../../common/src/main/ets/default/uicomponents/GridName.ets'
|
||||
import AppIcon from '../../../../../../../common/src/main/ets/default/uicomponents/AppIcon.ets'
|
||||
import DefaultConstants from '../../../../../../../common/src/main/ets/default/common/constants/DefaultConstants.ets'
|
||||
import RecentsPresenter from '../common/presenter/RecentsPresenter.ets';
|
||||
|
||||
let mRecentsPresenter: RecentsPresenter;
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Recent {
|
||||
@ -95,10 +97,11 @@ struct recentProcessListDisplay {
|
||||
})
|
||||
}
|
||||
.margin({ bottom: this.margin })
|
||||
|
||||
Image(DefaultConstants.DEFAULT_APP_IMAGE)
|
||||
.borderRadius(this.AppborderRadius)
|
||||
.width(this.heightSize)
|
||||
.height(DefaultConstants.APP_IMAGE_HEIGHT)
|
||||
.width(DefaultConstants.PERCENTAGE_100)
|
||||
.height(DefaultConstants.PERCENTAGE_70)
|
||||
}
|
||||
.width(DefaultConstants.APP_IMAGE_WIDTH)
|
||||
.height(this.heightSize)
|
||||
@ -144,7 +147,8 @@ struct recentProcessListDisplay {
|
||||
|
||||
@Component
|
||||
struct emptyMsgDisplay {
|
||||
@State size:string = DefaultConstants.PERCENTAGE_100;
|
||||
@State size: string = DefaultConstants.PERCENTAGE_100;
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Text($r('app.string.No_running_apps_recently'))
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
public static DEFAULT_LAYOUT_FONT_COLOR: string = '#696969';
|
||||
public static DEFAULT_BACKGROUND_COLOR: string = '#F0EEEE';
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DefaultLayoutConfig from '../../../../../../../../common/src/main/ets/default/common/configs/DefaultLayoutConfig.ets'
|
||||
import GridLayoutConfigs from '../../../../../../../../common/src/main/ets/default/common/configs/GridLayoutConfigs.ets'
|
||||
import SettingsModel from '../../../../../../../../common/src/main/ets/default/common/model/SettingsModel.ets'
|
||||
@ -24,10 +25,11 @@ let mSettingsModel: SettingsModel;
|
||||
export default class SettingsPresenter {
|
||||
private static settingPresenter: SettingsPresenter = new SettingsPresenter();
|
||||
private callbackList = [];
|
||||
|
||||
/**
|
||||
* Grid settingList.
|
||||
*
|
||||
*/
|
||||
* Grid settingList.
|
||||
*
|
||||
*/
|
||||
private gridSettingsList = [
|
||||
{
|
||||
ida: 0,
|
||||
@ -48,10 +50,11 @@ export default class SettingsPresenter {
|
||||
valueList: DefaultLayoutConfig.DefaultRecentProcessLimitArray
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* List settingList.
|
||||
*
|
||||
*/
|
||||
* List settingList.
|
||||
*
|
||||
*/
|
||||
private listSettingsList = [
|
||||
{
|
||||
ida: 0,
|
||||
@ -68,29 +71,29 @@ export default class SettingsPresenter {
|
||||
]
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param {object} settingsModel - model of setting.
|
||||
*/
|
||||
* Constructor.
|
||||
*
|
||||
* @param {object} settingsModel - model of setting.
|
||||
*/
|
||||
constructor() {
|
||||
mSettingsModel = new SettingsModel();
|
||||
this.gridSettingsList[1].valueList = mSettingsModel.getGridLayoutTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settingsPresenter instance.
|
||||
*
|
||||
* @return {settingPresenter} - settingPresenter.
|
||||
*/
|
||||
* Get settingsPresenter instance.
|
||||
*
|
||||
* @return {settingPresenter} - settingPresenter.
|
||||
*/
|
||||
public static getInstance(): SettingsPresenter{
|
||||
return this.settingPresenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting list.
|
||||
*
|
||||
* @return [settingList] - setting list.
|
||||
*/
|
||||
* Get setting list.
|
||||
*
|
||||
* @return [settingList] - setting list.
|
||||
*/
|
||||
public getSettingList() {
|
||||
let layout = mSettingsModel.getAppPageStartConfig();
|
||||
for (let i = 0; i < this.gridSettingsList[0].valueList.length; i++) {
|
||||
@ -128,11 +131,11 @@ export default class SettingsPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set system setting value.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {string} settingValue - setting value.
|
||||
*/
|
||||
* Set system setting value.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {string} settingValue - setting value.
|
||||
*/
|
||||
setSettingsValue(ida, settingValue) {
|
||||
if (ida == 0) {
|
||||
this.setAppPageStartConfig(settingValue);
|
||||
@ -145,54 +148,54 @@ export default class SettingsPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set app start config.
|
||||
*
|
||||
* @param {string} type - the type of config.
|
||||
*/
|
||||
* Set app start config.
|
||||
*
|
||||
* @param {string} type - the type of config.
|
||||
*/
|
||||
setAppPageStartConfig(type) {
|
||||
mSettingsModel.setAppPageStartConfig(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update setting.
|
||||
*
|
||||
*/
|
||||
* Update setting.
|
||||
*
|
||||
*/
|
||||
settingUpdate() {
|
||||
mSettingsModel.closeSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grid config.
|
||||
*
|
||||
* @param {string} id - the id of grid config.
|
||||
*/
|
||||
* Set grid config.
|
||||
*
|
||||
* @param {string} id - the id of grid config.
|
||||
*/
|
||||
setGridConfig(id) {
|
||||
mSettingsModel.setGridConfig(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set recent process.
|
||||
*
|
||||
* @param {number} num - the num of recent process.
|
||||
*/
|
||||
* Set recent process.
|
||||
*
|
||||
* @param {number} num - the num of recent process.
|
||||
*/
|
||||
setRecentProcessLimit(num) {
|
||||
mSettingsModel.setRecentProcessLimit(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Back to the desktop interface.
|
||||
*
|
||||
*/
|
||||
* Back to the desktop interface.
|
||||
*
|
||||
*/
|
||||
backToTheDesktop() {
|
||||
this.settingUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register value callback.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {function()} settingValue - setting value.
|
||||
*/
|
||||
* Register value callback.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {function()} settingValue - setting value.
|
||||
*/
|
||||
registerValueCallback(ida, settingValue) {
|
||||
this.callbackList.push({
|
||||
id: ida,
|
||||
@ -201,11 +204,11 @@ export default class SettingsPresenter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change page setting value.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {string} settingValue - setting value.
|
||||
*/
|
||||
* Change page setting value.
|
||||
*
|
||||
* @param {string} settingsName - setting name.
|
||||
* @param {string} settingValue - setting value.
|
||||
*/
|
||||
changeSettingValue(ida, settingValue) {
|
||||
for (let i = 0;i < this.callbackList.length; i++) {
|
||||
if (this.callbackList[i].id == ida) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DefaultConstants from '../common/constants/DefaultConstants.ets'
|
||||
import SettingsPresenter from '../common/presenter/SettingsPresenter.ets'
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 96 96" enable-background="new 0 0 96 96" xml:space="preserve">
|
||||
<path fill="#000000" d="M81,45H22.2l27.9-27.9c1.2-1.2,1.2-3.1,0-4.2c-1.2-1.2-3.1-1.2-4.2,0l-33,33c-0.1,0.1-0.3,0.3-0.4,0.5
|
||||
<path fill="#CCCCCC" d="M81,45H22.2l27.9-27.9c1.2-1.2,1.2-3.1,0-4.2c-1.2-1.2-3.1-1.2-4.2,0l-33,33c-0.1,0.1-0.3,0.3-0.4,0.5
|
||||
c0,0.1-0.1,0.1-0.1,0.2c-0.1,0.1-0.1,0.2-0.2,0.3c0,0.1-0.1,0.2-0.1,0.3c0,0.1-0.1,0.2-0.1,0.3c-0.1,0.4-0.1,0.8,0,1.2
|
||||
c0,0.1,0.1,0.2,0.1,0.3c0,0.1,0.1,0.2,0.1,0.3c0,0.1,0.1,0.2,0.2,0.3c0,0.1,0.1,0.2,0.1,0.2c0.1,0.2,0.2,0.3,0.4,0.5l33,33
|
||||
c0.6,0.6,1.4,0.9,2.1,0.9s1.5-0.3,2.1-0.9c1.2-1.2,1.2-3.1,0-4.2L22.2,51H81c1.7,0,3-1.3,3-3S82.7,45,81,45z"/>
|
||||
|
Before Width: | Height: | Size: 800 B After Width: | Height: | Size: 814 B |
@ -1,27 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 48 96"
|
||||
enable-background="new 0 0 48 96"
|
||||
xml:space="preserve">
|
||||
<path
|
||||
fill="#CCCCCC"
|
||||
d="M37.1,45.9l-22-22c-1.2-1.2-3.1-1.2-4.2,0c-1.2,1.2-1.2,3.1,0,4.2L30.8,48L10.9,67.9c-1.2,1.2-1.2,3.1,0,4.2
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 48 96" enable-background="new 0 0 48 96" xml:space="preserve">
|
||||
<path fill="#CCCCCC" d="M37.1,45.9l-22-22c-1.2-1.2-3.1-1.2-4.2,0c-1.2,1.2-1.2,3.1,0,4.2L30.8,48L10.9,67.9c-1.2,1.2-1.2,3.1,0,4.2
|
||||
c0.6,0.6,1.4,0.9,2.1,0.9s1.5-0.3,2.1-0.9l22-22C38.3,48.9,38.3,47.1,37.1,45.9z"/>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 233 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 64 KiB |
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const DefaultLayoutConfig = {
|
||||
DefaultAppPageStartConfig: 'Grid',
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
public static DEFAULT_BACKGROUND_IMAGE: string = '/common/pics/img_wallpaper_default.jpg'
|
||||
}
|
@ -12,12 +12,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import display from '@ohos.display';
|
||||
import DefaultConstants from '../common/constants/DefaultConstants.ets'
|
||||
import GridLayout from '../../../../../../../feature/layoutmanager/src/main/ets/default/layout/GridLayout.ets'
|
||||
import ListLayout from '../../../../../../../feature/layoutmanager/src/main/ets/default/layout/ListLayout.ets'
|
||||
import AppModel from '../../../../../../../common/src/main/ets/default/common/model/AppModel.ets'
|
||||
import SettingsModel from '../../../../../../../common/src/main/ets/default/common/model/SettingsModel.ets'
|
||||
import display from '@ohos.display';
|
||||
|
||||
const SYSTEM_UI_HEIGHT = 134;
|
||||
const DESIGN_WIDTH = 720.0;
|
||||
@ -27,8 +28,6 @@ const HORIZONTAL = 0.7;
|
||||
@Component
|
||||
struct LayoutManager {
|
||||
@State mAppPageStartConfig: string = '';
|
||||
private mAppModel: AppModel;
|
||||
private mSettingsModel: SettingsModel;
|
||||
@State proportion: number = 0;
|
||||
@State mScreenHeight: number = 0;
|
||||
@State mScreenWidth: number = 0;
|
||||
@ -37,6 +36,8 @@ struct LayoutManager {
|
||||
@State show: boolean = false;
|
||||
@State SwiperProportion: string = '85%';
|
||||
@State BottomBarProportion: string = '15%';
|
||||
private mAppModel: AppModel;
|
||||
private mSettingsModel: SettingsModel;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mAppModel = AppModel.getInstance()
|
||||
@ -55,7 +56,6 @@ struct LayoutManager {
|
||||
this.show = true;
|
||||
console.info("Launcher EntryView onShow end");
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
|