diff --git a/AppScope/app.json5 b/AppScope/app.json5 index 7ed4d47f21d29994d1b36915fde047dd002a7b78..b773742be06b81ec812bbc8f436bd2c1dfb65989 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -4,7 +4,7 @@ "vendor": "example", "versionCode": 1000000, "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name" + "icon": "$media:layered_image", + "label": "$string:app_name", } } \ No newline at end of file diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json index 53b062fc6363d383e0923cacadd18f4d7c361210..28b97069fc2da4fde48f0b5bea0ba3ac99c30284 100644 --- a/AppScope/resources/base/element/string.json +++ b/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "HMOSWorldClient_New" + "value": "HMOS代码工坊" } ] } diff --git a/AppScope/resources/base/media/ic_background.png b/AppScope/resources/base/media/ic_background.png new file mode 100644 index 0000000000000000000000000000000000000000..2c4ebb884d18fe3f81e83fbbe850e7ddee4dfee9 Binary files /dev/null and b/AppScope/resources/base/media/ic_background.png differ diff --git a/AppScope/resources/base/media/ic_foreground.png b/AppScope/resources/base/media/ic_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..633d7243b55c07163b416bef06b83b630a6696f4 Binary files /dev/null and b/AppScope/resources/base/media/ic_foreground.png differ diff --git a/AppScope/resources/base/media/layered_image.json b/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..ab180cdfef55bcd5248e3aef53bad8d621a6443a --- /dev/null +++ b/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:ic_background", + "foreground" : "$media:ic_foreground" + } +} \ No newline at end of file diff --git a/README.md b/README.md index be1030266c9f5a7d24a65536b93e404c53c11b58..9aa9066953283e41519031071aa275334c9cb35a 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,63 @@ -# HMOS世界 - 示例代码合集 -## 一、「HMOS 世界 - 示例代码合集」APP 尝鲜上线了! -为了帮助广大开发者更高效的完成鸿蒙应用开发,华为官方重磅打造了一款名为「HMOS世界 - 示例代码合集」的开源APP。「HMOS世界」汇聚官网优质代码案例,覆盖多场景开发需求,通过标准化、模块化的代码实践,帮助开发者快速掌握鸿蒙应用开发技巧,加速项目落地进程,开启鸿蒙开发新征程! +# HarmonyOS代码工坊 +## 一、「HarmonyOS代码工坊」APP尝鲜上线了! +为了帮助广大开发者更高效的完成鸿蒙应用开发,华为官方重磅打造了一款名为「HarmonyOS代码工坊」的开源APP。「HarmonyOS代码工坊」汇聚官网优质代码案例,覆盖多场景开发需求,通过标准化、模块化的代码实践,帮助开发者快速掌握鸿蒙应用开发技巧,加速项目落地进程,开启鸿蒙开发新征程! 【应用开发最佳实践】 -HMOS世界承载鸿蒙应用架构最佳实践,支持1+8设备运行,全方位体现鸿蒙应用的精致、流畅、智能、易用、安全、全场景互联等特点,并持续迭代鸿蒙新特性。 +HarmonyOS代码工坊承载鸿蒙应用架构最佳实践,支持1+8设备运行,全方位体现鸿蒙应用的精致、流畅、智能、易用、安全、全场景互联等特点,并持续迭代鸿蒙新特性。 【示例代码一键获取】 -其中内置集成数百个Samples示例代码,覆盖高频的鸿蒙应用开发场景,并支持源码的一键分享,给开发者提供所见即所得的样例代码,支撑开发者高效完成鸿蒙应用的开发。 +其中内置集成40+Samples示例代码,覆盖高频的鸿蒙应用开发场景,并支持源码的一键分享,给开发者提供所见即所得的样例代码,支撑开发者高效完成鸿蒙应用的开发。 -【代码开源地址】 +【应用市场下载】 +- 下载地址:应用市场->我的->应用尝鲜 -- HMOS世界源码地址:https://gitee.com/harmonyos_samples/hmosworld_samplescollection +【代码开源地址】 +- HarmonyOS代码工坊源码地址:https://gitee.com/harmonyos_samples/sample_in_harmonyos - 示例代码汇总地址:https://gitee.com/harmonyos_samples 【效果图】 ![image](hmosword-build/image/9.png) - +![image](hmosword-build/image/10.png) @联系我们 -HMOS世界相关开发案例正在陆续更新中,您还期待我们为您提供什么样的开发案例,或还有什么宝贵意见,欢迎联系我们,非常期待您的反馈和建议,以促进我们不断改进! +HarmonyOS代码工坊相关开发案例正在陆续更新中,您还期待我们为您提供什么样的开发案例,或还有什么宝贵意见,欢迎联系我们,非常期待您的反馈和建议,以促进我们不断改进! - 官方邮箱:hmosworld@huawei.com ## 二、功能介绍(手机、折叠屏、平板、PC/2in1) ### 组件库首页 组件首页作为APP的入口页面,负责展示组件卡片,给用户提供不同组件的展示入口。主要包括页签区和内容区,内容区包括banner海报位与卡片入口。 -| 手机 | 折叠屏(展开态) | 平板 | +| 手机 | 平板 | PC/2in1 | |------------------------|---------------------------------------|---------------------------------------| | ![](hmosword-build/screenshots/1.png) | ![](hmosword-build/screenshots/2.png) | ![](hmosword-build/screenshots/3.png) | ### 组件库详情页 -组件详情页承载全套符合鸿蒙设计规范的ArkUI组件和开箱即用的特性能力。页面包括预览区、属性调整区、代码区和推荐列表四块,手动调整属性,可以看到预览区与代码区会发生相应的变化。 +组件详情页承载全套符合HarmonyOS设计规范的ArkUI组件和开箱即用的特性能力。页面包括预览区、属性调整区、代码区和推荐列表四块,手动调整属性,可以看到预览区与代码区会发生相应的变化。 -| 手机 | 折叠屏(展开态) | 平板 | +| 手机 | 平板 | PC/2in1 | |----------------------------------------|----------------------------------------|----------------------------------------| | ![](hmosword-build/screenshots/10.png) | ![](hmosword-build/screenshots/11.png) | ![](hmosword-build/screenshots/12.png) | ### 样例页 样例页面主要由banner海报位与Samples卡片入口组成,入口位包含四个tab页签:2025 HDC、多设备开发、ArkUI实践、功能开发。点击不同页签展示不同类别的Sample案例。 -| 手机 | 折叠屏(展开态) | 平板 | +| 手机 | 平板 | PC/2in1 | |---------------------------------------|---------------------------------------|---------------------------------------| | ![](hmosword-build/screenshots/4.png) | ![](hmosword-build/screenshots/5.png) | ![](hmosword-build/screenshots/6.png) | ### 实践 -实践页面主要由banner海报位与最佳实践文章卡片入口组成。文章围绕“如何构建一个鸿蒙大型应用”,将HMOS世界设计、开发到上架整个开发者旅程以最佳实践文章的形式进行内容输出。 +实践页面主要由banner海报位与最佳实践文章卡片入口组成。文章围绕“如何构建一个鸿蒙大型应用”,将HarmonyOS代码工坊设计、开发到上架整个开发者旅程以最佳实践文章的形式进行内容输出。 -| 手机 | 折叠屏(展开态) | 平板 | +| 手机 | 平板 | PC/2in1 | |---------------------------------------|---------------------------------------|---------------------------------------| | ![](hmosword-build/screenshots/7.png) | ![](hmosword-build/screenshots/8.png) | ![](hmosword-build/screenshots/9.png) | ## 三、功能介绍(华为智能穿戴设备) ### 样例页 -HMOS世界在样例模块已集成四个案例:包括音乐播放、视频播放、地图导航和骑行导航等。 +HarmonyOS代码工坊在样例模块已集成四个案例:包括音乐播放、视频播放、地图导航和骑行导航等。 +| 首页 | 样例页 | 音乐播放案例页 | +|----------------------------------------|----------------------------------------|----------------------------------------| +| ![](hmosword-build/screenshots/13.png) | ![](hmosword-build/screenshots/14.png) | ![](hmosword-build/screenshots/15.png) | ## 四、工程结构 ``` ├──common/src/main/ets // 公共模块 @@ -78,11 +83,11 @@ HMOS世界在样例模块已集成四个案例:包括音乐播放、视频播 ``` ## 五、代码运行 -《HMOS世界 - 示例代码合集》APP集成了大量Sample,开发者可以选择: -1. 直接运行HMOS世界本体代码,体验组件与实践功能,样例模块Sample无法进入。 -2. 运行脚本下载Sample代码,体验全量HMOS世界功能。 +《HarmonyOS代码工坊》APP集成了大量Sample,开发者可以选择: +1. 直接运行HarmonyOS代码工坊本体代码,体验组件与实践功能,样例模块Sample无法进入。 +2. 运行脚本下载Sample代码,体验全量HarmonyOS代码工坊功能。 -### 1、直接运行HMOS世界 +### 1、直接运行HarmonyOS代码工坊 #### 手机、折叠屏、平板、PC/2in1设备运行 1. DevEco studio打开工程文件,等待Sync完成。 @@ -101,7 +106,7 @@ HMOS世界在样例模块已集成四个案例:包括音乐播放、视频播 4. 点击运行,等待编译完成。 ![image](hmosword-build/image/3.PNG) -### 2、集成Sample后,运行HMOS世界 +### 2、集成Sample后,运行HarmonyOS代码工坊 #### Sample下载 1. 确保电脑中已成功安装git,打开DevEco studio终端(Terminal)。 @@ -110,7 +115,7 @@ HMOS世界在样例模块已集成四个案例:包括音乐播放、视频播 3. 再执行`npm i`下载依赖包。如果出现以下错误,请在终端执行`npm config set registry https://registry.npmjs.org/` 设置官方镜像源。 ![image](hmosword-build/image/6.png) -4. 依赖包下載成功后,执行 `node .\index.js`运行脚本。此步骤会全量下载工程依赖的sample,并且更新HMOS世界的[build-profile.json5](build-profile.json5)配置文件。下載过程中会由于网络情况出现部分sample下载失败,可以在当前任务结束后重复执行`node .\index.js`。 +4. 依赖包下載成功后,执行 `node .\index.js`运行脚本。此步骤会全量下载工程依赖的sample,并且更新HarmonyOS代码工坊的[build-profile.json5](build-profile.json5)配置文件。下載过程中会由于网络情况出现部分sample下载失败,可以在当前任务结束后重复执行`node .\index.js`。 5. 确保sample成功下载后,点击DevEco studio的File->Sync and refresh Project重新编译。 #### 手机、折叠屏、平板、PC/2in1设备集成sample运行 @@ -135,4 +140,13 @@ animationcollectionsample、audiointeractionsample、componentstacksample、cust 4. HarmonyOS SDK版本:HarmonyOS 5.1.0 Release SDK及以上。 ## 七、版本更新说明 -- HMOS世界V1.0.0.1版本: 初始化组件、样例、实践和我的模块。 \ No newline at end of file +【鸿蒙新特性】本次公测新增6个创新案例,欢迎体验: + +- HarmonyOS代码工坊本体(支持华为穿戴设备、手机、折叠屏、平板、PC/2in1)。 +- MateXT适配案例:备忘录&日历。 +- PuraX适配案例:内外屏沉浸式扩感导航。 +- 碰一碰视频快速分享。 +- 多设备视频投播。 +- 跨设备内容编辑(分布式照相机、键鼠穿越)。 + +以上代码全部开源,欢迎下载体验! \ No newline at end of file diff --git a/common/src/main/ets/util/DynamicInstallManager.ets b/common/src/main/ets/util/DynamicInstallManager.ets index e817b3ce73edebe54fee271d09b06bd398352a40..3943c044eb6ce425d30f088718e07a816e0f8235 100644 --- a/common/src/main/ets/util/DynamicInstallManager.ets +++ b/common/src/main/ets/util/DynamicInstallManager.ets @@ -14,16 +14,22 @@ */ import type { common, StartOptions } from '@kit.AbilityKit'; +import { display } from '@kit.ArkUI'; import { BusinessError, emitter } from '@kit.BasicServicesKit'; import { moduleInstallManager } from '@kit.StoreKit'; -import { display } from '@kit.ArkUI'; -import { CommonConstants } from '../../../../Index'; import Logger from './Logger'; +import { CommonConstants } from '../constant/CommonConstants'; const DOWNLOAD_TIMEOUT_LIMIT: number = 1800; const TAG: string = '[DynamicInstallManager]'; export class DynamicInstallManager { + private static aVAbilityList: string[] = [ + 'KnocksharesampleAbility', + 'VideocastsampleAbility', + 'AudiointeractionsampleAbility', + ]; + public static getModuleStatus(moduleName: string): moduleInstallManager.InstallStatus { const result: moduleInstallManager.InstalledModule = moduleInstallManager.getInstalledModule(moduleName); Logger.info(TAG, `getModuleStatus moduleName: ${result.moduleName}, installStatus: ${result.installStatus}`); @@ -95,9 +101,20 @@ export class DynamicInstallManager { public static loadModule(context: common.UIAbilityContext, moduleAbility: string): Promise { return new Promise((resolve: (value: void) => void, reject: (reason?: BusinessError) => void) => { try { + const isAVAbility: boolean = DynamicInstallManager.aVAbilityList.includes(moduleAbility); + const isSameAbility: boolean = (moduleAbility === AppStorage.get('AVAbilityModule')); + const aVAbilityContext: common.UIAbilityContext = + AppStorage.get('AVAbilityContext') as common.UIAbilityContext; + if (isAVAbility && !isSameAbility && aVAbilityContext) { + aVAbilityContext.terminateSelf(); + AppStorage.delete('AVAbilityContext'); + } const option: StartOptions = DynamicInstallManager.setStartAbilityProperty(); context.startAbility({ bundleName: context.abilityInfo.bundleName, abilityName: moduleAbility }, option) .then(() => { + if (isAVAbility) { + AppStorage.setOrCreate('AVAbilityModule', moduleAbility); + } Logger.info(TAG, `start ${moduleAbility} success}`); resolve(); }) @@ -115,17 +132,17 @@ export class DynamicInstallManager { public static setStartAbilityProperty(): StartOptions { const displayData = display.getDefaultDisplaySync(); - const windowWidth = displayData.width * CommonConstants.WINDOW_RATIO; + const windowWidth = displayData.availableWidth * CommonConstants.WINDOW_RATIO; const windowHeight = displayData.availableHeight * CommonConstants.WINDOW_RATIO; - const windowLeft = (windowWidth - CommonConstants.WINDOW_RATIO * windowWidth) / 2.0; - const windowTop = (windowHeight - CommonConstants.WINDOW_RATIO * windowHeight) / 2.0; + const windowLeft = (displayData.availableWidth - windowWidth) / 2.0; + const windowTop = (displayData.availableHeight - windowHeight) / 2.0; const option: StartOptions = { - minWindowWidth: CommonConstants.MIN_WINDOW_WIDTH, - minWindowHeight: CommonConstants.MIN_WINDOW_HEIGHT, + minWindowWidth: Math.min(px2vp(windowWidth), CommonConstants.MIN_WINDOW_WIDTH), + minWindowHeight: Math.min(px2vp(windowHeight), CommonConstants.MIN_WINDOW_HEIGHT), windowLeft: windowLeft, windowTop: windowTop, windowWidth: windowWidth, - windowHeight: windowHeight + windowHeight: windowHeight, }; return option; } diff --git a/common/src/main/resources/rawfile/mockdata/component-page.json b/common/src/main/resources/rawfile/mockdata/component-page.json index a7f89b46103ad911cd11376c0fc389538e963549..e58feaa87b35ba3b556336fb8cf4f7ed8a072ad6 100644 --- a/common/src/main/resources/rawfile/mockdata/component-page.json +++ b/common/src/main/resources/rawfile/mockdata/component-page.json @@ -9,8 +9,8 @@ "bannerInfos": [ { "id": 1, - "bannerTitle": "开发者你好,欢迎来到HMOS世界", - "bannerSubTitle": "HMOS世界 - 示例代码合集", + "bannerTitle": "开发者你好,欢迎来到HMOS代码工坊", + "bannerSubTitle": "HarmonyOS代码工坊", "bannerDesc": "欢迎来到鸿蒙开发者世界,一起体验鸿蒙应用开发。", "bannerType": 4, "bannerValue": 14, @@ -20,9 +20,9 @@ }, { "id": 4, - "bannerTitle": "HMOS世界一多开发实践", + "bannerTitle": "HMOS代码工坊一多开发实践", "bannerSubTitle": "一次开发,多端部署", - "bannerDesc": "探索HMOS世界一多开发实践", + "bannerDesc": "探索HarmonyOS代码工坊一多开发实践", "bannerType": 4, "bannerValue": 18, "mediaType": 1, diff --git a/common/src/main/resources/rawfile/mockdata/discovery-page.json b/common/src/main/resources/rawfile/mockdata/discovery-page.json index 4353d89f44e9e00f0eae8118947195ca642d9a8b..2ed278a243c755e889569469357dc958c0112773 100644 --- a/common/src/main/resources/rawfile/mockdata/discovery-page.json +++ b/common/src/main/resources/rawfile/mockdata/discovery-page.json @@ -27,8 +27,8 @@ }, { "id": 9, - "bannerTitle": "开发者你好,欢迎来到HMOS世界", - "bannerSubTitle": "HMOS世界", + "bannerTitle": "开发者你好,欢迎来到HMOS代码工坊", + "bannerSubTitle": "HarmonyOS代码工坊", "bannerDesc": "欢迎来到鸿蒙开发者世界,一起体验鸿蒙应用开发。", "bannerType": 4, "bannerValue": 21, @@ -162,7 +162,7 @@ "type": 4, "mediaType": 1, "mediaUrl": "image/practice/functionDevelopment/discovery_article_id_12.png", - "title": "HMOS世界一多开发实践", + "title": "HMOS代码工坊一多开发实践", "subTitle": "HarmonyOS", "desc": "践行“一次开发,多端部署”理念,实现多设备无缝协同,提供一致且高效的用户体验。", "author": null, diff --git a/common/src/main/resources/rawfile/mockdata/sample-details-all.json b/common/src/main/resources/rawfile/mockdata/sample-details-all.json index 76192b9dd6450c97bcf8ed0dbf1f32ae15b45625..f4eef444eda102b682075386b6efee09b529d307 100644 --- a/common/src/main/resources/rawfile/mockdata/sample-details-all.json +++ b/common/src/main/resources/rawfile/mockdata/sample-details-all.json @@ -9,18 +9,32 @@ "sampleDetail": [ { "id": 60, - "title": "HMOS世界 示例代码合集", - "desc": "HMOS世界App是华为官方出品的一款大型开源开发示范应用。", + "title": "HarmonyOS代码工坊", + "desc": "HarmonyOS代码工坊App是华为官方出品的一款大型开源开发示范应用。", "preInstalled": true, "sampleType": "commonClient", "isFavorite": false, "mediaType": 1, "mediaUrl": "image/sample/hdc/hmosworld_all_device.png", - "originalUrl": "", + "originalUrl": "https://gitee.com/harmonyos_samples/sample_in_harmonyos/blob/master/README.md", "moduleName": "", "abilityName": "", "order": 1 }, + { + "id": 63, + "title": "HarmonyOS代码工坊(手表版)", + "desc": "HarmonyOS代码工坊手表开发案例。", + "preInstalled": true, + "sampleType": "wearableClient", + "isFavorite": false, + "mediaType": 1, + "mediaUrl": "image/sample/hdc/hmosworld_watch.png", + "originalUrl": "https://gitee.com/harmonyos_samples/sample_in_harmonyos/blob/master/README.md", + "moduleName": "", + "abilityName": "", + "order": 7 + }, { "id": 61, "title": "三折叠,怎么折都有面", @@ -90,20 +104,6 @@ "moduleName": "continuepublishsample", "abilityName": "ContinuepublishsampleAbility", "order": 6 - }, - { - "id": 63, - "title": "HMOS世界(手表版)", - "desc": "HMOS世界手表开发案例。", - "preInstalled": true, - "sampleType": "wearableClient", - "isFavorite": false, - "mediaType": 1, - "mediaUrl": "image/sample/hdc/hmosworld_watch.png", - "originalUrl": "", - "moduleName": "", - "abilityName": "", - "order": 7 } ] }, diff --git a/common/src/main/resources/rawfile/mockdata/sample-page.json b/common/src/main/resources/rawfile/mockdata/sample-page.json index 87e3586de49742cf90652a95c032afc349d813c4..1bfb37b5a2ecdf1b6b15875350b455d0b693bd16 100644 --- a/common/src/main/resources/rawfile/mockdata/sample-page.json +++ b/common/src/main/resources/rawfile/mockdata/sample-page.json @@ -49,9 +49,9 @@ "sampleCards": [ { "id": 60, - "cardTitle": "HMOS世界 示例代码合集", + "cardTitle": "HarmonyOS代码工坊", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_green.png", + "cardImage": "image/common/sample_card_background_blue.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -61,7 +61,7 @@ "cardId": 25, "mediaType": 1, "mediaUrl": "image/sample/hdc/hmosworld_all_device.png", - "title": "HMOS世界 示例代码合集", + "title": "HarmonyOS代码工坊", "subTitle": "", "tags": [ "该案例已支持多设备" @@ -70,11 +70,34 @@ } ] }, + { + "id": 63, + "cardTitle": "HarmonyOS代码工坊(手表版)", + "cardStyleType": 5, + "cardImage": "image/common/sample_card_background_green.png", + "version": 1000000, + "detailCardId": 35, + "sampleContents": [ + { + "id": 63, + "type": 2, + "cardId": 28, + "mediaType": 1, + "mediaUrl": "image/sample/hdc/hmosworld_watch.png", + "title": "HarmonyOS代码工坊(手表版)", + "subTitle": "", + "tags": [ + "使用Watch5体验完整效果" + ], + "order": 1 + } + ] + }, { "id": 61, "cardTitle": "三折叠,怎么折都有面", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_blue.png", + "cardImage": "image/common/sample_card_background_pink.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -97,7 +120,7 @@ "id": 62, "cardTitle": "扩感导航,视野更清晰", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_pink.png", + "cardImage": "image/common/sample_card_background_green.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -120,7 +143,7 @@ "id": 64, "cardTitle": "碰一碰视频快速分享", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_blue.png", + "cardImage": "image/common/sample_card_background_pink.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -143,7 +166,7 @@ "id": 65, "cardTitle": "视频投播更便捷", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_pink.png", + "cardImage": "image/common/sample_card_background_blue.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -166,7 +189,7 @@ "id": 66, "cardTitle": "跨设备内容编辑新体验", "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_green.png", + "cardImage": "image/common/sample_card_background_pink.png", "version": 1000000, "detailCardId": 35, "sampleContents": [ @@ -185,29 +208,6 @@ "order": 1 } ] - }, - { - "id": 63, - "cardTitle": "HMOS世界(手表版)", - "cardStyleType": 5, - "cardImage": "image/common/sample_card_background_pink.png", - "version": 1000000, - "detailCardId": 35, - "sampleContents": [ - { - "id": 63, - "type": 2, - "cardId": 28, - "mediaType": 1, - "mediaUrl": "image/sample/hdc/hmosworld_watch.png", - "title": "HMOS世界(手表版)", - "subTitle": "", - "tags": [ - "使用Watch5体验完整效果" - ], - "order": 1 - } - ] } ] }, diff --git a/features/devpractices/src/main/ets/component/TagLabel.ets b/features/devpractices/src/main/ets/component/TagLabel.ets index 571ddf6b2e68b98a5c196860c1207d82380abb11..46b75ee1f7cbe9093e08ab98675cc18f8fe2e81c 100644 --- a/features/devpractices/src/main/ets/component/TagLabel.ets +++ b/features/devpractices/src/main/ets/component/TagLabel.ets @@ -84,7 +84,7 @@ export struct TagLabel { Row() { Text(item.tag) .fontColor(this.cardStyleType === CardStyleTypeEnum.PICTURE_TO_SWIPER ? - $r('app.color.card_font_secondary_color') : $r('sys.color.font_on_secondary')) + $r('app.color.card_font_secondary_color') : $r('sys.color.font_secondary')) .width(item.width - PADDING_WIDTH) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) diff --git a/features/devpractices/src/main/ets/viewmodel/SampleDetailPageVM.ets b/features/devpractices/src/main/ets/viewmodel/SampleDetailPageVM.ets index 88faa14d529543a9a0c64c92da64e4d13c6e578d..1a069b88bb14d4f70276d10d2a8c65c928599ba1 100644 --- a/features/devpractices/src/main/ets/viewmodel/SampleDetailPageVM.ets +++ b/features/devpractices/src/main/ets/viewmodel/SampleDetailPageVM.ets @@ -38,7 +38,6 @@ import { SampleTypeEnum } from '../common/SampleConstant'; const TAG = '[SampleDetailPageVM]'; export class SampleDetailPageVM extends BaseVM { - private pageContext: PageContext = AppStorage.get('pageContext') as PageContext; private static instance: SampleDetailPageVM; private sampleDetailModel = SampleDetailModel.getInstance(); diff --git a/features/devpractices/src/main/resources/base/element/string.json b/features/devpractices/src/main/resources/base/element/string.json index aa13c20c91a84eeaac05daabc07b0593b1c4ccb9..bbe990de0d43f6cae38fdb2025ccb7b8a4840b81 100644 --- a/features/devpractices/src/main/resources/base/element/string.json +++ b/features/devpractices/src/main/resources/base/element/string.json @@ -54,7 +54,7 @@ }, { "name": "client_prompt", - "value": "The HMOS world supports 1+8 multi-device operation. Welcome to experience it" + "value": "Sample in HarmonyOS supports 1+8 multi-device operation. Welcome to experience it" } ] } \ No newline at end of file diff --git a/features/devpractices/src/main/resources/en_US/element/string.json b/features/devpractices/src/main/resources/en_US/element/string.json index 9b56fb37a24c542d0462c15537471c4520f710ac..23c8c575017c62be0c9ebc40da04ea0180173952 100644 --- a/features/devpractices/src/main/resources/en_US/element/string.json +++ b/features/devpractices/src/main/resources/en_US/element/string.json @@ -54,7 +54,7 @@ }, { "name": "client_prompt", - "value": "The HMOS world supports 1+8 multi-device operation. Welcome to experience it" + "value": "Sample in HarmonyOS supports 1+8 multi-device operation. Welcome to experience it" } ] } \ No newline at end of file diff --git a/features/devpractices/src/main/resources/zh_CN/element/string.json b/features/devpractices/src/main/resources/zh_CN/element/string.json index 229cec3753740c2445e8ddcd3685949adcbb0eea..8bae6e1eb914878f45129bbc79a6dd34db108e96 100644 --- a/features/devpractices/src/main/resources/zh_CN/element/string.json +++ b/features/devpractices/src/main/resources/zh_CN/element/string.json @@ -54,7 +54,7 @@ }, { "name": "client_prompt", - "value": "HMOS世界支持1+8多设备运行,欢迎体验" + "value": "HarmonyOS代码工坊支持1+8多设备运行,欢迎体验" } ] } \ No newline at end of file diff --git a/features/exploration/src/main/ets/component/ExperienceItem.ets b/features/exploration/src/main/ets/component/ExperienceItem.ets index efbee2c3220b68554f5f88e4cb2ad09ef1960c0a..277166921b8262709d56e6f05fec6d80d72d3278 100644 --- a/features/exploration/src/main/ets/component/ExperienceItem.ets +++ b/features/exploration/src/main/ets/component/ExperienceItem.ets @@ -28,6 +28,7 @@ export struct ExperienceItem { Image($rawfile(this.discoverContent.mediaUrl)) .alt($r('app.media.img_placeholder')) .objectFit(ImageFit.Cover) + .draggable(false) .width('100%') .height('100%') Column() { diff --git a/features/mine/src/main/ets/view/AboutView.ets b/features/mine/src/main/ets/view/AboutView.ets index c1ec45b0d267b4d10e46a93fd32e34cbdae64ff4..1cb74024cc79f446f25765b0014790adc75928bc 100644 --- a/features/mine/src/main/ets/view/AboutView.ets +++ b/features/mine/src/main/ets/view/AboutView.ets @@ -20,6 +20,7 @@ import { AboutVM, ViewRegistrationInfoEvent } from '../viewmodel/AboutVM'; @Component export struct AboutView { viewModel: AboutVM = AboutVM.getInstance(); + build() { Column() { Column() { @@ -27,6 +28,7 @@ export struct AboutView { .draggable(false) .width($r('app.float.about_image_size')) .height($r('app.float.about_image_size')) + .borderRadius($r('sys.float.corner_radius_level8')) Text($r('app.string.app_name')) .fontSize($r('sys.float.Title_S')) .fontWeight(FontWeight.Bold) @@ -36,6 +38,7 @@ export struct AboutView { } .margin({ top: $r('sys.float.padding_level8') }) .padding({ left: $r('sys.float.padding_level8'), right: $r('sys.float.padding_level8') }) + Column() { Text($r('app.string.copyright1')) .fontWeight(FontWeight.Medium) diff --git a/features/mine/src/main/resources/base/element/string.json b/features/mine/src/main/resources/base/element/string.json index 3cca3126c5a4b6bdea5e9087d3ea12f9e9fe2e4e..8a117c85dfa380dda927945bf6e5512c05b3a3f8 100644 --- a/features/mine/src/main/resources/base/element/string.json +++ b/features/mine/src/main/resources/base/element/string.json @@ -22,7 +22,7 @@ }, { "name": "app_name", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "copyright1", diff --git a/features/mine/src/main/resources/base/media/app_icon.png b/features/mine/src/main/resources/base/media/app_icon.png index 70d199582d58f8a5d6fb3ecacf7f8c55b93f14b1..99bd6a94a18cb81bd8a0af3329eec20cb4748c7c 100644 Binary files a/features/mine/src/main/resources/base/media/app_icon.png and b/features/mine/src/main/resources/base/media/app_icon.png differ diff --git a/features/mine/src/main/resources/en_US/element/string.json b/features/mine/src/main/resources/en_US/element/string.json index 3cca3126c5a4b6bdea5e9087d3ea12f9e9fe2e4e..8a117c85dfa380dda927945bf6e5512c05b3a3f8 100644 --- a/features/mine/src/main/resources/en_US/element/string.json +++ b/features/mine/src/main/resources/en_US/element/string.json @@ -22,7 +22,7 @@ }, { "name": "app_name", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "copyright1", diff --git a/features/mine/src/main/resources/zh_CN/element/string.json b/features/mine/src/main/resources/zh_CN/element/string.json index 5e2593e7e737351a1df35e7db912ca826693f1c9..73815d877c4efea3dead221ef608dc8c8223b34c 100644 --- a/features/mine/src/main/resources/zh_CN/element/string.json +++ b/features/mine/src/main/resources/zh_CN/element/string.json @@ -22,7 +22,7 @@ }, { "name": "app_name", - "value": "HMOS世界" + "value": "HMOS代码工坊" }, { "name": "copyright1", diff --git a/hmosword-build/image/10.PNG b/hmosword-build/image/10.PNG new file mode 100644 index 0000000000000000000000000000000000000000..1ca33909c2613375ab0a2a8b4140e81f77580210 Binary files /dev/null and b/hmosword-build/image/10.PNG differ diff --git a/hmosword-build/image/9.png b/hmosword-build/image/9.png index 7eec602e8981397b22e99e57477d38445549b2fd..684758335e39e0d7c2ea14e3d6770e73fec904f5 100644 Binary files a/hmosword-build/image/9.png and b/hmosword-build/image/9.png differ diff --git a/hmosword-build/screenshots/1.png b/hmosword-build/screenshots/1.png index 08615e07dcbf4427ddd85d7dfa412a36cb380eaa..a36dcdc210431e17e952d3e77d2eded84f2cd9f1 100644 Binary files a/hmosword-build/screenshots/1.png and b/hmosword-build/screenshots/1.png differ diff --git a/hmosword-build/screenshots/11.png b/hmosword-build/screenshots/11.png index 2c8532a266c94aebd3fc7ab95624e298d51a31cf..619f3409a1ccde3a00efbeb953f44b2ee879aa9d 100644 Binary files a/hmosword-build/screenshots/11.png and b/hmosword-build/screenshots/11.png differ diff --git a/hmosword-build/screenshots/12.png b/hmosword-build/screenshots/12.png index 619f3409a1ccde3a00efbeb953f44b2ee879aa9d..6924ee43492318662667997b09d87abf14a619c5 100644 Binary files a/hmosword-build/screenshots/12.png and b/hmosword-build/screenshots/12.png differ diff --git a/hmosword-build/screenshots/13.png b/hmosword-build/screenshots/13.png new file mode 100644 index 0000000000000000000000000000000000000000..4554e45e8115f015c04f0ebc1798f5cc4607f7f7 Binary files /dev/null and b/hmosword-build/screenshots/13.png differ diff --git a/hmosword-build/screenshots/14.png b/hmosword-build/screenshots/14.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3e0e382b1efb39bc3e80c265157d43dc5de7e5 Binary files /dev/null and b/hmosword-build/screenshots/14.png differ diff --git a/hmosword-build/screenshots/15.png b/hmosword-build/screenshots/15.png new file mode 100644 index 0000000000000000000000000000000000000000..a70cd1d98363f8e765fe61878efd3b58a850b993 Binary files /dev/null and b/hmosword-build/screenshots/15.png differ diff --git a/hmosword-build/screenshots/2.png b/hmosword-build/screenshots/2.png index 6ec4f8e60baa6a673726e1f48ca451d87c34b6b3..d7f1bce4ee36ef824777cead91ad6c950f3894d6 100644 Binary files a/hmosword-build/screenshots/2.png and b/hmosword-build/screenshots/2.png differ diff --git a/hmosword-build/screenshots/3.png b/hmosword-build/screenshots/3.png index 2ed3759f0967592083a40225321e86a6eee7e4e7..702ff1a1095c12585b8783200e30c289b22ddb7a 100644 Binary files a/hmosword-build/screenshots/3.png and b/hmosword-build/screenshots/3.png differ diff --git a/hmosword-build/screenshots/4.png b/hmosword-build/screenshots/4.png index de53034f9d52f829ab059338a48deaddf603fec2..84a0bb6bf7df9fdb1822a15e3c9fff5be04001e9 100644 Binary files a/hmosword-build/screenshots/4.png and b/hmosword-build/screenshots/4.png differ diff --git a/hmosword-build/screenshots/5.png b/hmosword-build/screenshots/5.png index 473478a3e797d496c8ac06b9cf2bc18be4a3b19e..0521da59f1836dfa0d6c8f73b9a0013a263e7b9f 100644 Binary files a/hmosword-build/screenshots/5.png and b/hmosword-build/screenshots/5.png differ diff --git a/hmosword-build/screenshots/6.png b/hmosword-build/screenshots/6.png index 30516b25d97e670f8cf0bc6fa5fde65f62e86447..53f8edf66a79efbd13f553288b06b4f1f57ad372 100644 Binary files a/hmosword-build/screenshots/6.png and b/hmosword-build/screenshots/6.png differ diff --git a/hmosword-build/screenshots/7.png b/hmosword-build/screenshots/7.png index fc0bd314ca3467f0e6ba3ea1da7a5f2b5549e840..a454fb1be85b8508fe861b4f0c06b77a3dca9e92 100644 Binary files a/hmosword-build/screenshots/7.png and b/hmosword-build/screenshots/7.png differ diff --git a/hmosword-build/screenshots/8.png b/hmosword-build/screenshots/8.png index 5a87a4b31d83bd4febc51612b22158bdbe188ccf..df9676a1a6e234702ff2467c13276c36e308324e 100644 Binary files a/hmosword-build/screenshots/8.png and b/hmosword-build/screenshots/8.png differ diff --git a/hmosword-build/screenshots/9.png b/hmosword-build/screenshots/9.png index 6370ea0ff5c211f585ed7bd445977d3094809b2e..b3da12578f2469a246ef7de857eabfe9be71855e 100644 Binary files a/hmosword-build/screenshots/9.png and b/hmosword-build/screenshots/9.png differ diff --git a/products/phone/src/main/resources/base/element/string.json b/products/phone/src/main/resources/base/element/string.json index b20e19a14f67a270d6802dee2d78b57cb9da0021..98eb03e515534f4eb147bfe835788519f3afe19b 100644 --- a/products/phone/src/main/resources/base/element/string.json +++ b/products/phone/src/main/resources/base/element/string.json @@ -10,11 +10,11 @@ }, { "name": "EntryAbility_label", - "value": "HMOS World" + "value": "Sample in HarmonyOS" }, { "name": "splash_main_title", - "value": "HarmonyOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "splash_sub_title", @@ -62,11 +62,11 @@ }, { "name": "widget_display_name", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "title_immersive", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "detail_immersive", diff --git a/products/phone/src/main/resources/base/media/ic_background.png b/products/phone/src/main/resources/base/media/ic_background.png index 4c4671724ec24a20eaad33c37800194a808cbfbb..2c4ebb884d18fe3f81e83fbbe850e7ddee4dfee9 100644 Binary files a/products/phone/src/main/resources/base/media/ic_background.png and b/products/phone/src/main/resources/base/media/ic_background.png differ diff --git a/products/phone/src/main/resources/base/media/ic_foreground.png b/products/phone/src/main/resources/base/media/ic_foreground.png index c17d456e4bb7aebc3ad21b4ac87bf8ffdd8eef41..633d7243b55c07163b416bef06b83b630a6696f4 100644 Binary files a/products/phone/src/main/resources/base/media/ic_foreground.png and b/products/phone/src/main/resources/base/media/ic_foreground.png differ diff --git a/products/phone/src/main/resources/base/media/ic_start_icon.png b/products/phone/src/main/resources/base/media/ic_start_icon.png index 36b0832781045a4b2200bb1506d132821b93d442..99bd6a94a18cb81bd8a0af3329eec20cb4748c7c 100644 Binary files a/products/phone/src/main/resources/base/media/ic_start_icon.png and b/products/phone/src/main/resources/base/media/ic_start_icon.png differ diff --git a/products/phone/src/main/resources/en_US/element/string.json b/products/phone/src/main/resources/en_US/element/string.json index b20e19a14f67a270d6802dee2d78b57cb9da0021..98eb03e515534f4eb147bfe835788519f3afe19b 100644 --- a/products/phone/src/main/resources/en_US/element/string.json +++ b/products/phone/src/main/resources/en_US/element/string.json @@ -10,11 +10,11 @@ }, { "name": "EntryAbility_label", - "value": "HMOS World" + "value": "Sample in HarmonyOS" }, { "name": "splash_main_title", - "value": "HarmonyOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "splash_sub_title", @@ -62,11 +62,11 @@ }, { "name": "widget_display_name", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "title_immersive", - "value": "HMOSWorld" + "value": "Sample in HarmonyOS" }, { "name": "detail_immersive", diff --git a/products/phone/src/main/resources/rawfile/image/sample/hdc/hmosworld_watch.png b/products/phone/src/main/resources/rawfile/image/sample/hdc/hmosworld_watch.png index 22d61518839bd754afa055c2fd5a64736662f4a4..d887e0b302f7e03ebf28e3eaca532e7b9a32af1d 100644 Binary files a/products/phone/src/main/resources/rawfile/image/sample/hdc/hmosworld_watch.png and b/products/phone/src/main/resources/rawfile/image/sample/hdc/hmosworld_watch.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/app-continuation/index.html b/products/phone/src/main/resources/resfile/articlecols/articles/app-continuation/index.html index 55444a0a4db4a39d0877a87194b7f87be23f5531..1ec84979cd1815d94d397288085079e35e2685e2 100644 --- a/products/phone/src/main/resources/resfile/articlecols/articles/app-continuation/index.html +++ b/products/phone/src/main/resources/resfile/articlecols/articles/app-continuation/index.html @@ -78,9 +78,6 @@
  • 用户在A设备编辑页面选择用户照片,并编辑标题、正文等文字信息。
  • 用户点击B设备Dock栏图标,在A设备输入的图片和文字信息衔接到B设备上
  • -
    图1-3 内容编辑流转

    参考案例

    场景使用:适用于文件类型数据接续,比如图片、视频以及PDF等。

    @@ -100,9 +97,6 @@

    系统支持用户接续上次浏览位置,无需重新从列表顶部开始滑动查找,精准定位到之前离开的条目附近,节省用户的时间和操作成本,提升在长列表内容浏览时的便利性和体验感。

    -
    图1-4 列表进度流转

    参考案例

    场景使用:适用于List、Grid以及Swiper封装的列表内容流转,比如瀑布流、轮播内容。

    @@ -120,9 +114,6 @@

    系统支持从源设备暂停的位置无缝续播视频,确保播放进度、画质和音效设置保持一致,为用户提供连贯的观影体验。无论是流媒体平台的影视内容,还是本地存储的视频文件,均能实现流畅的跨设备续播。

    -
    图1-5 媒体播放流转

    参考案例

    场景使用:适用于媒体播放内容的流转,包括音频、视频等。

    @@ -140,9 +131,6 @@

    系统支持迅速定位到源设备浏览的网页位置,保证用户的浏览连续性,避免重复查找信息的繁琐过程,提高信息获取的效率。

    -
    图1-6 web浏览进度流转

    参考案例

    场景使用:适用于Web组件嵌套H5页面内容的流转,主要使用JsBridge桥接。

    diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/design-animation/index.html b/products/phone/src/main/resources/resfile/articlecols/articles/design-animation/index.html index 6f3dfef7a38a480a323747f0253d6bfbee49cb6a..ec49340714e6fac775f8ff06f8d6939048002414 100644 --- a/products/phone/src/main/resources/resfile/articlecols/articles/design-animation/index.html +++ b/products/phone/src/main/resources/resfile/articlecols/articles/design-animation/index.html @@ -21,7 +21,6 @@

    1.1 UX动效设计

    -
    图1-1

    人因x动效

    力的既视感

    • 将力赋予元素
    • 直观地传递出形象化、拟物化、动态化
    @@ -41,88 +40,19 @@

    运动一致

    • 在动作编排时应遵循运动路径方式一致
    • 不一致的运动会分散用户视觉焦点
    • 运用适当的编排手法,引导用户聚焦操作任务
    图1-7
    -

    隐藏等待

    -
    • 动效能够减少用户在操作时的等待感
    • 通过元素的运动或转场过渡,减少用户对界面等待产生的焦虑
    -
    图1-8
    -

    1.2 转场动效

    -

    衔接页面与页面,或元素与元素间的过渡动画称之为转场动效,帮助用户理解界面以及元素之间的逻辑关系。

    -

    层级转场

    -
    • 转场后的页面或元素与当前存在上下层级关系。
    -
    • 页面转场采用左右位移的运动方式,不应单帧直接切换或者上下位移切换。
    • 应用场景:上下级页面切换、解锁操作。
    -

    推荐:列表样式转场采用左右位移的运动方式

    -

    -

    推荐:混合样式切换采用左右位移的运动方式

    -

    -

    不推荐:页面转场采用单帧切换

    -

    -

    搜索转场

    -
    • 一镜到底是通过共享元素、容器和动势来进行转场过渡的一种编排方式。
    • 搜索框作为持续存在的元素前后串连,建议使用一镜到底;不应单帧直接切换或者非共享元素的方式转场。
    • 曲线优先使用弹簧曲线。
    -

    推荐:一镜到底

    -

    -

    推荐:淡入淡出

    -

    -

    不推荐:左右平移

    -

    -

    新建转场

    -
    • 新建功能目的性层、级性明确。
    • 系统页面转场采用上下位移的半模态运动方式,不应单帧直接切换或者左右位移切换。
    • 曲线优先使用弹簧曲线。
    -

    推荐:半模态上下位移

    -

    -

    推荐:淡入淡出

    -

    -

    不推荐:左右平移

    -

    -

    编辑转场

    -
    • 建议使用淡入淡出的过渡方式。
    • 不应单帧直接切换或者位移切换。
    • 曲线优先使用弹簧曲线。
    -

    推荐:一镜到底

    -

    -

    不推荐:左右切换

    -

    -

    不推荐:上下平移

    -

    -

    卡片打开

    -
    • 前后相邻界面切换跳转,或较大元素的进出场必须有转场动效过渡,如无特殊原因。
    • 推荐使用一镜到底的共享元素手法。
    • 不应单帧直接切换(含动效设计缺失和实现效果丢失两种情况)。
    • 全屏页面的转场动效时长,8.5英寸以下设备不应短于200ms。
    • 8.5至12英寸的设备上不应短于250ms。
    • 12英寸以上的设备上不应短于300ms。
    -

    推荐:一镜到底

    -

    -

    推荐:一镜到底

    -

    -

    不推荐:单帧切换

    -

    -

    推荐:一镜到底

    -

    -

    不推荐:单帧切换

    -

    -

    多种编排

    -
    • 同类型动效编排方式差异:例如手机上使用图标到界面共享容器的方式;智慧屏上采用共享动势的方式来避免过大的位移路径给用户带来不适感。
    • 应用启动时(包括通过图标、服务卡片、通知卡片等入口)应尽量避免显示无内容的启动页(全黑、全白色彩填充)。
    • 有内容填充的启动页在全屏状态停留时长不建议超过3s,全黑、全白的空白无内容启动页在全屏状态停留时长不建议超过300ms。
    -

    推荐:一镜到底

    -

    +
    + +
    +

    更多UX动效设计请参考:UX设计指南-动效

    -
    -

    1.3 手势动效

    -

    手在终端屏幕或触摸板等输入设备上进行跟手操作的动效,大致分为点击、滑动、拖拽等手势。

    -

    列表滑动

    -
    • 通过弹性曲线等物理模型,带来流畅的操作反馈感,还原真实可行的手势操作体验。
    • 可滑动页面达到一定手速的滑动操作时,手离开屏幕后,界面应继续移动。
    • 移动速度应该随时间缓慢下降,直至界面停止。
    • 上下滑动到顶部或底部,应该有反馈动效。
    • 左右滑动到左边界或右边界),应该有反馈动效。
    -

    推荐:不满一屏滑动

    -

    -

    不推荐:页面不跟手

    -

    -

    推荐:过界回弹

    -

    -

    不推荐:无阻尼&过界无回弹

    -

    -

    推荐:大小标题联动

    -

    -

    翻页滑动

    -
    • 翻动通过抛滑和拖拽手势进行操作,由翻页这类场景承载。
    • 翻页是基于设定区域进行对象内容的翻动切换。
    • 到达边界后应尽可能赋予回弹的操作体验。
    -

    推荐:翻页跟手

    -

    -

    推荐:过界回弹

    -

    -
    -
    +
    + diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/layered-architecture-design/index.html b/products/phone/src/main/resources/resfile/articlecols/articles/layered-architecture-design/index.html index cb3850057b8fcfc6487e7310ed29e98d5caaa6c2..a20b976f3ce4ffff554d596bfd27706fcb5d29b2 100644 --- a/products/phone/src/main/resources/resfile/articlecols/articles/layered-architecture-design/index.html +++ b/products/phone/src/main/resources/resfile/articlecols/articles/layered-architecture-design/index.html @@ -33,10 +33,10 @@

    1.1 概述

    - HMOS世界的分层架构设计是为了在同一套代码工程的基础上,构建手机、平板等1+8设备上的产物,实现HarmonyOS应用的“一次开发,多端部署”的理念。

    -

    本文将从HMOS世界应用的设计、开发、部署三个视角说明HarmonyOS应用的三层架构规则与实践。

    +

    本文将从HarmonyOS代码工坊应用的设计、开发、部署三个视角说明HarmonyOS应用的三层架构规则与实践。

    @@ -98,20 +98,20 @@
    -

    1.2.2 HMOS世界案例

    +

    1.2.2 HarmonyOS代码工坊案例

    - HMOS世界在业务上需要支持手机、折叠屏、平板、PC这些设备,结合以上典型鸿蒙应用的分层架构设计,HMOS世界客户端的分层设计如下:

    + HarmonyOS代码工坊在业务上需要支持手机、折叠屏、平板、PC这些设备,结合以上典型鸿蒙应用的分层架构设计,HarmonyOS代码工坊客户端的分层设计如下:

    Products层

    - 该层的主要负责提供应用在不同设备上的个性化业务,包含设备差异化的UI、资源和配置文件。当前HMOS世界支持手机、平板设备类型,后期将支持PC端,因此在产品定制层划分出手机、平板、PC三个不同设备入口。

    + 该层的主要负责提供应用在不同设备上的个性化业务,包含设备差异化的UI、资源和配置文件。当前HarmonyOS代码工坊支持手机、平板设备类型,后期将支持PC端,因此在产品定制层划分出手机、平板、PC三个不同设备入口。

    Features层

    - 该层是由应用的不同业务特性聚合而成,应用需根据自身业务划分出各个基础特性。结合HMOS世界当前运行实际业务,可划分为以下几个特性:

    + 该层是由应用的不同业务特性聚合而成,应用需根据自身业务划分出各个基础特性。结合HarmonyOS代码工坊当前运行实际业务,可划分为以下几个特性:

    • 组件体验业务:负责提供ArkUI组件体验、系统能力体验、关键代码预览、相关资料、相关海报内容查阅等能力。
    • @@ -124,7 +124,7 @@

      Common层

      - 该层是应用各个特性的基础能力集,由各特性的公共业务组成。结合HMOS世界特性模块划分,其公共能力包括公共UI组件、海报预览模块、文章预览模块、视频播控模块、特性包管理模块、存储服务、路由模块、桌面卡片服务、华为账号管理服务、消息推送模块、运维模块、版本管理等。 + 该层是应用各个特性的基础能力集,由各特性的公共业务组成。结合HarmonyOS代码工坊特性模块划分,其公共能力包括公共UI组件、海报预览模块、文章预览模块、视频播控模块、特性包管理模块、存储服务、路由模块、桌面卡片服务、华为账号管理服务、消息推送模块、运维模块、版本管理等。

    @@ -172,14 +172,14 @@
    -

    1.3.2 HMOS世界案例

    +

    1.3.2 HarmonyOS代码工坊案例

    -

    基于以上典型鸿蒙应用的代码与构建模型设计原则,HMOS世界的代码工程模型和编译构建产物整体过程如下图:

    +

    基于以上典型鸿蒙应用的代码与构建模型设计原则,HarmonyOS代码工坊的代码工程模型和编译构建产物整体过程如下图:

    代码结构

    -

    HMOS世界自身代码结构根据逻辑模型的三层划分,分别创建以下目录和相关子目录,以组织相关业务代码。

    +

    HarmonyOS代码工坊自身代码结构根据逻辑模型的三层划分,分别创建以下目录和相关子目录,以组织相关业务代码。

    ├─common                  // 公共能力模块
     │  ├─accountservice       // 账号服务
     │  ├─pushservice          // 推送服务
    @@ -197,20 +197,20 @@
     │  ├─phone                // 手机、Pad产品
     │  ├─pc                   // pc产品
     └─samples                 // Samples集成 
    -      └─xxxsample           // 集成到HMOS世界内的Sample
    + └─xxxsample // 集成到HarmonyOS代码工坊内的Sample

    Products层编译

    - HMOS世界在业务上需同时支持手机、平板、PC三个设备端,结合下文的应用部署原则中的应用分包/共包设计原则,考虑到手机、Pad部署特性相同,仅UX页面差异,决定手机和Pad采用共包方案,页面差异通过系统的页面级一多能力实现;PC业务后期会部署PC独有特性,因此PC端采用分包方案,单独编译PC产品的Hap包。 + HarmonyOS代码工坊在业务上需同时支持手机、平板、PC三个设备端,结合下文的应用部署原则中的应用分包/共包设计原则,考虑到手机、Pad部署特性相同,仅UX页面差异,决定手机和Pad采用共包方案,页面差异通过系统的页面级一多能力实现;PC业务后期会部署PC独有特性,因此PC端采用分包方案,单独编译PC产品的Hap包。

    Features层编译
    1. - HMOS世界自身业务不需要单独部署的特性,编译成Har包,打包到Product层的Entry的Hap包内。
    2. -
    3. HMOS世界上架的Sample代码,需要单独编译成Feature + HarmonyOS代码工坊自身业务不需要单独部署的特性,编译成Har包,打包到Product层的Entry的Hap包内。
    4. +
    5. HarmonyOS代码工坊上架的Sample代码,需要单独编译成Feature Hap包。以Product层的Hap包+Sample Hap包组合部署。
    6. -
    7. 各个上架HMOS世界的Sample需要单独做多设备适配。
    8. +
    9. 各个上架HarmonyOS代码工坊的Sample需要单独做多设备适配。

    -

    1.4.2 HMOS世界案例

    +

    1.4.2 HarmonyOS代码工坊案例

    - HMOS世界在业务上需同时支持手机、平板、PC三个设备端,考虑到后期在手机平板页面布局有差异,且存在差异化特性。因此在不同设备使用不同的entry hap包,entry进行分包。

    -

    HMOS世界内集成的Sample示例代码工程在上述构建过程中被编译成Feature + HarmonyOS代码工坊在业务上需同时支持手机、平板、PC三个设备端,考虑到后期在手机平板页面布局有差异,且存在差异化特性。因此在不同设备使用不同的entry hap包,entry进行分包。

    +

    HarmonyOS代码工坊内集成的Sample示例代码工程在上述构建过程中被编译成Feature Hap,运行时根据需要通过StoreKit按需下载并拉起运行,为部署方式为按需加载。此外,Sample工程编译的Feature Hap需要适配多设备。

    鸿蒙世界的客户端在设备部署如下图:

    1.5 总结

    - 本文从应用开发的设计、开发、部署全流程,围绕三层架构设计,讲述了鸿蒙应用开发的逻辑模型、代码和构建模型、应用部署模型设计原则和其在HMOS世界中的实际应用。展示了一个清晰、高效、可拓展的设计模型,实现HarmonyOS应用的一次开发多端部署理念。 + 本文从应用开发的设计、开发、部署全流程,围绕三层架构设计,讲述了鸿蒙应用开发的逻辑模型、代码和构建模型、应用部署模型设计原则和其在HarmonyOS代码工坊中的实际应用。展示了一个清晰、高效、可拓展的设计模型,实现HarmonyOS应用的一次开发多端部署理念。

    diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/1.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/1.png index 1fd91c78d9cdafd6b89b2a72bd298010662498ff..512f079ad3dffbbb8580a88a5c0741d2e1c7bcb5 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/1.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/1.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/2.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/2.png index 0358d990ffb35f202be0503fcceb58c3329fe170..339540af4d32543df0737d71b8dc9348234e46b0 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/2.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/2.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/3.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/3.png index 1d406cb453dee59b46dc43432ce10e1c8a6267e3..cd8a23b54c28813338bf05c22bf01fc52f5eee4c 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/3.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/3.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/4.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/4.png index bf394abd2c66780add7a67888047f5167d3e9b4f..84a0bb6bf7df9fdb1822a15e3c9fff5be04001e9 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/4.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/4.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/5.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/5.png index 9e072f3d898f77997656c26f9e66744ee474bbd5..7647d6203ee4642b6cc6091f913f6d605c2f0cf6 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/5.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/5.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/6.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/6.png index 3e4c5a46881cd113917b946a4accc09f5cd1c4a1..0521da59f1836dfa0d6c8f73b9a0013a263e7b9f 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/6.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/6.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/7.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/7.png index 4518ec1277fedec9c37025ade021cfb0d96eee62..a454fb1be85b8508fe861b4f0c06b77a3dca9e92 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/7.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/7.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/8.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/8.png index 522e953fbb7f4b2509c510452896b56a3a1e8846..db0eae8c747734d8d6f5df974f3321da697833d3 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/8.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/8.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/9.png b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/9.png index 5a853053cb5e0faa73aa63e2e1b50694badd14ec..df9676a1a6e234702ff2467c13276c36e308324e 100644 Binary files a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/9.png and b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/ManulImages/9.png differ diff --git a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/index.html b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/index.html index 57eefb9ed1eaa48388678443c3697433b53a766e..d027c5e973a4ee81b74666f6a31b07f8b6817b9c 100644 --- a/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/index.html +++ b/products/phone/src/main/resources/resfile/articlecols/articles/multi-adaptation/index.html @@ -4,7 +4,7 @@ - 一多适配 + HMOS代码工坊一多开发实践