diff --git a/Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ts b/Ability/PagesRouter/entry/src/main/ets/common/utils/Logger.ets similarity index 33% rename from Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ts rename to Ability/PagesRouter/entry/src/main/ets/common/utils/Logger.ets index 2d6ae5689555250fba9a3cffcd588fac64173fba..e10590ed49971df816ee2703aab860d022a9271b 100644 --- a/Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ts +++ b/Ability/PagesRouter/entry/src/main/ets/common/utils/Logger.ets @@ -13,43 +13,44 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability' - -export default class EntryAbility extends Ability { - onCreate(want, launchParam) { - console.log('[Demo] MainAbility onCreate'); - globalThis.abilityWant = want; - } - - onDestroy() { - console.log('[Demo] MainAbility onDestroy'); - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log('[Demo] MainAbility onWindowStageCreate'); - - windowStage.loadContent('pages/IndexPage', (err, data) => { - if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log('[Demo] MainAbility onWindowStageDestroy'); - } - - onForeground() { - // Ability has brought to foreground - console.log('[Demo] MainAbility onForeground'); - } - - onBackground() { - // Ability has back to background - console.log('[Demo] MainAbility onBackground'); - } -}; +import hilog from '@ohos.hilog'; + +/** + * Common log for all features. + */ +export class Logger { + private domain: number; + private prefix: string; + private format: string = `%{public}s, %{public}s`; + + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: any[]) { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: any[]) { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: any[]) { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: any[]) { + hilog.error(this.domain, this.prefix, this.format, args); + } + + fatal(...args: any[]) { + hilog.fatal(this.domain, this.prefix, this.format, args); + } + + isLoggable(level: number) { + hilog.isLoggable(this.domain, this.prefix, level); + } +} + +export default new Logger('[PageRouter]'); \ No newline at end of file diff --git a/Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ets b/Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a0462cbbebebc9703661c4849ef6134524559ec --- /dev/null +++ b/Ability/PagesRouter/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility' +import Logger from '../common/utils/Logger'; + +const TAG = '[EntryAbility]'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + Logger.info(TAG, 'onCreate'); + globalThis.abilityWant = want; + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + Logger.info(TAG, 'onWindowStageCreate'); + windowStage.loadContent('pages/IndexPage', (err, data) => { + if (err.code) { + Logger.info(TAG, 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } +}; diff --git a/Ability/PagesRouter/entry/src/main/ets/pages/IndexPage.ets b/Ability/PagesRouter/entry/src/main/ets/pages/IndexPage.ets index 0ad7ba8f7670445a040dfc15eea8b0bce10fd883..b3594ed3653ea49dcff26ef9fbac7a177e49d0cf 100644 --- a/Ability/PagesRouter/entry/src/main/ets/pages/IndexPage.ets +++ b/Ability/PagesRouter/entry/src/main/ets/pages/IndexPage.ets @@ -15,6 +15,9 @@ import router from '@ohos.router'; import CommonConstants from '../common/constants/CommonConstants'; +import Logger from '../common/utils/Logger'; + +const TAG = '[IndexPage]'; /** * The IndexPage is the entry point of the application. @@ -37,11 +40,13 @@ struct IndexPage { .height(CommonConstants.BUTTON_HEIGHT) .backgroundColor($r('app.color.button_bg')) .onClick(() => { - router.push({ + router.pushUrl({ url: CommonConstants.SECOND_URL, params: { src: CommonConstants.SECOND_SRC_MSG } + }).catch((error) => { + Logger.info(TAG, 'IndexPage push error' + JSON.stringify(error)); }); }) } diff --git a/Ability/PagesRouter/entry/src/main/module.json5 b/Ability/PagesRouter/entry/src/main/module.json5 index f750bc4bc2a1a9122321a8e5f1f57b91d4cd341c..3d51a6a4e8f909a7a4509935d8fa5e944c604e34 100644 --- a/Ability/PagesRouter/entry/src/main/module.json5 +++ b/Ability/PagesRouter/entry/src/main/module.json5 @@ -11,10 +11,14 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ts", + "srcEntrance": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label", diff --git a/Ability/PagesRouter/package.json b/Ability/PagesRouter/package.json index b41d1ab3fd0e4762ff2283e346da5d8ca1db1acd..b634df4ec5d828fc8201725d02384830dc89bc24 100644 --- a/Ability/PagesRouter/package.json +++ b/Ability/PagesRouter/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "pagesrouter", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1-rc27", - "@ohos/hvigor": "1.3.1-rc27" - } + "license": "ISC", + "devDependencies": {}, + "name": "pagesrouter", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/DetailsAbility/DetailsAbility.ts b/Ability/StageAbilityDemo/entry/src/main/ets/DetailsAbility/DetailsAbility.ts index 5e2886ea51e558614a51d7fbf0559602c7a97ba2..9c95a4f29a9b685ac25e8df2563b96cd55e619b5 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/DetailsAbility/DetailsAbility.ts +++ b/Ability/StageAbilityDemo/entry/src/main/ets/DetailsAbility/DetailsAbility.ts @@ -14,7 +14,7 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability'; +import Ability from '@ohos.app.ability.UIAbility'; const TAG: string = 'DetailsAbility'; const KEY: string = 'GoodsPosition'; @@ -37,10 +37,10 @@ export default class DetailsAbility extends Ability { windowStage.loadContent('pages/DetailsPage', (err, data) => { if (err.code) { - hilog.error(DETAIL_ABILITY_DOMAIN, TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + hilog.error(DETAIL_ABILITY_DOMAIN, TAG, 'Failed. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } - hilog.info(DETAIL_ABILITY_DOMAIN, TAG, 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + hilog.info(DETAIL_ABILITY_DOMAIN, TAG, 'Succeeded. Data: %{public}s', JSON.stringify(data) ?? ''); }); } diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets b/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets index 72abc29dfbb0201be911ea2049a01645340eb037..615d403b6e1141b6401ac17b8b109b3f7bf1dfb2 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets @@ -40,15 +40,20 @@ export { AppFontSize, AppFontWeight }; export const PERCENTAGE_100 = '100%'; /** - * The percentage of 23. + * The percentage of 20. */ -export const PERCENTAGE_23 = '23%'; +export const PERCENTAGE_20 = '20%'; /** * The percentage of 50. */ export const PERCENTAGE_50 = '50%'; +/** + * The text margin of 18. + */ +export const Text_Margin = 18; + /** * The style of CardComponent. */ @@ -221,9 +226,13 @@ export const DetailsPageStyle = { /** * The image size for more action. */ - IMAGE_SIZE_MORE: 14, + IMAGE_SIZE_MORE: 14 }; +/** + * ability name. + */ +export const DETAILS_ABILITY_NAME = 'DetailsAbility' diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/entryability/EntryAbility.ts b/Ability/StageAbilityDemo/entry/src/main/ets/entryability/EntryAbility.ts index f4b294e47d804cf65bc1cd2656a140703858cfa5..301a3570a3458a1b5d9e6d9b87dd8a87b903ca74 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/entryability/EntryAbility.ts +++ b/Ability/StageAbilityDemo/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,7 +14,7 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import Ability from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' const TAG: string = 'EntryAbility'; diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/pages/DetailsPage.ets b/Ability/StageAbilityDemo/entry/src/main/ets/pages/DetailsPage.ets index 00e01ec38292a960e56c6b90ba86102499e602f8..5235520dd438367521e10c1b53b72546a47ecf39 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/pages/DetailsPage.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/pages/DetailsPage.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import AppContext from '@ohos.application.context'; +import AppContext from '@ohos.app.ability.common'; import { DetailsPageStyle, PERCENTAGE_100 } from '../common/constants/Constants'; import AddressComponent from '../view/details/AddressComponent'; import PickerComponent from '../view/details/PickerComponent'; @@ -77,7 +77,7 @@ struct DetailsPage { Image($rawfile('detail/detail_back.png')) .setTopImageStyle() .onClick(() => { - let handler = getContext(this) as AppContext.AbilityContext; + let handler = getContext(this) as AppContext.UIAbilityContext; handler.terminateSelf(); }) } diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/pages/NavPage.ets b/Ability/StageAbilityDemo/entry/src/main/ets/pages/NavPage.ets index 60186a33a467fd755f1daa6f61ccf077a0476b04..e04f9725609d5888e693a52aaf884e3e499ecde8 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/pages/NavPage.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/pages/NavPage.ets @@ -37,7 +37,7 @@ let viewModel: NavViewModel = new NavViewModel(); @Component struct NavPage { @State toolBarConfigs: ToolBarData[] = []; // bottom navigation data. - @State navCurrentPosition: number = NavPageStyle.POSITION_INITIAL; + navCurrentPosition: number = NavPageStyle.POSITION_INITIAL; private controller: TabsController = new TabsController(); aboutToAppear() { @@ -55,7 +55,7 @@ struct NavPage { this.HolderPage(item?.text) } } - }, item => item.toString()) + }, item => JSON.stringify(item)) }.setTabStyle() } .toolBar(this.ToolBarBuilder()) @@ -66,8 +66,10 @@ struct NavPage { ToolBarComponent({ controller: this.controller, toolBarConfigs: this.toolBarConfigs, - navCurrentPosition: $navCurrentPosition + navCurrentPosition: this.navCurrentPosition }) + .backgroundColor(Color.White) + .height(PERCENTAGE_100) } @Builder HolderPage(text: Resource) { diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/ToolBarComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/ToolBarComponent.ets index 1f504ffd00e8fb7d6e31248cbd3d4e3350df46e0..e18903f3066c6a831c53e44aedb2ee3f81668e3c 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/ToolBarComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/ToolBarComponent.ets @@ -15,10 +15,11 @@ import ToolBarData from '../common/bean/ToolBarData'; import { AppFontSize, AppFontWeight, PERCENTAGE_100, ToolBarStyle } from '../common/constants/Constants'; +import { NavPageStyle } from '../common/constants/Constants'; @Component export default struct ToolBarComponent { - @Link navCurrentPosition: number; + @State navCurrentPosition: number = NavPageStyle.POSITION_INITIAL;; toolBarConfigs: ToolBarData[]; controller: TabsController; @@ -46,11 +47,9 @@ export default struct ToolBarComponent { this.navCurrentPosition = item.num this.controller.changeIndex(this.navCurrentPosition) }) - }) + }, item => JSON.stringify(item)) } } - .backgroundColor(Color.White) - .height(PERCENTAGE_100) } } diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServiceItemComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServiceItemComponent.ets index fafc9db80afda5ba07cd114331f1370d07080c51..9700882b649b727353f90519517bfdf38c3a9d04 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServiceItemComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServiceItemComponent.ets @@ -19,7 +19,7 @@ import { GoodsServiceItem } from '../../common/constants/DetailsConstants'; @Component export default struct ServiceItemComponent { serviceName: string; - @Prop description: string; + description: string; isShowActionMore: boolean; build() { diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServicesComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServicesComponent.ets index b2dfe7f0d1f4eae829372e02b80d54f30ee44856..fc0386634e038110228c71d1bd2fea3f55a1d1f1 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServicesComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/details/ServicesComponent.ets @@ -38,7 +38,7 @@ export default struct ServicesComponent { isShowActionMore: item?.name != null }) } - }, (item) => (item?.id).toString()) + }, item => JSON.stringify(item)) } .width(PERCENTAGE_100) diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/BannerComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/BannerComponent.ets index 3d190231f369c9c6bc39400b63c0c16bb5037052..b256aed96de524915dfbd377c9b01851e98d736a 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/BannerComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/BannerComponent.ets @@ -15,7 +15,7 @@ import BannerData from '../../common/bean/BannerData'; import { Banner } from '../../common/constants/HomeConstants'; -import { PERCENTAGE_100, PERCENTAGE_23 } from '../../common/constants/Constants'; +import { PERCENTAGE_100, PERCENTAGE_20 } from '../../common/constants/Constants'; @Component export default struct BannerComponent { @@ -28,7 +28,7 @@ export default struct BannerComponent { Image(item.imgSrc) .width(PERCENTAGE_100) .objectFit(ImageFit.Contain) - }) + }, item => JSON.stringify(item)) } .cachedCount(Banner.CACHE_COUNT) .index(Banner.POSITION) @@ -47,6 +47,6 @@ export default struct BannerComponent { .curve(Curve.Linear) } .width(Banner.WIDTH) - .height(PERCENTAGE_23) + .height(PERCENTAGE_20) } } \ No newline at end of file diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/GoodsComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/GoodsComponent.ets index 201e0f03237a90f36b9fa38437765644fe3004cf..831e286bee23202cd7c66d72c89321cfb2862d56 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/GoodsComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/GoodsComponent.ets @@ -31,7 +31,7 @@ export default struct GoodsComponent { }.onClick(() => { this.startPage(index); }) - }) + }, item => JSON.stringify(item)) } .columnsTemplate(GoodsList.GRID_STYLE) .columnsGap(GoodsList.SPACE) diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/HomePage.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/HomePage.ets index 5d4a2a6ac4ae27e43a2f70e68c3d56c565514881..a126cea82c0a1c93acc53a623194ad1fc206ee97 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/HomePage.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/HomePage.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import AppContext from '@ohos.application.context'; +import AppContext from '@ohos.app.ability.common'; import HomeViewModel from '../../viewmodel/HomeViewModel'; import TopBarComponent from './TopBarComponent'; import TabsComponent from './TabsComponent'; @@ -63,7 +63,8 @@ export default struct HomePage { let handler = getContext(this) as AppContext.Context; viewModel.startDetailsAbility(handler, index); } }) - }.width(PERCENTAGE_100) + } + .width(PERCENTAGE_100) } .height(PERCENTAGE_100) .backgroundImage($rawfile('index/index_background.png'), ImageRepeat.NoRepeat) diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/MenusComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/MenusComponent.ets index 257c5510c427a6ff7daa002f40b6d7c73aa5c3e0..0d2ff09bd993d9efd26a8187b9d6334dd298b860 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/MenusComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/MenusComponent.ets @@ -37,7 +37,7 @@ export default struct MenusComponent { .width(Menus.LAYOUT_WEIGHT) .padding({ top: Menus.ITEM_PADDING_VERTICAL, bottom: Menus.ITEM_PADDING_VERTICAL }) - }) + }, item => JSON.stringify(item)) } .justifyContent(FlexAlign.Center) .padding({ top: Menus.CONTAINER_PADDING_VERTICAL, diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/TabsComponent.ets b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/TabsComponent.ets index ad39b95606c1fc48346e24ce12c007e6f443dfd1..4162475e969d9e7f00c16443df119b70094eda02 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/view/home/TabsComponent.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/view/home/TabsComponent.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AppFontSize, AppFontWeight, PERCENTAGE_100 } from '../../common/constants/Constants'; +import { AppFontSize, AppFontWeight, PERCENTAGE_100, Text_Margin } from '../../common/constants/Constants'; import { GoodsTabs } from '../../common/constants/HomeConstants'; @Component @@ -27,7 +27,7 @@ export default struct TabsComponent { TabContent() { } .tabBar(this.TabBuilder(index)) - }) + }, item => JSON.stringify(item)) } .vertical(false) .scrollable(true) @@ -63,6 +63,7 @@ export default struct TabsComponent { .fontSize(AppFontSize.MIDDLE) } .height(PERCENTAGE_100) + .margin({left:Text_Margin}) .justifyContent(FlexAlign.Center) .align(Alignment.Start) } diff --git a/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/HomeViewModel.ets b/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/HomeViewModel.ets index 8965491e54e93d992837cfb7fc78e94554f83fa6..be92c5dad051954edcfdba2fc58efd879b9873fe 100644 --- a/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/HomeViewModel.ets +++ b/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/HomeViewModel.ets @@ -18,6 +18,7 @@ import DataModel from '../model/DataModel'; import GoodsData from '../common/bean/GoodsData'; import BannerData from '../common/bean/BannerData'; import MenuData from '../common/bean/MenuData'; +import { DETAILS_ABILITY_NAME } from '../common/constants/Constants'; const TAG = 'HomeViewModel'; const HOME_PAGE_DOMAIN = 0x00004; @@ -41,8 +42,8 @@ export default class HomeViewModel { public startDetailsAbility(context, index: number): void { const want = { - bundleName: 'com.example.StageAbilityDemo', - abilityName: 'DetailsAbility', + bundleName: getContext(context).applicationInfo.name, + abilityName: DETAILS_ABILITY_NAME, parameters: { position: index } diff --git a/Ability/StageAbilityDemo/entry/src/main/module.json5 b/Ability/StageAbilityDemo/entry/src/main/module.json5 index 6f7ca468dab38eb8cb3d32765f8c349f26669b09..3a2d798c25c5d67c15fedff641a999ee189c9e1a 100644 --- a/Ability/StageAbilityDemo/entry/src/main/module.json5 +++ b/Ability/StageAbilityDemo/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "entryAbility", diff --git a/Ability/StageAbilityDemo/package.json b/Ability/StageAbilityDemo/package.json index f986bae0adf81ab85595aff000df5eb668926d1b..ce972d9a1237092593f4fdc494a667b374860e7f 100644 --- a/Ability/StageAbilityDemo/package.json +++ b/Ability/StageAbilityDemo/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"stage_ability_demo", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "stage_ability_demo", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } \ No newline at end of file diff --git a/Data/Preferences/entry/src/main/ets/common/constants/StyleConstants.ets b/Data/Preferences/entry/src/main/ets/common/constants/StyleConstants.ets index 5a6bac71b15f86c4838675df62ca39536d114baf..3825bba5ef18d64665817cf4c6abed37956fab71 100644 --- a/Data/Preferences/entry/src/main/ets/common/constants/StyleConstants.ets +++ b/Data/Preferences/entry/src/main/ets/common/constants/StyleConstants.ets @@ -80,7 +80,7 @@ class StyleConstants { /** * Big margin bottom */ - MARGIN_BOTTOM_BIG = '35%'; + MARGIN_BOTTOM_BIG = '321vp'; /** * The height of button component. @@ -95,7 +95,7 @@ class StyleConstants { /** * The bottom margin of the button component. */ - BUTTON_MARGIN_BOTTOM = '3%'; + BUTTON_MARGIN_BOTTOM = '24vp'; } export default new StyleConstants(); \ No newline at end of file diff --git a/Data/Preferences/entry/src/main/ets/entryability/EntryAbility.ts b/Data/Preferences/entry/src/main/ets/entryability/EntryAbility.ts index a548a4a610b5dd2da5ff1fa5173e9d21ccb88d97..77a95488e491692c6abf39487cacd0025168e66c 100644 --- a/Data/Preferences/entry/src/main/ets/entryability/EntryAbility.ts +++ b/Data/Preferences/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,6 +1,6 @@ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' -import Window from '@ohos.window' +import Ability from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window'; export default class EntryAbility extends Ability { onCreate(want, launchParam) { diff --git a/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets b/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets index 70f65fb0acdb57294cb4ed0bc542bcaf24dec46b..62a18f5f7e2704a248f810959db5fec04e1dacaa 100644 --- a/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets +++ b/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets @@ -14,14 +14,12 @@ */ import dataPreferences from '@ohos.data.preferences'; -import prompt from '@ohos.prompt'; -import ctx from '@ohos.application.context'; +import promptAction from '@ohos.promptAction'; import Logger from '../common/utils/Logger'; import CommonConstants from '../common/constants/CommonConstants'; import Fruit from '../common/bean/Fruit'; -// Get AbilityContext. -let context = getContext(this) as ctx.AbilityContext; +let context = getContext(this); let preference: dataPreferences.Preferences = null; /** @@ -143,7 +141,7 @@ class PreferenceModel { * @param message Prompt message. */ showToastMessage(message: Resource) { - prompt.showToast({ + promptAction.showToast({ message: message, duration: CommonConstants.DURATION }); diff --git a/Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets b/Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets index 348b8cd3c0d11c56a8ade9e051f7865e1a2ddb6a..4b56ff145e0b5d03226f3b46d8354a32691a7155 100644 --- a/Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets +++ b/Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets @@ -39,7 +39,7 @@ export default struct ButtonComponent { .onClick(() => { item.clickMethod(); }) - }, item => item.toString()) + }, item => JSON.stringify(item)) } } diff --git a/Data/Preferences/entry/src/main/module.json5 b/Data/Preferences/entry/src/main/module.json5 index 0e288c05b41ef026b9f802f6c848bd5301ebc785..a9d839910fb2fa85778eb5640dff8621fd75b1f2 100644 --- a/Data/Preferences/entry/src/main/module.json5 +++ b/Data/Preferences/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/Data/Preferences/package.json b/Data/Preferences/package.json index 6df8182612d3ff67ab67ed3de4da49081b3334d3..b1ecadd150de1e6724e9db47efb22aeaa61de6f4 100644 --- a/Data/Preferences/package.json +++ b/Data/Preferences/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "preferences", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "preferences", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/Data/Rdb/build-profile.json5 b/Data/Rdb/build-profile.json5 index fc53829be062f3a883f815802e6039c733ebb352..d7b1117cdb34aab2983ac65026d9e8dcc91332d1 100644 --- a/Data/Rdb/build-profile.json5 +++ b/Data/Rdb/build-profile.json5 @@ -1,5 +1,6 @@ { "app": { + "signingConfigs": [], "compileSdkVersion": 9, "compatibleSdkVersion": 9, "products": [ diff --git a/Data/Rdb/entry/src/main/ets/common/constants/CommonConstants.ets b/Data/Rdb/entry/src/main/ets/common/constants/CommonConstants.ets index 841517a8dec4636c57dd36f644293f2d16306379..260f354ad134b43e41dc02d3cb7b379cce620150 100644 --- a/Data/Rdb/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/Data/Rdb/entry/src/main/ets/common/constants/CommonConstants.ets @@ -45,7 +45,7 @@ export default class CommonConstants { */ static readonly FULL_WIDTH = '100%'; static readonly FULL_HEIGHT = '100%'; - static readonly DIALOG_HEIGHT = '60%'; + static readonly DIALOG_HEIGHT = '55%'; static readonly TABS_HEIGHT = '45%'; static readonly MINIMUM_SIZE = 0; static readonly FULL_SIZE = 1; diff --git a/Data/Rdb/entry/src/main/ets/common/database/Rdb.ets b/Data/Rdb/entry/src/main/ets/common/database/Rdb.ets index dbb2ac7dff9f1e51e9a296972942a95c629822ee..0bada312474d6b5e7f7990903a2051cea3677387 100644 --- a/Data/Rdb/entry/src/main/ets/common/database/Rdb.ets +++ b/Data/Rdb/entry/src/main/ets/common/database/Rdb.ets @@ -14,12 +14,9 @@ */ import data_rdb from '@ohos.data.rdb'; -import context from '@ohos.application.context'; import CommonConstants from '../constants/CommonConstants'; import { Logger } from '../utils/Logger'; -type Context = context.Context; - export default class Rdb { private rdbStore: any = null; private tableName: string; @@ -42,7 +39,7 @@ export default class Rdb { callback(); return } - var context: Context = getContext(this) as Context; + let context = getContext(this); data_rdb.getRdbStore(context, CommonConstants.STORE_CONFIG, 1, (err, rdb) => { if (err) { Logger.error(`${CommonConstants.RDB_TAG}`, 'gerRdbStore() failed, err: ' + err); diff --git a/Data/Rdb/entry/src/main/ets/entryability/EntryAbility.ts b/Data/Rdb/entry/src/main/ets/entryability/EntryAbility.ts index aa93509b1249fe579422fc634160edf7f6f22277..3d3b0b357ef2a50edbabbdabd6c9424dadb47cf2 100644 --- a/Data/Rdb/entry/src/main/ets/entryability/EntryAbility.ts +++ b/Data/Rdb/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,10 +14,10 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' -export default class entryAbility extends Ability { +export default class entryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/Data/Rdb/entry/src/main/ets/view/DialogComponent.ets b/Data/Rdb/entry/src/main/ets/view/DialogComponent.ets index 631d55d002269bbae8c97dffe33f00d1b5217e63..b4d35c5492c97197b4a65e96acf3d4795c262571 100644 --- a/Data/Rdb/entry/src/main/ets/view/DialogComponent.ets +++ b/Data/Rdb/entry/src/main/ets/view/DialogComponent.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import prompt from '@ohos.promptAction'; import AccountData from '../common/bean/AccountData'; import AccountItem from '../common/bean/AccountItem'; import { PayList, EarnList } from '../viewmodel/AccountList'; @@ -42,7 +42,13 @@ export struct DialogComponent { .width($r('app.float.component_size_MP')) .padding({ top: $r('app.float.edge_size_LM'), bottom: $r('app.float.edge_size_S') }) .margin({ bottom: $r('app.float.edge_size_S') }) - .border(this.curIndex === index ? { width: { bottom: $r('app.float.border_size_M') }, color: $r('app.color.main_color') } : {}) + .border(this.curIndex === index ? { width: { bottom: $r('app.float.border_size_M') }, color: $r('app.color.main_color') } : { color: Color.White }) + } + + aboutToAppear() { + this.inputAmount = this.newAccount.amount.toString(); + this.curIndex = this.newAccount.accountType; + this.curType = this.newAccount.typeText; } selectAccount(item: AccountItem) { @@ -60,7 +66,7 @@ export struct DialogComponent { this.controller.close(); }) - Tabs({ barPosition: BarPosition.Start }) { + Tabs({ barPosition: BarPosition.Start, index: this.curIndex }) { TabContent() { Scroll(this.scroller) { Row() { @@ -130,7 +136,7 @@ export struct DialogComponent { .width(CommonConstants.FULL_WIDTH) .height(CommonConstants.TABS_HEIGHT) .vertical(false) - .barMode(BarMode.Scrollable) + .barMode(BarMode.Fixed) .onChange((index) => { this.curIndex = index; }) diff --git a/Data/Rdb/entry/src/main/module.json5 b/Data/Rdb/entry/src/main/module.json5 index a14a4b9fe8cbab939cf19a3f0630d477cc2f1770..98eff6f52d0a91d8e2e43137fa5c66c76b34cae0 100644 --- a/Data/Rdb/entry/src/main/module.json5 +++ b/Data/Rdb/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/Data/Rdb/package.json b/Data/Rdb/package.json index 462a951e418d91c3cd8c211c67562d2ad2b58678..989aafd0a9b0bd2ecee04d77cef53701d15e59bb 100644 --- a/Data/Rdb/package.json +++ b/Data/Rdb/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"rdb", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "rdb", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets index c02673fc37dab134aefd00469d733aed2a7cbe52..2644a8e8caf70ff6bc7960abf0f082e574a44884 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets @@ -47,12 +47,12 @@ export class RefreshConstants { /** * refresh state enum */ -export enum RefreshState { - IDLE, - DRAGGING, - DRAGGING_REFRESHABLE, - REFRESHING, - COMPLETE +export const RefreshState = { + IDLE: 0, + DRAGGING: 1, + DRAGGING_REFRESHABLE: 2, + REFRESHING: 3, + COMPLETE: 4 } /** diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets index 764ba9a80d4ea49983ae27374e97a4ef0511aad0..e5d9c5b0eda72d7a78e26bc059b807c81808bf10 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets @@ -13,9 +13,7 @@ * limitations under the License. */ -import ctx from '@ohos.application.context'; - -let context = getContext(this) as ctx.Context; +let context = getContext(this); const DESIGN_WIDTH = 360; const DESIGN_HEIGHT = 780; diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/entryAbility/EntryAbility.ts b/ETSUI/AnimateRefresh/entry/src/main/ets/entryAbility/EntryAbility.ts index 805bb537fbc3ee75dbe36ab8a4bc7879c3ce8a5f..74180ac934e80ec02ae72cb8cfb13614c42e6827 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/entryAbility/EntryAbility.ts +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/entryAbility/EntryAbility.ts @@ -15,7 +15,7 @@ import window from '@ohos.window'; import display from '@ohos.display'; -import Ability from '@ohos.application.Ability' +import Ability from '@ohos.app.ability.UIAbility'; export default class MainAbility extends Ability { onCreate(want) { diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets index 51aea737731ddc15c0fb2a04cedd2a2670fc3aaf..2102364594ec0f716f0181b0240af3c241976a08 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets @@ -23,7 +23,7 @@ import DimensionUtil from '../common/utils/DimensionUtil'; */ @Component export default struct FileManagerIndex { - @Provide(RefreshConstants.REFRESH_STATE_TAG) state: RefreshState = RefreshState.REFRESHING; + @Provide(RefreshConstants.REFRESH_STATE_TAG) state: number = RefreshState.REFRESHING; @Builder ContentBody() { Image($r('app.media.bg_content')) diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshAnimHeader.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshAnimHeader.ets index 1209368294c110d6c4801372c2dece32cb962058..a3a4bdee3217a34dfa22b742c2d022b277b4acbc 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshAnimHeader.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshAnimHeader.ets @@ -19,7 +19,7 @@ import DimensionUtil from '../common/utils/DimensionUtil'; @Component export default struct RefreshAnimHeader { - @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateCheck') state: RefreshState; + @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateCheck') state: number; @State iconWidth: number = CommonConstants.REFRESH_HEADER_ITEM_DEFAULT_WIDTH; private onStateCheck() { @@ -50,7 +50,7 @@ export default struct RefreshAnimHeader { if (this.state !== RefreshState.IDLE) { // stop animation when idle state. ForEach(CommonConstants.REFRESH_HEADER_FEATURE, (iconItem) => { this.AttrAnimIcons(iconItem) - }, item => item.toString()) + }, item => JSON.stringify(item)) } } .width(CommonConstants.FULL_LENGTH) diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshComponent.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshComponent.ets index 2623eec654743dc4295a6f848ab5c97905e84fdd..093c00d35a2c67eee6bf7dae7538ccc0d866e98b 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshComponent.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshComponent.ets @@ -25,7 +25,7 @@ export default struct RefreshComponent { private listController: Scroller = new Scroller(); private onRefresh: () => void; @State headerOffset: number = 0; - @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateChanged') state: RefreshState; + @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateChanged') state: number; @BuilderParam itemLayout: () => void; private onStateChanged() { diff --git a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshDefaultHeader.ets b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshDefaultHeader.ets index cce1e2a23f799a1ee74a6d2cd0fc9844bb2c63fe..e832beb05467124e299a1c3b19b054958ddfd3e2 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshDefaultHeader.ets +++ b/ETSUI/AnimateRefresh/entry/src/main/ets/view/RefreshDefaultHeader.ets @@ -20,7 +20,7 @@ import DimensionUtil from '../common/utils/DimensionUtil'; @Component export default struct RefreshDefaultHeader { @State refreshTitle: Resource = $r('app.string.refresh_default_header_hint'); - @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateCheck') state: RefreshState; + @Consume(RefreshConstants.REFRESH_STATE_TAG) @Watch('onStateCheck') state: number; private onStateCheck() { switch (this.state) { diff --git a/ETSUI/AnimateRefresh/entry/src/main/module.json5 b/ETSUI/AnimateRefresh/entry/src/main/module.json5 index 92941b536d33eeae0711b792d120a72ba7de20ea..fae94ed238b88b8d8bf09b1c6a8a3346848700d6 100644 --- a/ETSUI/AnimateRefresh/entry/src/main/module.json5 +++ b/ETSUI/AnimateRefresh/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "MainAbility", diff --git a/ETSUI/AnimateRefresh/package.json b/ETSUI/AnimateRefresh/package.json index 1621b0bd3173b49d483a66ec41a21fcf7d87ae86..0e938ad34aef696d18b409bd4df09bf5287d0686 100644 --- a/ETSUI/AnimateRefresh/package.json +++ b/ETSUI/AnimateRefresh/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"refreshlayoutdemo", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "refreshlayoutdemo", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/Animation/entry/src/main/ets/common/bean/IconItem.ets b/ETSUI/Animation/entry/src/main/ets/common/bean/IconItem.ets index 8598954f0b0f6ed347062bb6bbdc2197a2ef050a..832ef00382cfdd6c45445768659036cc6fa70824 100644 --- a/ETSUI/Animation/entry/src/main/ets/common/bean/IconItem.ets +++ b/ETSUI/Animation/entry/src/main/ets/common/bean/IconItem.ets @@ -13,14 +13,19 @@ * limitations under the License. */ +import Point from './Point'; + +@Observed export default class IconItem { index: number = 0; clicked: boolean = false; image: Resource = $r('app.media.badge1'); + point: Point = new Point(0, 0); - constructor(index: number, image: Resource, clicked: boolean) { + constructor(index: number, image: Resource, clicked: boolean, point: Point) { this.index = index; this.image = image; this.clicked = clicked; + this.point = point; } } \ No newline at end of file diff --git a/ETSUI/Animation/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/Animation/entry/src/main/ets/entryability/EntryAbility.ts index a548a4a610b5dd2da5ff1fa5173e9d21ccb88d97..b6e2b38a53747d0734ded206067e645f56f01bad 100644 --- a/ETSUI/Animation/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/Animation/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,8 +1,8 @@ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' -import Window from '@ohos.window' +import UIAbility from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window'; -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/ETSUI/Animation/entry/src/main/ets/pages/Index.ets b/ETSUI/Animation/entry/src/main/ets/pages/Index.ets index 7c624bd1da0836c5fdc83d81614e2af18187e784..6edaaddb0dec8e109de5a10c2bdf6a9c874af248 100644 --- a/ETSUI/Animation/entry/src/main/ets/pages/Index.ets +++ b/ETSUI/Animation/entry/src/main/ets/pages/Index.ets @@ -16,22 +16,19 @@ import { AnimationWidgets } from '../view/AnimationWidgets'; import { CountController } from '../view/CountController'; import Common from '../common/constants/Const'; -import { AxisModel } from '../viewmodel/AxisModel'; import {IconsModel} from '../viewmodel/IconsModel'; @Entry @Component struct Index { @State quantity: number = Common.IMAGES_MIN; - @State axis: AxisModel = new AxisModel(Common.OFFSET_RADIUS, this.quantity); - @State iconModel: IconsModel = new IconsModel(this.quantity); + @Provide iconModel: IconsModel = new IconsModel(this.quantity, Common.OFFSET_RADIUS); + build() { Column() { AnimationWidgets({ - quantity: $quantity, - axis: this.axis, - iconModel: this.iconModel + quantity: $quantity }) CountController({ diff --git a/ETSUI/Animation/entry/src/main/ets/view/AnimationWidgets.ets b/ETSUI/Animation/entry/src/main/ets/view/AnimationWidgets.ets index add96b41facc83eda9a9db564645e0e330feba9b..2da7fb364cd66ee6f34e3c075f2d17099b696935 100644 --- a/ETSUI/Animation/entry/src/main/ets/view/AnimationWidgets.ets +++ b/ETSUI/Animation/entry/src/main/ets/view/AnimationWidgets.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { AxisModel } from '../viewmodel/AxisModel'; import { IconsModel } from '../viewmodel/IconsModel'; import { IconAnimation } from './IconAnimation'; import Common from '../common/constants/Const'; @@ -23,12 +22,10 @@ import IconItem from '../common/bean/IconItem'; export struct AnimationWidgets { @State mainFlag: boolean = false; @Link @Watch('onQuantityChange') quantity: number; - @ObjectLink axis: AxisModel; - @ObjectLink iconModel: IconsModel; + @Consume iconModel: IconsModel; onQuantityChange() { this.iconModel.addImage(this.quantity); - this.axis.addPoints(this.quantity); } aboutToAppear() { @@ -55,11 +52,12 @@ export struct AnimationWidgets { ForEach(this.iconModel.imagerArr, (item: IconItem) => { IconAnimation({ item: item, - point: this.axis.points[item.index], mainFlag: $mainFlag }) - }, item => JSON.stringify(item)) + }, item => JSON.stringify(item.index)) } + .width(Common.DEFAULT_FULL_WIDTH) + .height(Common.DEFAULT_FULL_HEIGHT) .rotate({ x: 0, y: 0, diff --git a/ETSUI/Animation/entry/src/main/ets/view/CountController.ets b/ETSUI/Animation/entry/src/main/ets/view/CountController.ets index 90e5e4cc3c835525ad05c12b422bc1baddcd29d2..51eed5dc528a922b9a67748704562283ecff4e58 100644 --- a/ETSUI/Animation/entry/src/main/ets/view/CountController.ets +++ b/ETSUI/Animation/entry/src/main/ets/view/CountController.ets @@ -33,7 +33,7 @@ export struct CountController { style: SliderStyle.InSet }) .blockColor(Color.White) - .selectedColor('#007DFF') + .selectedColor($r('app.color.SliderSelectColor')) .margin({ top: $r('app.float.size_5') }) diff --git a/ETSUI/Animation/entry/src/main/ets/view/IconAnimation.ets b/ETSUI/Animation/entry/src/main/ets/view/IconAnimation.ets index d73954a4fbfcab286e3f59dac04b39db3731e313..2f13356d6d022029f5ac77d9e885872ea8cfb2c9 100644 --- a/ETSUI/Animation/entry/src/main/ets/view/IconAnimation.ets +++ b/ETSUI/Animation/entry/src/main/ets/view/IconAnimation.ets @@ -14,14 +14,12 @@ */ import IconItem from '../common/bean/IconItem'; -import Point from '../common/bean/Point'; import Common from '../common/constants/Const'; @Component export struct IconAnimation { @Link mainFlag: boolean; - @State point: Point = new Point(0, 0); - @State item: IconItem = new IconItem(0, $r('app.media.badge1'), false); + @ObjectLink item: IconItem; build() { Image(this.item.image) @@ -30,8 +28,8 @@ export struct IconAnimation { .objectFit(ImageFit.Contain) .translate( this.mainFlag - ? { x: this.point.x, y: this.point.y } - : { x: 0, y: 0 } + ? { x: this.item.point.x, y: this.item.point.y } + : { x: 0, y: 0 } ) .rotate({ x: 0, diff --git a/ETSUI/Animation/entry/src/main/ets/viewmodel/IconsModel.ets b/ETSUI/Animation/entry/src/main/ets/viewmodel/IconsModel.ets index 7eaab7b65681fc3dff431fac9c8a7a0d31b0b8eb..61f515ac926c365ebf6a4994c982516227b6fbc7 100644 --- a/ETSUI/Animation/entry/src/main/ets/viewmodel/IconsModel.ets +++ b/ETSUI/Animation/entry/src/main/ets/viewmodel/IconsModel.ets @@ -15,24 +15,50 @@ import Common from '../common/constants/Const'; import IconItem from '../common/bean/IconItem'; +import Point from '../common/bean/Point'; + +const TWO_PI: number = 2 * Math.PI; @Observed export class IconsModel { public imagerArr: Array = []; private num: number = Common.IMAGES_MIN; + private radius: number; - constructor(num: number) { + constructor(num: number, radius) { + this.radius = radius; this.addImage(num); } public addImage(num) { - this.imagerArr = []; this.num = num; + if (this.imagerArr.length == num) { + return; + } + if (this.imagerArr.length > num) { + this.imagerArr.splice(num, this.imagerArr.length - num); + } else { + for (let i = this.imagerArr.length; i < num; i++) { + const point = this.genPointByIndex(i); + this.imagerArr.push(new IconItem(i, Common.IMAGE_RESOURCE[i], false, point)); + } + } + + this.refreshPoint(num); + } + + public refreshPoint(num) { for (let i = 0; i < num; i++) { - this.imagerArr.push(new IconItem(i, Common.IMAGE_RESOURCE[i], false)); + this.imagerArr[i].point = this.genPointByIndex(i); } } + public genPointByIndex(index: number): Point { + const x = this.radius * Math.cos(TWO_PI * index / this.num); + const y = this.radius * Math.sin(TWO_PI * index / this.num); + return new Point(x, y); + } + public reset() { for (let i = 0; i < this.num; i++) { if (this.imagerArr[i].clicked) { diff --git a/ETSUI/Animation/entry/src/main/module.json5 b/ETSUI/Animation/entry/src/main/module.json5 index cce9dc1b3afc697ce06df763dead5c97c86bdb25..b1615d0bc08bfdbd63c4d9564a8c5d37fc39e0eb 100644 --- a/ETSUI/Animation/entry/src/main/module.json5 +++ b/ETSUI/Animation/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/Animation/entry/src/main/resources/base/element/color.json b/ETSUI/Animation/entry/src/main/resources/base/element/color.json index f3a30322cb30ecec9378b29d136ba3abcbf4f9b9..fc81610c00c8bc11629ed3bdb0e29b1e294d4e2b 100644 --- a/ETSUI/Animation/entry/src/main/resources/base/element/color.json +++ b/ETSUI/Animation/entry/src/main/resources/base/element/color.json @@ -15,6 +15,10 @@ { "name": "fontGrayColor", "value": "#182431" + }, + { + "name": "SliderSelectColor", + "value": "#007DFF" } ] } \ No newline at end of file diff --git a/ETSUI/Animation/package.json b/ETSUI/Animation/package.json index 1b87fd4f8cd7ecb32b178363315aa47789fe9bf3..2fa704514bcadadd2a237d79a4dc6b7f4af9b985 100644 --- a/ETSUI/Animation/package.json +++ b/ETSUI/Animation/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"animation", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "animation", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/ArkTSComponents/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/ArkTSComponents/entry/src/main/ets/entryability/EntryAbility.ts index 4005db22c9ef68f99b182220cb1c8b657a4c40d0..ddd8c52adcb1bea64c03b1ca5c2ebc90ed7e2df7 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/ArkTSComponents/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,7 +14,7 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability'; +import Ability from '@ohos.app.ability.UIAbility'; import Window from '@ohos.window'; /** diff --git a/ETSUI/ArkTSComponents/entry/src/main/ets/pages/LoginPage.ets b/ETSUI/ArkTSComponents/entry/src/main/ets/pages/LoginPage.ets index 3d0dca89d9972e75365ceb66fd0f356d44084237..b1eca42b47ace9e02ca6a05d469c25030b05d4f4 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/ets/pages/LoginPage.ets +++ b/ETSUI/ArkTSComponents/entry/src/main/ets/pages/LoginPage.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import prompt from '@ohos.promptAction'; import router from '@ohos.router'; import CommonConstants from '../common/constants/CommonConstants'; @@ -70,7 +70,7 @@ struct LoginPage { this.timeOutId = setTimeout(() => { this.isShowProgress = false; this.timeOutId = null; - router.replace({ url: 'pages/MainPage' }); + router.replaceUrl({ url: 'pages/MainPage' }); }, CommonConstants.LOGIN_DELAY_TIME); } } @@ -82,90 +82,88 @@ struct LoginPage { } build() { - Scroll() { - Column() { - Image($r('app.media.logo')) - .width($r('app.float.logo_image_size')) - .height($r('app.float.logo_image_size')) - .margin({ top: $r('app.float.logo_margin_top'), bottom: $r('app.float.logo_margin_bottom') }) - Text($r('app.string.login_page')) - .fontSize($r('app.float.page_title_text_size')) - .fontWeight(FontWeight.Medium) - .fontColor($r('app.color.title_text_color')) - Text($r('app.string.login_more')) - .fontSize($r('app.float.normal_text_size')) - .fontColor($r('app.color.login_more_text_color')) - .margin({ bottom: $r('app.float.login_more_margin_bottom'), top: $r('app.float.login_more_margin_top') }) + Column() { + Image($r('app.media.logo')) + .width($r('app.float.logo_image_size')) + .height($r('app.float.logo_image_size')) + .margin({ top: $r('app.float.logo_margin_top'), bottom: $r('app.float.logo_margin_bottom') }) + Text($r('app.string.login_page')) + .fontSize($r('app.float.page_title_text_size')) + .fontWeight(FontWeight.Medium) + .fontColor($r('app.color.title_text_color')) + Text($r('app.string.login_more')) + .fontSize($r('app.float.normal_text_size')) + .fontColor($r('app.color.login_more_text_color')) + .margin({ bottom: $r('app.float.login_more_margin_bottom'), top: $r('app.float.login_more_margin_top') }) - TextInput({ placeholder: $r('app.string.account') }) - .maxLength(CommonConstants.INPUT_ACCOUNT_LENGTH) - .type(InputType.Number) - .inputStyle() - .onChange((value: string) => { - this.account = value; - }) - Line().lineStyle() + TextInput({ placeholder: $r('app.string.account') }) + .maxLength(CommonConstants.INPUT_ACCOUNT_LENGTH) + .type(InputType.Number) + .inputStyle() + .onChange((value: string) => { + this.account = value; + }) + Line().lineStyle() - TextInput({ placeholder: $r('app.string.password') }) - .maxLength(CommonConstants.INPUT_PASSWORD_LENGTH) - .type(InputType.Password) - .inputStyle() - .onChange((value: string) => { - this.password = value; - }) - Line().lineStyle() + TextInput({ placeholder: $r('app.string.password') }) + .maxLength(CommonConstants.INPUT_PASSWORD_LENGTH) + .type(InputType.Password) + .inputStyle() + .onChange((value: string) => { + this.password = value; + }) + Line().lineStyle() - Row() { - Text($r('app.string.message_login')).blueTextStyle() - Text($r('app.string.forgot_password')).blueTextStyle() - } - .justifyContent(FlexAlign.SpaceBetween) - .width(CommonConstants.FULL_PARENT) - .margin({ top: $r('app.float.forgot_margin_top') }) + Row() { + Text($r('app.string.message_login')).blueTextStyle() + Text($r('app.string.forgot_password')).blueTextStyle() + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_PARENT) + .margin({ top: $r('app.float.forgot_margin_top') }) - Button($r('app.string.login'), { type: ButtonType.Capsule }) - .width(CommonConstants.BUTTON_WIDTH) - .height($r('app.float.login_button_height')) - .fontSize($r('app.float.normal_text_size')) - .fontWeight(FontWeight.Medium) - .backgroundColor($r('app.color.login_button_color')) - .margin({ top: $r('app.float.login_button_margin_top'), bottom: $r('app.float.login_button_margin_bottom') }) - .onClick(() => { - this.login(); - }) - Text($r('app.string.register_account')) - .fontColor($r('app.color.login_blue_text_color')) - .fontSize($r('app.float.normal_text_size')) - .fontWeight(FontWeight.Medium) + Button($r('app.string.login'), { type: ButtonType.Capsule }) + .width(CommonConstants.BUTTON_WIDTH) + .height($r('app.float.login_button_height')) + .fontSize($r('app.float.normal_text_size')) + .fontWeight(FontWeight.Medium) + .backgroundColor($r('app.color.login_button_color')) + .margin({ top: $r('app.float.login_button_margin_top'), bottom: $r('app.float.login_button_margin_bottom') }) + .onClick(() => { + this.login(); + }) + Text($r('app.string.register_account')) + .fontColor($r('app.color.login_blue_text_color')) + .fontSize($r('app.float.normal_text_size')) + .fontWeight(FontWeight.Medium) - if (this.isShowProgress) { - LoadingProgress() - .color($r('app.color.loading_color')) - .width($r('app.float.login_progress_size')) - .height($r('app.float.login_progress_size')) - .margin({ top: $r('app.float.login_progress_margin_top') }) - } + if (this.isShowProgress) { + LoadingProgress() + .color($r('app.color.loading_color')) + .width($r('app.float.login_progress_size')) + .height($r('app.float.login_progress_size')) + .margin({ top: $r('app.float.login_progress_margin_top') }) + } - Blank() - Text($r('app.string.other_login_method')) - .fontColor($r('app.color.other_login_text_color')) - .fontSize($r('app.float.little_text_size')) - .fontWeight(FontWeight.Medium) - .margin({ top: $r('app.float.other_login_margin_top'), bottom: $r('app.float.other_login_margin_bottom') }) - Row({ space: CommonConstants.LOGIN_METHODS_SPACE }) { - this.imageButton($r('app.media.login_method1')) - this.imageButton($r('app.media.login_method2')) - this.imageButton($r('app.media.login_method3')) - } + Blank() + Text($r('app.string.other_login_method')) + .fontColor($r('app.color.other_login_text_color')) + .fontSize($r('app.float.little_text_size')) + .fontWeight(FontWeight.Medium) + .margin({ top: $r('app.float.other_login_margin_top'), bottom: $r('app.float.other_login_margin_bottom') }) + Row({ space: CommonConstants.LOGIN_METHODS_SPACE }) { + this.imageButton($r('app.media.login_method1')) + this.imageButton($r('app.media.login_method2')) + this.imageButton($r('app.media.login_method3')) } - .width(CommonConstants.FULL_PARENT) - .padding({ - left: $r('app.float.page_padding_hor'), - right: $r('app.float.page_padding_hor'), - bottom: $r('app.float.login_page_padding_bottom') - }) } - .height(CommonConstants.FULL_PARENT) .backgroundColor($r('app.color.background')) + .height(CommonConstants.FULL_PARENT) + .width(CommonConstants.FULL_PARENT) + .padding({ + left: $r('app.float.page_padding_hor'), + right: $r('app.float.page_padding_hor'), + bottom: $r('app.float.login_page_padding_bottom') + }) } } \ No newline at end of file diff --git a/ETSUI/ArkTSComponents/entry/src/main/ets/pages/MainPage.ets b/ETSUI/ArkTSComponents/entry/src/main/ets/pages/MainPage.ets index ca8fc6099ca360a32eddcdf172d37ebeff44cdc6..1f46208726a9e6488b63fba7cffa849b957ef556 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/ets/pages/MainPage.ets +++ b/ETSUI/ArkTSComponents/entry/src/main/ets/pages/MainPage.ets @@ -23,29 +23,29 @@ import Setting from "../view/Setting" @Entry @Component struct MainPage { - @State index: number = CommonConstants.HOME_TAB_INDEX; + @State currentIndex: number = CommonConstants.HOME_TAB_INDEX; private tabsController: TabsController = new TabsController(); - @Builder baseTab(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) { + @Builder TabBuilder(title: string, index: number, selectedImg: Resource, normalImg: Resource) { Column() { - Image(this.index === targetIndex ? selectedImg : normalImg) + Image(this.currentIndex === index ? selectedImg : normalImg) .width($r('app.float.mainPage_baseTab_size')) .height($r('app.float.mainPage_baseTab_size')) Text(title) .margin({ top: $r('app.float.mainPage_baseTab_top') }) .fontSize($r('app.float.main_tab_fontSize')) - .fontColor(this.index === targetIndex ? $r('app.color.mainPage_selected') : $r('app.color.mainPage_normal')) + .fontColor(this.currentIndex === index ? $r('app.color.mainPage_selected') : $r('app.color.mainPage_normal')) } - .margin({ top: $r('app.float.mainPage_baseTab_margin') }) + .justifyContent(FlexAlign.Center) .height($r('app.float.mainPage_barHeight')) .width(CommonConstants.FULL_PARENT) .onClick(() => { - this.index = targetIndex; - this.tabsController.changeIndex(this.index); + this.currentIndex = index; + this.tabsController.changeIndex(this.currentIndex); }) } - @Builder tabTitles(title: Resource) { + @Builder TabTitles(title: Resource) { Text(title) .fontWeight(FontWeight.Medium) .fontSize($r('app.float.page_title_text_size')) @@ -59,21 +59,21 @@ struct MainPage { controller: this.tabsController }) { TabContent() { - this.tabTitles($r('app.string.mainPage_tabTitles_home')) + this.TabTitles($r('app.string.mainPage_tabTitles_home')) Home() } .padding({ left: $r('app.float.mainPage_padding'), right: $r('app.float.mainPage_padding') }) .backgroundColor($r('app.color.mainPage_backgroundColor')) - .tabBar(this.baseTab(CommonConstants.HOME_TITLE, CommonConstants.HOME_TAB_INDEX, + .tabBar(this.TabBuilder(CommonConstants.HOME_TITLE, CommonConstants.HOME_TAB_INDEX, $r('app.media.home_selected'), $r('app.media.home_normal'))) TabContent() { - this.tabTitles($r('app.string.mainPage_tabTitles_mine')) + this.TabTitles($r('app.string.mainPage_tabTitles_mine')) Setting() } .padding({ left: $r('app.float.mainPage_padding'), right: $r('app.float.mainPage_padding') }) .backgroundColor($r('app.color.mainPage_backgroundColor')) - .tabBar(this.baseTab(CommonConstants.MINE_TITLE, CommonConstants.MINE_TAB_INDEX, + .tabBar(this.TabBuilder(CommonConstants.MINE_TITLE, CommonConstants.MINE_TAB_INDEX, $r('app.media.mine_selected'), $r('app.media.mine_normal'))) } .width(CommonConstants.FULL_PARENT) @@ -81,7 +81,7 @@ struct MainPage { .barHeight($r('app.float.mainPage_barHeight')) .barMode(BarMode.Fixed) .onChange((index: number) => { - this.index = index; + this.currentIndex = index; }) } } \ No newline at end of file diff --git a/ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets b/ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets index dafdb609590aff75ad613cb721ad608d7db08cea..04c04b266eea6580569d6a29afca0e89e9025ddb 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets +++ b/ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets @@ -47,7 +47,7 @@ export default struct Home { .margin({ top: $r('app.float.home_homeCell_margin') }) } } - }, item => item.toString()) + }, item => JSON.stringify(item)) } .columnsTemplate('1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr') @@ -85,7 +85,7 @@ export default struct Home { .backgroundImageSize(ImageSize.Cover) .width(CommonConstants.FULL_PARENT) .height(CommonConstants.FULL_PARENT) - }, secondItem => secondItem.toString()) + }, secondItem => JSON.stringify(secondItem)) } .width(CommonConstants.FULL_PARENT) .height($r('app.float.home_secondGrid_height')) @@ -96,6 +96,6 @@ export default struct Home { .margin({ bottom: $r('app.float.setting_button_bottom')}) } } - .scrollBar(BarState.Off) + .height(CommonConstants.FULL_PARENT) } } diff --git a/ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets b/ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets index 685bdabe6c2684b3295243a0a26ffbd4a390703b..a73de50ef846809f3cfe7330d7c8c77cc5e283cb 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets +++ b/ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets @@ -79,7 +79,7 @@ export default struct Setting { this.settingCell(item) } .height($r('app.float.setting_list_height')) - }, item => item.toString()) + }, item => JSON.stringify(item)) } .backgroundColor(Color.White) .divider({ @@ -101,10 +101,8 @@ export default struct Setting { .fontWeight(FontWeight.Medium) .backgroundColor($r('app.color.setting_button_backgroundColor')) .margin({ bottom: $r('app.float.setting_button_bottom')}) - - } - .height('100%') + .height(CommonConstants.FULL_PARENT) } } } diff --git a/ETSUI/ArkTSComponents/entry/src/main/module.json5 b/ETSUI/ArkTSComponents/entry/src/main/module.json5 index f46661ad5b118dce1d8f617d4af33deda94f0eef..19ebb5ffd7f7c6a9cab2d19d610c47fcbfa36ce7 100644 --- a/ETSUI/ArkTSComponents/entry/src/main/module.json5 +++ b/ETSUI/ArkTSComponents/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "entryAbility", diff --git a/ETSUI/ArkTSComponents/package.json b/ETSUI/ArkTSComponents/package.json index 296f5c2810a43e78b7f9121e9ea72f79cbb5f453..ada4099697d476a5e88b1e79de6de92d1c9b0226 100644 --- a/ETSUI/ArkTSComponents/package.json +++ b/ETSUI/ArkTSComponents/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "arktscomponents", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "arktscomponents", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/common/constants/CommonConstants.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/common/constants/CommonConstants.ets index 0adb10e14960b4b9486add422c876cce90f8487c..727c46523d74dfa9dfc8c624ea3da94c4e5f7ab5 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/common/constants/CommonConstants.ets @@ -27,6 +27,16 @@ export default class CommonConstants { */ static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage'; + /** + * The advertsing page tag. + */ + static readonly ADVERTISING_PAGE_TAG: string = 'AdvertisingPage'; + + /** + * The custom dialog component tag. + */ + static readonly CUSTOM_DIALOG_TAG: string = 'CustomDialogComponent'; + /** * Preference saved key. */ @@ -92,16 +102,6 @@ export default class CommonConstants { */ static readonly ADVERTISING_TITLE_TEXT_LETTER_SPACING: number = 0.05; - /** - * Count down text top margin. - */ - static readonly ADVERTISING_TITLE_TEXT_MARGIN_TOP: string = '3.2%'; - - /** - * Count down text left margin. - */ - static readonly ADVERTISING_TITLE_TEXT_MARGIN_LEFT: string = '72.2%'; - /** * Advertising page healthy text spacing. */ diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets index e6d248756dd0a48ae9c706d325d98f0ec5ef8adc..47249aa86cf57538b6a8f4fb8f9aca75a00ebdd5 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,21 +13,19 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability'; -import Want from '@ohos.application.Want'; -import window from '@ohos.window'; +import UIAbility from '@ohos.app.ability.UIAbility'; import Logger from '../common/utils/Logger'; import CommonConstants from '../common/constants/CommonConstants'; /** * Lift cycle management of Ability. */ -export default class EntryAbility extends Ability { - onCreate(want: Want) { +export default class EntryAbility extends UIAbility { + onCreate(want) { globalThis.abilityWant = want; } - onWindowStageCreate(windowStage: window.WindowStage) { + onWindowStageCreate(windowStage) { Logger.info(CommonConstants.ENTRY_ABILITY_TAG, 'onWindowStageCreate'); windowStage.loadContent('pages/LauncherPage', (err, data) => { if (err.code) { diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets index 5d6d2df74db4841d2ea6e710948ce9fda61a8bea..ecf0b6e691c06915b1cc3ddc85dca2aa05f4254a 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets @@ -13,7 +13,8 @@ * limitations under the License. */ -import Router from '@ohos.router'; +import router from '@ohos.router'; +import Logger from '../common/utils/Logger'; import CommonConstants from '../common/constants/CommonConstants'; /** @@ -36,7 +37,7 @@ struct AdvertisingPage { } onPageHide() { - Router.clear(); + router.clear(); clearInterval(this.timeId); } @@ -44,8 +45,10 @@ struct AdvertisingPage { * Jump to app home page. */ jumpToAppHomePage() { - Router.push({ + router.pushUrl({ url: CommonConstants.APP_HOME_PAGE_URL + }).catch((error) => { + Logger.error(CommonConstants.ADVERTISING_PAGE_TAG, 'AdvertisingPage pushUrl error ' + JSON.stringify(error)); }); } @@ -65,8 +68,8 @@ struct AdvertisingPage { color: Color.White }) .margin({ - top: CommonConstants.ADVERTISING_TITLE_TEXT_MARGIN_TOP, - left: CommonConstants.ADVERTISING_TITLE_TEXT_MARGIN_LEFT + top: $r('app.float.advertising_title_text_margin_top'), + left: $r('app.float.advertising_title_text_margin_left') }) .padding({ left: $r('app.float.advertising_text_padding_left'), @@ -85,14 +88,14 @@ struct AdvertisingPage { Column() { Text($r('app.string.healthy_life_text')) .bottomTextStyle(FontWeight.Bolder, - CommonConstants.ADVERTISING_HEALTHY_LIFE_TEXT_SPACING, - $r('app.float.advertising_text_title_size'), - $r('app.color.advertising_text_title_color')) + CommonConstants.ADVERTISING_HEALTHY_LIFE_TEXT_SPACING, + $r('app.float.advertising_text_title_size'), + $r('app.color.advertising_text_title_color')) Text($r('app.string.healthy_life_introduce')) .bottomTextStyle(FontWeight.Normal, - CommonConstants.ADVERTISING_TEXT_INTRODUCE_LETTER_SPACING, - $r('app.float.advertising_text_introduce_size'), - $r('app.color.launcher_text_introduce_color')) + CommonConstants.ADVERTISING_TEXT_INTRODUCE_LETTER_SPACING, + $r('app.float.advertising_text_introduce_size'), + $r('app.color.launcher_text_introduce_color')) .opacity($r('app.float.advertising_text_opacity')) .margin({ top: CommonConstants.ADVERTISING_TEXT_INTRODUCE_MARGIN_TOP }) } diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets index 8682ae84933f70d682c1580a7004469b1e21596e..13a1a05b848266b7dd4ae09135b1637dd60277b8 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets @@ -13,9 +13,9 @@ * limitations under the License. */ -import AppContext from '@ohos.application.context'; -import DataPreferences from '@ohos.data.preferences'; -import Router from '@ohos.router'; +import common from '@ohos.app.ability.common'; +import preferences from '@ohos.data.preferences'; +import router from '@ohos.router'; import Logger from '../common/utils/Logger'; import CommonConstants from '../common/constants/CommonConstants'; import CustomDialogComponent from '../view/CustomDialogComponent'; @@ -28,7 +28,7 @@ import CustomDialogComponent from '../view/CustomDialogComponent'; @Entry @Component struct LauncherPage { - private context: AppContext.AbilityContext; + private context: common.UIAbilityContext; private timerId: number = 0; private jumpToAdvertisingFlag: boolean = false; dialogController: CustomDialogController = new CustomDialogController({ @@ -56,7 +56,7 @@ struct LauncherPage { onPageHide() { if (this.jumpToAdvertisingFlag) { - Router.clear(); + router.clear(); } clearTimeout(this.timerId); } @@ -67,13 +67,17 @@ struct LauncherPage { jumpToAdvertisingPage() { this.timerId = setTimeout(() => { this.jumpToAdvertisingFlag = true; - Router.push({ url: CommonConstants.ADVERTISING_PAGE_URL }); + router.pushUrl({ + url: CommonConstants.ADVERTISING_PAGE_URL + }).catch((error) => { + Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(error)); + }); }, CommonConstants.LAUNCHER_DELAY_TIME); } saveIsPrivacy() { - let preferences: Promise = this.getDataPreferences(); - preferences.then((result: DataPreferences.Preferences) => { + let preferences: Promise = this.getDataPreferences(); + preferences.then((result: preferences.Preferences) => { let privacyPut = result.put(CommonConstants.PREFERENCES_KEY_PRIVACY, false); result.flush(); privacyPut.then(() => { @@ -86,11 +90,11 @@ struct LauncherPage { }); } - aboutToAppear() { - this.context = getContext(this) as AppContext.AbilityContext; + onPageShow() { + this.context = getContext(this) as common.UIAbilityContext; // Get the operation class for saving data. - this.getDataPreferences().then((preferences: DataPreferences.Preferences) => { - preferences.get(CommonConstants.PREFERENCES_KEY_PRIVACY, true).then((value: DataPreferences.ValueType) => { + this.getDataPreferences().then((preferences: preferences.Preferences) => { + preferences.get(CommonConstants.PREFERENCES_KEY_PRIVACY, true).then((value: preferences.ValueType) => { Logger.info(CommonConstants.LAUNCHER_PAGE_TAG, 'AboutToAppear value: ' + value); if (value) { this.dialogController.open(); @@ -105,7 +109,7 @@ struct LauncherPage { * Get data preferences action. */ getDataPreferences() { - return DataPreferences.getPreferences(this.context, CommonConstants.PREFERENCES_FILE_NAME); + return preferences.getPreferences(this.context, CommonConstants.PREFERENCES_FILE_NAME); } build() { diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/PrivacyPage.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/PrivacyPage.ets index 727466305e49ef41e6aa660f3ef6f6cb7562255a..ec0af82c8efe5f0781dcd2443db9fa608a7e853a 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/pages/PrivacyPage.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/pages/PrivacyPage.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import Router from '@ohos.router'; +import router from '@ohos.router'; import CommonConstants from '../common/constants/CommonConstants'; /** @@ -43,7 +43,7 @@ struct PrivacyPage { .textAlign(TextAlign.Center) .fontWeight(FontWeight.Medium) .onClick(() => { - Router.back(); + router.back(); }) .margin({ top: $r('app.float.privacy_bottom_text_margin') }) } diff --git a/ETSUI/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets b/ETSUI/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets index aa59005cc9db839e14457f55e012cf6db0795bdf..6b1e98d995b38c6f924505cf41cd4f908fd95c87 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets +++ b/ETSUI/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets @@ -13,13 +13,13 @@ * limitations under the License. */ -import Router from '@ohos.router'; +import router from '@ohos.router'; +import Logger from '../common/utils/Logger'; import CommonConstants from '../common/constants/CommonConstants'; /** * Custom pop-up window. */ - @CustomDialog export default struct CustomDialogComponent { controller: CustomDialogController; @@ -46,7 +46,12 @@ export default struct CustomDialogComponent { .fontColor($r('app.color.dialog_text_statement_color')) .fontSize($r('app.float.dialog_common_text_size')) .onClick(() => { - Router.push({ url: CommonConstants.PRIVACY_PAGE_URL }); + this.controller.close(); + router.pushUrl({ + url: CommonConstants.PRIVACY_PAGE_URL + }).catch((error) => { + Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error)); + }); }) Text($r('app.string.dialog_text_declaration_prompt')) .width(CommonConstants.DIALOG_COMPONENT_WIDTH_PERCENT) diff --git a/ETSUI/FirstStartDemo/entry/src/main/module.json5 b/ETSUI/FirstStartDemo/entry/src/main/module.json5 index 3c4977b4a20d79de30cd59b217a6ee3788d54ff4..83d91658bcf3ac6fec9dcd2a22a0ee3d6e40d131 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/module.json5 +++ b/ETSUI/FirstStartDemo/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/FirstStartDemo/entry/src/main/resources/base/element/float.json b/ETSUI/FirstStartDemo/entry/src/main/resources/base/element/float.json index acd29cc1424ecabd1f29741e83391dd5cd931214..7ffebdcee4b5e9cb5a05bfd382ed1917123e213b 100644 --- a/ETSUI/FirstStartDemo/entry/src/main/resources/base/element/float.json +++ b/ETSUI/FirstStartDemo/entry/src/main/resources/base/element/float.json @@ -52,6 +52,14 @@ "name": "advertising_text_border_width", "value": "1" }, + { + "name": "advertising_title_text_margin_top", + "value": "30vp" + }, + { + "name": "advertising_title_text_margin_left", + "value": "260vp" + }, { "name": "advertising_text_padding_top", "value": "8vp" diff --git a/ETSUI/FirstStartDemo/package.json b/ETSUI/FirstStartDemo/package.json index 7969f50213090728d39e29fa4a97809c35f65a20..f20e5671026bc187497aed5d768786c96df88fa1 100644 --- a/ETSUI/FirstStartDemo/package.json +++ b/ETSUI/FirstStartDemo/package.json @@ -12,7 +12,7 @@ "version": "1.0.0", "dependencies": { "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" } } diff --git a/ETSUI/Healthy_life/LICENSE b/ETSUI/Healthy_life/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..381eb507bc1eef9b5158e496dedab769e810b657 --- /dev/null +++ b/ETSUI/Healthy_life/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. + + 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/ets/common/constants/CommonConstants.ets b/ETSUI/Healthy_life/entry/src/main/ets/common/constants/CommonConstants.ets index 786f295923519bb362f47814b4c9da85e2fd4c92..ba49ce6d423717f38591dceea0dbacf919df97d8 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/common/constants/CommonConstants.ets @@ -49,6 +49,7 @@ export const THOUSANDTH_33: string = '3.3%'; // ‘3.3%’ export const THOUSANDTH_50: string = '5%'; // ‘5%’ export const THOUSANDTH_66: string = '6.6%'; // ‘6.6%’ export const THOUSANDTH_80: string = '8%'; // ‘8%’ +export const THOUSANDTH_100: string = '10%'; // ‘10%’ export const THOUSANDTH_120: string = '12%'; // ‘12%’ export const THOUSANDTH_160: string = '16%'; // ‘16%’ export const THOUSANDTH_400: string = '40%'; // ‘40%’ diff --git a/ETSUI/Healthy_life/entry/src/main/ets/common/database/Rdb.ets b/ETSUI/Healthy_life/entry/src/main/ets/common/database/Rdb.ets index fb103b4dda8f784f4a5971a6b21325d49079c5b1..7f15c4572381cd0994d8ad8acd20e2cd6f130dd3 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/common/database/Rdb.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/common/database/Rdb.ets @@ -17,10 +17,6 @@ import data_rdb from '@ohos.data.rdb'; import { STORE_CONFIG } from '../constants/CommonConstants'; import { Logger } from '../../common/utils/log/Logger'; -import context from '@ohos.application.context'; - -type Context = context.Context; - export default class Rdb { private rdbStore: any = null; private tableName: string; @@ -44,8 +40,7 @@ export default class Rdb { callback(); return; } - var context: Context = getContext(this) as Context; - // let context = globalThis.st-----ageContext; + let context = getContext(this); data_rdb.getRdbStore(context, STORE_CONFIG, 1, (err, rdb) => { if (err) { Logger.error('Rdb', 'gerRdbStore() failed, err: ' + err); diff --git a/ETSUI/Healthy_life/entry/src/main/ets/common/reminderagent/ReminderAgent.ets b/ETSUI/Healthy_life/entry/src/main/ets/common/reminderagent/ReminderAgent.ets deleted file mode 100644 index d5dfaa217dba2c375e1efa849ad545a7c985132d..0000000000000000000000000000000000000000 --- a/ETSUI/Healthy_life/entry/src/main/ets/common/reminderagent/ReminderAgent.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License,Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import reminderAgent from '@ohos.reminderAgent' -import notification from '@ohos.notification' -import { Logger } from '../utils/log/Logger' - -// publishReminder -function publishReminder(params) { - if(!params) return; - let timer = fetchData(params); - reminderAgent.publishReminder(timer).then((reminderId) => { - Logger.info("reminderAgent", `promise, reminderId: ${reminderId}`); - }).catch((err) => { - Logger.error("reminderAgent", `publishReminder err: ${err}`); - }) -} - -// cancelReminder -function cancelReminder(reminderId) { - if(!reminderId) return; - reminderAgent.cancelReminder(reminderId).then((data) => { - Logger.info("reminderAgent", `cancelReminder promise: ${data}`); - }).catch((err) => { - Logger.error("reminderAgent", `cancelReminder err: ${err}`); - }) -} - -// fetchData -function fetchData(params): reminderAgent.ReminderRequestAlarm { - return { - reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM, - hour: params.hour || 0, - minute: params.minute || 0, - daysOfWeek: params.daysOfWeek || [], - wantAgent: { - pkgName: "com.example.exercisehealth", - abilityName: "MainAbility" - }, - title: params.title || '', - content: params.content || '', - notificationId: params.notificationId || -1, - slotType: notification.SlotType.SOCIAL_COMMUNICATION - } -} - -// hasNotificationId -async function hasNotificationId(params: number) { - if(!params) return; - await reminderAgent.getValidReminders().then((reminders) => { - if (!reminders.length) { - return false; - } - let notificationIdList = []; - for (let i = 0; i < reminders.length; i++) { - notificationIdList.push(reminders[i].notificationId) - } - const flag = notificationIdList.indexOf(params); - - return flag === -1 ? false : true; - }) -} - -const reminder = { - publishReminder, - cancelReminder, - hasNotificationId -} - -export default reminder \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/Healthy_life/entry/src/main/ets/entryability/EntryAbility.ts index 0f1270a5b7f9537020615936a221d296403f13d5..800c91f989ad68830f451221e725b849147c33d3 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/Healthy_life/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,59 +1,62 @@ -import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' -import Window from '@ohos.window' +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; + +export default class MainAbility extends UIAbility { + private static TAG: string = 'MainAbility'; -export default class EntryAbility extends Ability { onCreate(want, launchParam) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + console.debug(MainAbility.TAG, 'onCreate'); globalThis.abilityWant = want; - globalThis.abilityContext = this.context; } onDestroy() { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + console.debug(MainAbility.TAG, 'onDestroy'); } - onWindowStageCreate(windowStage: Window.WindowStage) { + onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/SplashPage', (err, data) => { + console.debug(MainAbility.TAG, 'onWindowStageCreate'); + windowStage.loadContent("pages/SplashPage", (err, data) => { if (err.code) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + console.error('windowStage', 'Failed to load the content. Cause:' + JSON.stringify(err)); return; } - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + console.info('windowStage', 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); }); } onWindowStageDestroy() { // Main window is destroyed, release UI related resources - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + console.debug(MainAbility.TAG, 'onWindowStageDestroy'); } onForeground() { // Ability has brought to foreground - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + console.debug(MainAbility.TAG, 'onForeground'); } onBackground() { // Ability has back to background - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + console.debug(MainAbility.TAG, 'onBackground'); } onNewWant(want, launchParam) { // Ability has new want - console.debug('testTag', `onNewWant ${JSON.stringify(want)}`); + console.debug(MainAbility.TAG, `onNewWant ${JSON.stringify(want)}`); globalThis.abilityWant = want; } -} +}; diff --git a/ETSUI/Healthy_life/entry/src/main/ets/model/TaskInitList.ets b/ETSUI/Healthy_life/entry/src/main/ets/model/TaskInitList.ets index c4d01f54b44a7ef373dac10b50f6f8d1c7e2594a..99e222bab29faa7930da6305890bd1236bf44aa3 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/model/TaskInitList.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/model/TaskInitList.ets @@ -157,7 +157,7 @@ export const TaskMapById: TaskInitListType = { taskName: $r('app.string.task_water'), icon: $r('app.media.water'), dialogBg: $rawfile('dialog/drink.png'), - targetValue: '1', + targetValue: '0.25', isOpen: false, unit: 'L', step: 0, diff --git a/ETSUI/Healthy_life/entry/src/main/ets/pages/AdvertisingPage.ets b/ETSUI/Healthy_life/entry/src/main/ets/pages/AdvertisingPage.ets index 3f22298262011ab7d929f6a5b33cfb4181a7b9c9..3775ad80ba3cb470f588c9a6e9ea1f016d4fda26 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/pages/AdvertisingPage.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/pages/AdvertisingPage.ets @@ -33,7 +33,7 @@ struct AdvertisingPage { goToHomePage() { clearInterval(this.intervalId); - router.replace({ url: 'pages/MainPage' }); + router.replaceUrl({ url: 'pages/MainPage' }); } aboutToAppear() { @@ -57,7 +57,7 @@ struct AdvertisingPage { .height($r('app.float.default_36')) .backgroundColor('rgba(0,0,0,0.20)') .border({ color: $r('app.color.white'), width: $r('app.float.default_1') }) - .margin({ top: $r('app.float.default_56') }) + .margin({ top: $r('app.float.default_36') }) .padding($r('app.float.default_8')) .onClick(() => this.goToHomePage()) } diff --git a/ETSUI/Healthy_life/entry/src/main/ets/pages/MainPage.ets b/ETSUI/Healthy_life/entry/src/main/ets/pages/MainPage.ets index 624e0acbbb56a3e6cdb8531be73f0282e778324e..5141b64918345cdf9c9e7de1a8acca4810f3f5c7 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/pages/MainPage.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/pages/MainPage.ets @@ -38,7 +38,7 @@ struct Index { onPageShow() { Logger.info('onPageShow', JSON.stringify(router.getParams())); this.editedTaskInfo = JSON.parse(router.getParams() ? router.getParams()['editTask'] : '{}'); - this.editedTaskID = `${this.editedTaskInfo.taskID}_${this.editedTaskInfo.isOpen}`; + this.editedTaskID = `${this.editedTaskInfo.taskID}_${this.editedTaskInfo.isOpen}` + new Date().getTime(); } @Builder TabBuilder(index: number) { diff --git a/ETSUI/Healthy_life/entry/src/main/ets/pages/SplashPage.ets b/ETSUI/Healthy_life/entry/src/main/ets/pages/SplashPage.ets index a4bba07ec9deb14445197d584a7c3db71f2e1075..194032ec6b707d5cf699cb10bde0270f53effa5c 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/pages/SplashPage.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/pages/SplashPage.ets @@ -1,4 +1,4 @@ -import { Logger } from '../common/utils/log/Logger'; + /* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License,Version 2.0 (the "License"); @@ -14,8 +14,10 @@ import { Logger } from '../common/utils/log/Logger'; * limitations under the License. */ +import common from '@ohos.app.ability.common'; import router from '@ohos.router'; import data_preferences from '@ohos.data.preferences'; +import { Logger } from '../common/utils/log/Logger'; import * as commonConst from '../common/constants/CommonConstants'; import UserPrivacyDialog from '../view/dialog/UserPrivacyDialog'; @@ -26,10 +28,11 @@ const IS_PRIVACY: string = 'isPrivacy'; @Entry @Component struct SplashIndex { + context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; dialogController: CustomDialogController = new CustomDialogController({ builder: UserPrivacyDialog( { - cancel: this.exitApp, + cancel: this.exitApp.bind(this), confirm: this.onConfirm.bind(this) }), cancel: this.exitApp, @@ -39,7 +42,7 @@ struct SplashIndex { }); onConfirm() { - let preferences = data_preferences.getPreferences(globalThis.abilityContext, H_STORE); + let preferences = data_preferences.getPreferences(this.context, H_STORE); preferences.then((res) => { res.put(IS_PRIVACY, true).then(() => { res.flush(); @@ -52,17 +55,17 @@ struct SplashIndex { } exitApp() { - globalThis.abilityContext.terminateSelf(); + this.context.terminateSelf(); } jumpAdPage() { setTimeout(() => { - router.replace({ url: 'pages/AdvertisingPage' }); + router.replaceUrl({ url: 'pages/AdvertisingPage' }); }, commonConst.LAUNCHER_DELAY_TIME); } aboutToAppear() { - let preferences = data_preferences.getPreferences(globalThis.abilityContext, H_STORE); + let preferences = data_preferences.getPreferences(this.context, H_STORE); preferences.then((res) => { res.get(IS_PRIVACY, false).then((isPrivate) => { if (isPrivate === true) { @@ -83,7 +86,7 @@ struct SplashIndex { Image($r('app.media.logo')) .width($r('app.float.default_120')) .aspectRatio(1) - .margin({ top: commonConst.THOUSANDTH_160 }); + .margin({ top: $r('app.float.default_120') }); Text($r('app.string.MainAbility_label')) .fontFamily($r('app.string.HarmonyHeiTi_Bold')) .fontSize($r('app.float.default_24')) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskEditPage.ets b/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskEditPage.ets index 769897a454b903aae4fa4d3c7565307eea0b44a8..4c6d39940677edcebf062ba543cbcd1d9cd53195 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskEditPage.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskEditPage.ets @@ -30,6 +30,7 @@ struct TaskEdit { } .size({ width: THOUSANDTH_1000, height: THOUSANDTH_1000 }) .title(EDIT_TASK_TITLE) + .titleMode(NavigationTitleMode.Mini) } .height(THOUSANDTH_1000) .backgroundColor($r('app.color.primaryBgColor')) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskListPage.ets b/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskListPage.ets index bb01f65968c64034088ad49e34498982d5d4d843..9606d7c2b88a6cb55a4a12669f3e4e10074eb30c 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskListPage.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/pages/TaskListPage.ets @@ -43,6 +43,7 @@ struct TaskIndex { } .size({ width: THOUSANDTH_1000, height: THOUSANDTH_1000 }) .title(ADD_TASK_TITLE) + .titleMode(NavigationTitleMode.Mini) } .backgroundColor($r('app.color.primaryBgColor')) .height(THOUSANDTH_1000) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/HomeComponent.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/HomeComponent.ets index 6d43809a32b6461a4539ae7f40756c5569f40ac8..e0a74f994004c730cf5e4fa5842622124d487960 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/HomeComponent.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/HomeComponent.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import common from '@ohos.app.ability.common'; import router from '@ohos.router'; import HealthText from './HealthTextComponent'; import AddBtn from '../view/home/AddBtnComponent'; @@ -20,6 +21,7 @@ import { TaskCard } from '../view/home//TaskCardComponent'; import HomeTopView from '../view/home/HomeTopComponent'; import { CustomDialogView, CustomDialogCallback } from '../view/dialog/CustomDialogView'; import TaskInfo from '../common/bean/TaskInfo'; +import { GlobalInfoTable } from '../common/database/tables/GlobalInfoTable'; import { HomeStore } from '../viewmodel/HomeViewModel'; import { ITaskItem, TaskMapById } from '../model/TaskInitList'; import { HealthDataSrcMgr } from '../common/utils/HealthDataSrcMgr'; @@ -54,20 +56,45 @@ export default struct HomeIndex { @Link editedTaskInfo: ITaskItem; @Link @Watch('taskChange') editedTaskID: string; private scroller: Scroller = new Scroller(); - - aboutToAppear() { - this.homeStore.initData(); + private globalTable = new GlobalInfoTable(); + + async aboutToAppear() { + this.globalTable.getRdbStore(() => { + this.globalTable.query((result) => { + let predate = new Date(result.lastDate); + let date = new Date(); + if (result.length !== 0 && date.getTime() < predate.getTime()) { + AlertDialog.show( + { + title: $r('app.string.alert'), + message: $r('app.string.alert_message'), + autoCancel: false, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + confirm: { + value: $r('app.string.alert_button'), + action: () => { + (getContext(this) as common.UIAbilityContext).terminateSelf() + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + } + }) + } else { + this.homeStore.initData(); + } + }); + }); + // this.homeStore.initData(); } taskChange() { this.homeStore.updateTaskInfoList(this.editedTaskInfo); } - aboutToDisappear() { - // cancel broadcast - this.broadCast.off(null, null); - } - taskItemAction(item: TaskInfo, isClick: boolean) { if (!this.homeStore.checkCurrentDay()) { return; @@ -86,7 +113,7 @@ export default struct HomeIndex { frequency: item.frequency, isOpen: item.isOpen, }; - router.push({ url: 'pages/TaskEditPage', params: { params: JSON.stringify(editTask) } }); + router.pushUrl({ url: 'pages/TaskEditPage', params: { params: JSON.stringify(editTask) } }); } } @@ -111,7 +138,7 @@ export default struct HomeIndex { editTaskAction() { if (this.homeStore.checkCurrentDay()) { - router.push({ url: 'pages/TaskListPage' }); + router.pushUrl({ url: 'pages/TaskListPage' }); } } @@ -130,7 +157,7 @@ export default struct HomeIndex { }) .margin({ bottom: commonConst.DEFAULT_12 }) .height($r('app.float.default_64')) - }, item => item.date + item.taskID) + }, item => JSON.stringify(item)) } .padding({ top: commonConst.THOUSANDTH_15, diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/CustomDialogView.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/CustomDialogView.ets index 8241c781e8d34d38a413848d79e1f3deac9c05b1..3d6ae0202ea59aa36f4ad2c6a564b4e908de1d64 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/CustomDialogView.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/CustomDialogView.ets @@ -15,12 +15,10 @@ import { AchievementDialog } from './AchievementDialog'; import { TaskDetailDialog } from './TaskDetailDialog'; -import { TargetSettingDialog, RemindTimeDialog, FrequencyDialog } from './TaskSettingDialog'; import { BroadCast, BroadCastType } from '../../common/utils/BroadCast'; import { TaskItem } from '../../model/TaskInitList'; import TaskInfo from '../../common/bean/TaskInfo'; import { Logger } from '../../common/utils/log/Logger'; -import { ZERO, MINUS_20 } from '../../common/constants/CommonConstants'; export interface CustomDialogCallback { confirmCallback: Function; @@ -41,27 +39,7 @@ export struct CustomDialogView { autoCancel: true, customStyle: true }); - // target setting dialog - targetSettingDialog = new CustomDialogController({ - builder: TargetSettingDialog(), - autoCancel: true, - alignment: DialogAlignment.Bottom, - offset: { dx: ZERO, dy: MINUS_20 } - }); - // remind time dialog - RemindTimeDialogController: CustomDialogController = new CustomDialogController({ - builder: RemindTimeDialog(), - autoCancel: true, - alignment: DialogAlignment.Bottom, - offset: { dx: ZERO, dy: MINUS_20 } - }); - // frequency dialog - FrequencyDialogController: CustomDialogController = new CustomDialogController({ - builder: FrequencyDialog(), - autoCancel: true, - alignment: DialogAlignment.Bottom, - offset: { dx: ZERO, dy: MINUS_20 } - }); + // task clock dialog taskDialog = new CustomDialogController({ builder: TaskDetailDialog(), @@ -78,23 +56,11 @@ export struct CustomDialogView { this.achievementDialog.open(); }) - // target setting dialog - this.broadCast.on(BroadCastType.SHOW_TARGET_SETTING_DIALOG, () => { - this.targetSettingDialog.open(); - }) - // remind time dialog - this.broadCast.on(BroadCastType.SHOW_REMIND_TIME_DIALOG, () => { - this.RemindTimeDialogController.open(); - }) - // frequency dialog - this.broadCast.on(BroadCastType.SHOW_FREQUENCY_DIALOG, () => { - this.FrequencyDialogController.open(); - }) // task clock dialog this.broadCast.on(BroadCastType.SHOW_TASK_DETAIL_DIALOG, (currentTask: TaskInfo, dialogCallBack: CustomDialogCallback) => { Logger.debug('CustomDialogView', 'SHOW_TASK_DETAIL_DIALOG'); - this.currentTask = currentTask; + this.currentTask = currentTask || TaskItem; this.dialogCallBack = dialogCallBack; this.taskDialog.open(); }) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDetailDialog.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDetailDialog.ets index 1ee10ddae694e5bd562cc52624cea74eea8054a7..36c80b61394e4589e29c15dcb6c1af1a26bbd853 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDetailDialog.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDetailDialog.ets @@ -54,7 +54,7 @@ export struct TaskDetailDialog { } .height($r('app.float.default_451')) .width($r('app.float.default_316')) - .backgroundImage(TaskMapById[this.currentTask.taskID].dialogBg, ImageRepeat.NoRepeat) + .backgroundImage(TaskMapById[this.currentTask?.taskID].dialogBg, ImageRepeat.NoRepeat) .backgroundImageSize({ width: '100%', height: '100%' @@ -78,6 +78,7 @@ struct TaskBaseInfo { .fontWeight(FontWeight.Bold) .fontFamily($r('app.string.HarmonyHeiTi_Bold')) .taskTextStyle() + .margin({left: $r('app.float.default_12')}) } .position({ y: $r('app.float.default_267') }) } diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDialogView.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDialogView.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bebd01ec36c25cc6999f4b8e6a34592781845ae --- /dev/null +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskDialogView.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TargetSettingDialog, RemindTimeDialog, FrequencyDialog } from './TaskSettingDialog'; +import { BroadCast, BroadCastType } from '../../common/utils/BroadCast'; +import { Logger } from '../../common/utils/log/Logger'; +import { ZERO, MINUS_20 } from '../../common/constants/CommonConstants'; + +export interface CustomDialogCallback { + confirmCallback: Function; + cancelCallback: Function; +} + +@Component +export struct TaskDialogView { + @State isShow: boolean = false; + @Consume broadCast: BroadCast; + + // target setting dialog + targetSettingDialog = new CustomDialogController({ + builder: TargetSettingDialog(), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: ZERO, dy: MINUS_20 } + }); + // remind time dialog + RemindTimeDialogController: CustomDialogController = new CustomDialogController({ + builder: RemindTimeDialog(), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: ZERO, dy: MINUS_20 } + }); + // frequency dialog + FrequencyDialogController: CustomDialogController = new CustomDialogController({ + builder: FrequencyDialog(), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: ZERO, dy: MINUS_20 } + }); + + aboutToAppear() { + Logger.debug('CustomDialogView', 'aboutToAppear'); + + // target setting dialog + this.broadCast.on(BroadCastType.SHOW_TARGET_SETTING_DIALOG, () => { + this.targetSettingDialog.open(); + }) + // remind time dialog + this.broadCast.on(BroadCastType.SHOW_REMIND_TIME_DIALOG, () => { + this.RemindTimeDialogController.open(); + }) + // frequency dialog + this.broadCast.on(BroadCastType.SHOW_FREQUENCY_DIALOG, () => { + this.FrequencyDialogController.open(); + }) + } + + aboutToDisappear() { + Logger.debug('CustomDialogView', 'aboutToDisappear'); + } + + build() { + } +} \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskSettingDialog.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskSettingDialog.ets index f35425b0bb8150e0b029a90e3fa7b87b2449a1ae..6ba3d6ae6bb7c0f2c18b882ee1080730ee9c1a9c 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskSettingDialog.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/dialog/TaskSettingDialog.ets @@ -27,7 +27,7 @@ export struct TargetSettingDialog { controller: CustomDialogController; drinkRange: string[] = createDrinkRange(); appleRange: string[] = createAppleRange(); - currentValue: string = '1'; + currentValue: string = this.settingParams.targetValue; currentTime: string = commonConst.DEFAULT_TIME; private tip: string = ''; diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/home/HomeTopComponent.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/home/HomeTopComponent.ets index e3cb826fac6a95c4a80022cfe9d91ce6fadef38d..3ce80e1fc4f2a27fea9ca43df9fab5906e82e962 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/home/HomeTopComponent.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/home/HomeTopComponent.ets @@ -51,7 +51,7 @@ export default struct HomeTopView { .width(commonConst.THOUSANDTH_1000) .padding({ left: $r('app.float.default_24') }) - WeekCalendar({ homeStore: this.homeStore }) + WeekCalendar({ homeStore: $homeStore }) } .height(commonConst.THOUSANDTH_500) .backgroundImagePosition({x: 0, y: 0}) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets index 7232bf2f05c1e8e2e224390f1f23558beebf02e8..d42cb6b4f9f00c112b4881fabf1810d366a1c871 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets @@ -24,7 +24,7 @@ export const WEEK_DAY_WIDTH: number = 100 / commonConst.WEEK_DAY_NUM; @Component export struct WeekCalendar { - @ObjectLink homeStore: HomeStore; + @Link homeStore: HomeStore; currentPage: number = 1; private scroller: Scroller = new Scroller(); private isLoadMore: boolean = false; @@ -64,6 +64,7 @@ export struct WeekCalendar { Row() { this.ArrowIcon(false) HealthText({ title: this.homeStore.dateTitle as string, fontSize: $r('app.float.default_14') }) + .margin($r('app.float.default_12')) this.ArrowIcon(true) } .justifyContent(FlexAlign.Center) @@ -79,6 +80,7 @@ export struct WeekCalendar { .fontFamily($r('app.string.HarmonyHeiTi_Medium')) .opacity(commonConst.OPACITY_6) Divider() + .margin({top: commonConst.DEFAULT_2, bottom: $r('app.float.default_4')}) .width($r('app.float.default_12')) .color(sameDate(item.date, this.homeStore.showDate) ? $r('app.color.blueColor') : $r('app.color.white')) Image(this.getProgressImg(item)) @@ -87,6 +89,7 @@ export struct WeekCalendar { .margin({ top: commonConst.THOUSANDTH_80 }) } .width(`${WEEK_DAY_WIDTH}%`) + .justifyContent(FlexAlign.SpaceBetween) .onClick(() => WeekCalendarMethods.calenderItemClickAction.call(this, item, index)) }) } @@ -99,10 +102,9 @@ export struct WeekCalendar { } .borderRadius($r('app.float.default_24')) .backgroundColor($r('app.color.white')) - .justifyContent(FlexAlign.SpaceAround) .width(commonConst.THOUSANDTH_1000) .height(commonConst.THOUSANDTH_1000) - .padding({ top: commonConst.THOUSANDTH_80, bottom: commonConst.THOUSANDTH_120 }) + .padding({ top: commonConst.THOUSANDTH_50, bottom: commonConst.THOUSANDTH_120 }) } .width(commonConst.THOUSANDTH_1000) diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskDetailComponent.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskDetailComponent.ets index e5f16f20938dbaef490e0897ac575f40f19deb6f..17dee713be7c58e59a04f3c2185f4e45aa6a3a83 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskDetailComponent.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskDetailComponent.ets @@ -29,12 +29,12 @@ import { } from './TaskEditListItem'; import { BroadCast, BroadCastType } from '../../common/utils/BroadCast'; import { HealthDataSrcMgr } from '../../common/utils/HealthDataSrcMgr'; -import { initFrequencyString, addTask , formatParams} from '../../viewmodel/TaskViewModel'; -import { CustomDialogView } from '../dialog/CustomDialogView'; +import { initFrequencyString, addTask, formatParams } from '../../viewmodel/TaskViewModel'; +import { TaskDialogView } from '../dialog/TaskDialogView'; -@Styles function listItemStyle () { +@Styles function listItemStyle() { .backgroundColor($r('app.color.white')) - .height(commonConst.THOUSANDTH_80) + .height(commonConst.DEFAULT_56) .borderRadius(commonConst.DEFAULT_10) .padding({ left: commonConst.DEFAULT_12, right: commonConst.DEFAULT_12 }) } @@ -42,19 +42,20 @@ import { CustomDialogView } from '../dialog/CustomDialogView'; @Component export default struct TaskDetail { @Provide broadCast: BroadCast = HealthDataSrcMgr.getInstance().getBroadCast(); - @Provide settingParams: ITaskItem = this.parseRouterParams(); + @Provide @Watch('onParamsChanged') settingParams: ITaskItem = this.parseRouterParams(); @Provide frequency: string = initFrequencyString(this.settingParams?.frequency); - private isOpen: boolean = this.parseRouterParams()['isOpen']; + private isChanged: boolean = false; parseRouterParams() { const routerParams: ITaskItem = JSON.parse(router.getParams()['params']); return routerParams; } + onParamsChanged() { + this.isChanged = true; + } + backIndexParams() { - if (this.isOpen === this.settingParams.isOpen) { - return {}; - } return formatParams({ ...this.settingParams, isDone: true, @@ -63,32 +64,40 @@ export default struct TaskDetail { } finishTaskEdit() { - addTask({ - id: commonConst.ZERO, - date: commonConst.GLOBAL_KEY, - ...this.settingParams, - isDone: false, - finValue: '', - }) - .then(res => { - router.back({ - url: 'pages/MainPage', - params: { - editTask: this.backIndexParams(), - } - }) - Logger.info('addTaskFinished', res as string); + if (this.isChanged) { + addTask({ + id: commonConst.ZERO, + date: commonConst.GLOBAL_KEY, + ...this.settingParams, + isDone: false, + finValue: '', }) - .catch(res => { - prompt.showToast({ - message: commonConst.SETTING_FINISH_FAILED_MESSAGE + .then(res => { + router.back({ + url: 'pages/MainPage', + params: { + editTask: this.backIndexParams(), + } + }) + Logger.info('addTaskFinished', res as string); }) - Logger.error('addTaskFailed', res as string); - }) + .catch(res => { + prompt.showToast({ + message: commonConst.SETTING_FINISH_FAILED_MESSAGE + }) + Logger.error('addTaskFailed', res as string); + }) + return; + } + router.back({ + url: 'pages/MainPage', + }) } aboutToAppear() { - this.broadCast.off(null, null); + this.broadCast.off(BroadCastType.SHOW_TARGET_SETTING_DIALOG, null); + this.broadCast.off(BroadCastType.SHOW_REMIND_TIME_DIALOG, null); + this.broadCast.off(BroadCastType.SHOW_FREQUENCY_DIALOG, null); } build() { @@ -111,7 +120,7 @@ export default struct TaskDetail { ) .onClick(() => { this.broadCast.emit( - BroadCastType.SHOW_TARGET_SETTING_DIALOG); + BroadCastType.SHOW_TARGET_SETTING_DIALOG); }) ListItem() { @@ -126,9 +135,7 @@ export default struct TaskDetail { .listItemStyle() .enabled(this.settingParams?.isOpen && this.settingParams?.isAlarm) .onClick(() => { - this.broadCast.emit( - BroadCastType.SHOW_REMIND_TIME_DIALOG - ); + this.broadCast.emit(BroadCastType.SHOW_REMIND_TIME_DIALOG); }) ListItem() { @@ -137,14 +144,11 @@ export default struct TaskDetail { .listItemStyle() .enabled(this.settingParams?.isOpen) .onClick(() => { - this.broadCast.emit( - BroadCastType.SHOW_FREQUENCY_DIALOG, - ); + this.broadCast.emit(BroadCastType.SHOW_FREQUENCY_DIALOG); }) } .width(commonConst.THOUSANDTH_940) - .margin({ bottom: commonConst.THOUSANDTH_400 }) Button() { Text($r('app.string.complete')).fontSize($r('app.float.default_20')).fontColor($r('app.color.blueColor')) @@ -155,8 +159,12 @@ export default struct TaskDetail { .onClick(() => { this.finishTaskEdit(); }) + .position({ + x: commonConst.THOUSANDTH_100, + y: commonConst.THOUSANDTH_800 + }) - CustomDialogView() + TaskDialogView() } .width(commonConst.THOUSANDTH_1000) } diff --git a/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskListComponent.ets b/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskListComponent.ets index 413efb8504e60aabcccb1b5a804436cccc6a172b..3234f78eba3ff353924a87ef45cbf9ad9a0e635d 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskListComponent.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/view/task/TaskListComponent.ets @@ -52,7 +52,7 @@ export default struct TaskList { .height(commonConst.THOUSANDTH_80) .borderRadius(commonConst.DEFAULT_12) .onClick(() => { - router.push({ + router.pushUrl({ url: 'pages/TaskEditPage', params: { params: formatParams(item), diff --git a/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets b/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets index 97a9fc06b9aa63e7aa0e79bf41b9e525d0fa8bef..48fb0d67582875d0c81ec24ca9efc136d5d2f0a2 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets @@ -1,4 +1,3 @@ -import { DEFAULT_100 } from '../common/constants/CommonConstants'; /* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License,Version 2.0 (the "License"); @@ -14,6 +13,7 @@ import { DEFAULT_100 } from '../common/constants/CommonConstants'; * limitations under the License. */ +import { DEFAULT_100 } from '../common/constants/CommonConstants'; import { isReachNewAchievement, ACHIEVEMENT_LEVEL_KEY } from '../model/AchieveModel'; import DatabaseApi from '../model/DatabaseModel'; import { TaskMapById, ITaskItem, ACHIEVEMENT_LEVEL_LIST } from '../model/TaskInitList'; @@ -50,16 +50,15 @@ export class HomeStore { let [initArr, dateArr] = initializeOnStartUp(this.currentDate); this.dateArr = initArr; Logger.info('this.currentDate', this.currentDate.toDateString()); - this.selectedDayInfo = initArr[this.selectedDay]; Logger.info('initWeekData dateArr', JSON.stringify(dateArr)) // get data form db try { this.dayInfoApi.getRdbStore(() => { this.databaseApi.query(dateToStr(new Date()), (taskList, dayInfo) => { Logger.info('Current Day Task Info: ', JSON.stringify(taskList)); - this.selectedDayInfo = { ...this.selectedDayInfo, taskList, dayInfo }; this.dayInfoApi.queryList(dateArr, (res: DayInfo[]) => { let tempList = res.concat(dayInfo); + let currentIndex = 0; Logger.info('initDayInfoList: ', JSON.stringify(res)); for (let i = 0; i < this.dateArr.length; i++) { let tempDayInfo = tempList.find((item) => item.date == this.dateArr[i].dateStr) || { @@ -68,13 +67,16 @@ export class HomeStore { targetTaskNum: 0 }; initArr[i].dayInfo = tempDayInfo; + initArr[i].taskList = taskList; if (this.dateArr[i].dateStr == dateToStr(new Date(this.showDate))) { // get tasks of showDate - initArr[i].taskList = taskList; - this.updateSelectedDayInfo(initArr[i]); + currentIndex = i; } } this.dateArr = initArr; + setTimeout(() => { + this.setSelectedShowDate(this.showDate); + }, 0) }) }) }) @@ -107,15 +109,15 @@ export class HomeStore { Logger.debug('updateSelectedDayInfo', JSON.stringify(selectedDayInfo)); if (selectedDayInfo.taskList?.length === 0) { // get data form db - this.taskInfoTableApi.getRdbStore(() => { + TaskInfoTableApi.getRdbStore(() => { TaskInfoTableApi.query(selectedDayInfo.dateStr, true, (res) => { Logger.info('Selected TaskInfoList: ', JSON.stringify(res)); selectedDayInfo.taskList = res; - this.selectedDayInfo = { ...selectedDayInfo }; this.dateArr = this.dateArr.map((item: WeekDateModel) => item.dateStr == selectedDayInfo.dateStr ? { ...item, taskList: res } : item); + this.selectedDayInfo = { ...selectedDayInfo }; }); - }); + }) } else { this.selectedDayInfo = { ...selectedDayInfo }; } @@ -154,7 +156,7 @@ export class HomeStore { // delete task let taskIndex = taskList.findIndex((item) => item.taskID == taskID); Logger.info('taskList[taskIndex]', JSON.stringify(taskList[taskIndex])); - if (taskList[taskIndex].isDone) { + if (taskList[taskIndex]?.isDone) { dayInfo.finTaskNum -= 1; } taskList = taskList.filter((item) => item.taskID != taskID); diff --git a/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets b/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets index 0adfd30fc652dcfc5befc700cbdd28153bf1ac76..5dd53c551e1af10e996f9aace5defa6aacf26fa8 100644 --- a/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets +++ b/ETSUI/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets @@ -16,7 +16,6 @@ import { TaskInfoTable } from '../common/database/tables/TaskInfoTable'; import { Logger } from '../common/utils/log/Logger'; import TaskInfo, { oneWeek } from '../common/bean/TaskInfo'; -import reminder from '../common/reminderagent/ReminderAgent'; import { EVERYDAY, GLOBAL_KEY, @@ -26,65 +25,14 @@ import { EAT_APPLE_RANGE, TIMES_100 } from '../common/constants/CommonConstants'; -import { TaskMapById, RemindContentMap, ITaskItem } from '../model/TaskInitList'; +import { TaskMapById, ITaskItem } from '../model/TaskInitList'; import { padTo2Digits } from '../common/utils/Utils'; -const { publishReminder, cancelReminder, hasNotificationId } = reminder; const taskInfoTable = new TaskInfoTable(); export const taskOriginData: ITaskItem[] = Object.keys(TaskMapById).map(item => { return TaskMapById[item]; }) -/** - * @description Call notification capability - * @param params { - * hour: Hour - * minute: Minute - * daysOfWeek: Frequency of a week - * title: Notice Title - * content: Contents of notice - * notificationId: Notification ID - * } - * - */ -const useReminder = (params) => { - try { - publishReminder({ - hour: Number(params?.startTime.split(':')[0]), - minute: Number(params?.startTime.split(':')[1]), - daysOfWeek: params?.frequency.split(',').map(item => Number(item)), - title: RemindContentMap[params?.taskID].title, - content: RemindContentMap[params?.taskID].content, - notificationId: params?.taskID - }); - } catch (error) { - Logger.error('publishReminder', JSON.stringify(error)); - } -} - -/** - * @description Call cancel notification capability - * @param reminderId Notification ID - */ -const useCancelReminder = (reminderId) => { - try { - cancelReminder(reminderId); - } catch (error) { - Logger.error('cancelReminder', JSON.stringify(error)); - } -} - -/** - * @description Determine whether there is a notification - * @param notificationId Notification ID - */ -const isHasNotificationId = (notificationId: number) => { - return new Promise((resolve) => { - resolve(hasNotificationId(notificationId)); - }); -} - - /** * @description Get all task status * @return object[] Database query results @@ -110,17 +58,6 @@ export const addTask = (params: TaskInfo) => { return; } return new Promise((resolve, reject) => { - // 调用通知 - if (params?.isAlarm) { - useReminder(params); - } - if (!params?.isAlarm) { - isHasNotificationId(params?.taskID).then(flag => { - if (flag) { - useCancelReminder(params.taskID); - } - }) - } taskInfoTable.updateDataByDate(params, (flag) => { if (!flag) { Logger.error('insertTaskSetting', 'updateTaskSetting Error!'); diff --git a/ETSUI/Healthy_life/entry/src/main/module.json5 b/ETSUI/Healthy_life/entry/src/main/module.json5 index ca6b45c477fb51ce3058d193c3ce4f7cd841d91d..044a0982032bf5b071b91f4cd2f2fa22a709a573 100644 --- a/ETSUI/Healthy_life/entry/src/main/module.json5 +++ b/ETSUI/Healthy_life/entry/src/main/module.json5 @@ -2,7 +2,7 @@ "module": { "name": "entry", "type": "entry", - "description": "$string:module_desc", + "description": "$string:entry_desc", "mainElement": "EntryAbility", "deviceTypes": [ "default", @@ -11,15 +11,20 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", + "orientation": "portrait", "srcEntrance": "./ets/entryability/EntryAbility.ts", - "description": "$string:EntryAbility_desc", + "description": "$string:MainAbility_desc", "icon": "$media:logo", "label": "$string:MainAbility_label", "startWindowIcon": "$media:logo", - "startWindowBackground": "$color:start_window_background", + "startWindowBackground": "$color:white", "visible": true, "skills": [ { diff --git a/ETSUI/Healthy_life/entry/src/main/resources/base/element/color.json b/ETSUI/Healthy_life/entry/src/main/resources/base/element/color.json index e65645fc5b7900bf93e999d3442cafecb363bfef..d0ddb219d661e90faa0d1ac145fa33969fa8548a 100644 --- a/ETSUI/Healthy_life/entry/src/main/resources/base/element/color.json +++ b/ETSUI/Healthy_life/entry/src/main/resources/base/element/color.json @@ -1,9 +1,5 @@ { "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - }, { "name": "white", "value": "#FFFFFF" diff --git a/ETSUI/Healthy_life/entry/src/main/resources/base/element/string.json b/ETSUI/Healthy_life/entry/src/main/resources/base/element/string.json index 5f3b8614a3577ad0917ef9b7b0343b986bb46859..634ef1309ce4efd8f03573d31d7b20015c1eac81 100644 --- a/ETSUI/Healthy_life/entry/src/main/resources/base/element/string.json +++ b/ETSUI/Healthy_life/entry/src/main/resources/base/element/string.json @@ -1,25 +1,5 @@ { "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "label" - }, - { - "name": "EntryFormAbility_desc", - "value": "form_description" - }, - { - "name": "EntryFormAbility_label", - "value": "form_label" - }, { "name": "entry_desc", "value": "description" @@ -96,6 +76,7 @@ "name": "task_water", "value": "喝水" }, + { "name": "task_smile", "value": "每日微笑" @@ -191,6 +172,18 @@ { "name": "jump_ad", "value": " 跳过广告 %ds" + }, + { + "name": "alert", + "value": "警告" + }, + { + "name": "alert_message", + "value": "您的系统日期早于最新的打卡时间!" + }, + { + "name": "alert_button", + "value": "退出" } ] } \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/resources/base/profile/form_config.json b/ETSUI/Healthy_life/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..04f3ea9d5fe20be7567e4b164a461d3967b508dd --- /dev/null +++ b/ETSUI/Healthy_life/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,38 @@ +{ + "forms": [ + { + "name": "agency", + "description": "This is a service widget.", + "src": "./js/agency/pages/index/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "00:00", + "defaultDimension": "2*4", + "supportDimensions": [ + "2*4" + ] + }, + { + "name": "progress", + "description": "This is a service widget.", + "src": "./js/progress/pages/index/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "isDefault": false, + "updateEnabled": true, + "scheduledUpdateTime": "00:00", + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/resources/en_US/element/string.json b/ETSUI/Healthy_life/entry/src/main/resources/en_US/element/string.json index 5f3b8614a3577ad0917ef9b7b0343b986bb46859..24cab575b83116946693a3793fe7f9d4c5fff93e 100644 --- a/ETSUI/Healthy_life/entry/src/main/resources/en_US/element/string.json +++ b/ETSUI/Healthy_life/entry/src/main/resources/en_US/element/string.json @@ -1,9 +1,5 @@ { "string": [ - { - "name": "module_desc", - "value": "module description" - }, { "name": "EntryAbility_desc", "value": "description" @@ -11,186 +7,6 @@ { "name": "EntryAbility_label", "value": "label" - }, - { - "name": "EntryFormAbility_desc", - "value": "form_description" - }, - { - "name": "EntryFormAbility_label", - "value": "form_label" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "运动总有新玩法" - }, - { - "name": "MainAbility_label", - "value": "健康生活" - }, - { - "name": "form_FormAbility_desc", - "value": "form_description" - }, - { - "name": "form_FormAbility_label", - "value": "form_label" - }, - { - "name": "tab_home", - "value": "首页" - }, - { - "name": "mine_personal_data", - "value": "个人资料" - }, - { - "name": "mine_check_updates", - "value": "检查更新" - }, - { - "name": "mine_about", - "value": "关于" - }, - { - "name": "clock_in", - "value": "打卡" - }, - { - "name": "got_it", - "value": "知道了" - }, - { - "name": "tab_achievement", - "value": "成就" - }, - { - "name": "achievement", - "value": "我的成就" - }, - { - "name": "tab_mine", - "value": "我的" - }, - { - "name": "task_list", - "value": "任务列表" - }, - { - "name": "no_task", - "value": "暂无任务,请添加任务" - }, - { - "name": "task_morning", - "value": "早起" - }, - { - "name": "task_apple", - "value": "吃苹果" - }, - { - "name": "task_water", - "value": "喝水" - }, - { - "name": "task_smile", - "value": "每日微笑" - }, - { - "name": "task_brush", - "value": "每日刷牙" - }, - { - "name": "task_night", - "value": "早睡" - }, - { - "name": "task_done", - "value": "已完成" - }, - { - "name": "task_achievement_level", - "value": "连续%d天达成" - }, - { - "name": "already_open", - "value": "已开启" - }, - { - "name": "target_setting", - "value": "目标设置" - }, - { - "name": "open_reminder", - "value": "开启提醒" - }, - { - "name": "remind_time", - "value": "提醒时间" - }, - { - "name": "frequency", - "value": "频率" - }, - { - "name": "complete", - "value": "完成" - }, - { - "name": "cancel", - "value": "取消" - }, - { - "name": "confirm", - "value": "确认" - }, - { - "name": "set_your_frequency", - "value": "请设置您的频率" - }, - { - "name": "target_progress", - "value": "目标进度" - }, - { - "name": "Helvetica", - "value": "Helvetica" - }, - { - "name": "PingFangSC_Regular", - "value": "PingFangSC-Regular" - }, - { - "name": "HarmonyHeiTi", - "value": "HarmonyHeiTi" - }, - { - "name": "HarmonyHeiTi_Bold", - "value": "HarmonyHeiTi-Bold" - }, - { - "name": "HarmonyHeiTi_Medium", - "value": "HarmonyHeiTi-Medium" - }, - { - "name": "sure", - "value": "确定" - }, - { - "name": "privacy_title", - "value": "请在“健康生活”权限管理中开启“XX”权限" - }, - { - "name": "privacy_desc", - "value": "该功能支持XX…(功能介绍)" - }, - { - "name": "jump_ad", - "value": " 跳过广告 %ds" } ] } \ No newline at end of file diff --git a/ETSUI/Healthy_life/entry/src/main/resources/zh_CN/element/string.json b/ETSUI/Healthy_life/entry/src/main/resources/zh_CN/element/string.json index c12e251a2ef3665aa5b72941689fcd31fbb8ab81..597ecf95e61d7e30367c22fe2f8638008361b044 100644 --- a/ETSUI/Healthy_life/entry/src/main/resources/zh_CN/element/string.json +++ b/ETSUI/Healthy_life/entry/src/main/resources/zh_CN/element/string.json @@ -11,186 +11,6 @@ { "name": "EntryAbility_label", "value": "label" - }, - { - "name": "EntryFormAbility_desc", - "value": "form_description" - }, - { - "name": "EntryFormAbility_label", - "value": "form_label" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "运动总有新玩法" - }, - { - "name": "MainAbility_label", - "value": "健康生活" - }, - { - "name": "form_FormAbility_desc", - "value": "form_description" - }, - { - "name": "form_FormAbility_label", - "value": "form_label" - }, - { - "name": "tab_home", - "value": "首页" - }, - { - "name": "mine_personal_data", - "value": "个人资料" - }, - { - "name": "mine_check_updates", - "value": "检查更新" - }, - { - "name": "mine_about", - "value": "关于" - }, - { - "name": "clock_in", - "value": "打卡" - }, - { - "name": "got_it", - "value": "知道了" - }, - { - "name": "tab_achievement", - "value": "成就" - }, - { - "name": "achievement", - "value": "我的成就" - }, - { - "name": "tab_mine", - "value": "我的" - }, - { - "name": "task_list", - "value": "任务列表" - }, - { - "name": "no_task", - "value": "暂无任务,请添加任务" - }, - { - "name": "task_morning", - "value": "早起" - }, - { - "name": "task_apple", - "value": "吃苹果" - }, - { - "name": "task_water", - "value": "喝水" - }, - { - "name": "task_smile", - "value": "每日微笑" - }, - { - "name": "task_brush", - "value": "每日刷牙" - }, - { - "name": "task_night", - "value": "早睡" - }, - { - "name": "task_done", - "value": "已完成" - }, - { - "name": "task_achievement_level", - "value": "连续%d天达成" - }, - { - "name": "already_open", - "value": "已开启" - }, - { - "name": "target_setting", - "value": "目标设置" - }, - { - "name": "open_reminder", - "value": "开启提醒" - }, - { - "name": "remind_time", - "value": "提醒时间" - }, - { - "name": "frequency", - "value": "频率" - }, - { - "name": "complete", - "value": "完成" - }, - { - "name": "cancel", - "value": "取消" - }, - { - "name": "confirm", - "value": "确认" - }, - { - "name": "set_your_frequency", - "value": "请设置您的频率" - }, - { - "name": "target_progress", - "value": "目标进度" - }, - { - "name": "Helvetica", - "value": "Helvetica" - }, - { - "name": "PingFangSC_Regular", - "value": "PingFangSC-Regular" - }, - { - "name": "HarmonyHeiTi", - "value": "HarmonyHeiTi" - }, - { - "name": "HarmonyHeiTi_Bold", - "value": "HarmonyHeiTi-Bold" - }, - { - "name": "HarmonyHeiTi_Medium", - "value": "HarmonyHeiTi-Medium" - }, - { - "name": "sure", - "value": "确定" - }, - { - "name": "privacy_title", - "value": "请在“健康生活”权限管理中开启“XX”权限" - }, - { - "name": "privacy_desc", - "value": "该功能支持XX…(功能介绍)" - }, - { - "name": "jump_ad", - "value": " 跳过广告 %ds" } ] } \ No newline at end of file diff --git a/ETSUI/Healthy_life/package.json b/ETSUI/Healthy_life/package.json index 8fdfb621748ee3c4bd6665f8cd82c651b8b56726..470839b911dedd91e609336d8616fa4f8596f458 100644 --- a/ETSUI/Healthy_life/package.json +++ b/ETSUI/Healthy_life/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"healthy_life", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "healthy_life", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/List/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/List/entry/src/main/ets/entryability/EntryAbility.ts index 1719588a50c80d913577a461b2b0ef04617255e6..388509e2f4331345c1d83d9e39333bf9b9ddba2a 100644 --- a/ETSUI/List/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/List/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,10 +14,10 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/ETSUI/List/entry/src/main/ets/pages/ListIndex.ets b/ETSUI/List/entry/src/main/ets/pages/ListIndex.ets index e84d3102a6b999bf5d2def6a58a6f2c4a44a1c88..dbbe8a998d06730dfd271b2e6dc1b02cad1ea424 100644 --- a/ETSUI/List/entry/src/main/ets/pages/ListIndex.ets +++ b/ETSUI/List/entry/src/main/ets/pages/ListIndex.ets @@ -30,6 +30,7 @@ struct ListIndex { } .size({ width: LAYOUT_WIDTH_OR_HEIGHT, height: LAYOUT_WIDTH_OR_HEIGHT }) .title(STORE) + .titleMode(NavigationTitleMode.Mini) } .height(LAYOUT_WIDTH_OR_HEIGHT) .backgroundColor($r('app.color.primaryBgColor')) diff --git a/ETSUI/List/entry/src/main/module.json5 b/ETSUI/List/entry/src/main/module.json5 index 1e82b178ebb2fc602c622adeb67f4551a86abf2c..87bd4701e800e59c486ec97a4198527a9a747eaf 100644 --- a/ETSUI/List/entry/src/main/module.json5 +++ b/ETSUI/List/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/List/entry/src/main/resources/zh_CN/element/string.json b/ETSUI/List/entry/src/main/resources/zh_CN/element/string.json index cd9d08f9ee651a1cbd9183f3d38c581604bc7c7c..f77f211d8a71b71d5e07aefecf06c027225beefc 100644 --- a/ETSUI/List/entry/src/main/resources/zh_CN/element/string.json +++ b/ETSUI/List/entry/src/main/resources/zh_CN/element/string.json @@ -1,5 +1,9 @@ { "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, { "name": "EntryAbility_desc", "value": "description" diff --git a/ETSUI/List/package.json b/ETSUI/List/package.json index 60ddfc51ed45d14c1ac5e77cb2b80c6a21a9465f..1b61c0c27537a33447ab6e5d94456cec9c243a1e 100644 --- a/ETSUI/List/package.json +++ b/ETSUI/List/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"list", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "list", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets b/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets index 63e2eccce4acfa72cb721f98ee44a2f8075b6cca..d5ad9aaba75c6a8d7b55d28122fabdb4c0a55581 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets @@ -14,7 +14,8 @@ */ // Thousandth -export const THOUSANDTH_80: string = '8%'; +export const THOUSANDTH_80: string = '8%'; +export const THOUSANDTH_100: string = '10%'; export const THOUSANDTH_400: string = '40%'; export const THOUSANDTH_500: string = '50%'; export const THOUSANDTH_560: string = '56%'; @@ -45,7 +46,7 @@ export const ADD_TASK_TITLE: string = '添加任务'; export const EDIT_TASK_TITLE: string = '编辑任务'; // prompt message -export const SETTING_FINISHED_MESSAGE = '设置完成!!!'; +export const SETTING_FINISHED_MESSAGE = '设置完成'; export const CHOOSE_TIME_OUT_RANGE: string = '选择时间超出范围'; // date format diff --git a/ETSUI/List_HDC/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/List_HDC/entry/src/main/ets/entryability/EntryAbility.ts index 18e82460455e38b593b29c254126c82070931b4f..a98af6ed46cbcd4021b044a91cd84d348393fada 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/List_HDC/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,10 +14,10 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.ets b/ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.ets index 53a54364960a2f47f8c101baf27b07c551519588..9c384abaa0190a8ff07c93d7813ec4001c8cb2c1 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.ets @@ -47,7 +47,7 @@ export const TaskInitList: TaskListItem[] = [ taskID: 2, taskName: $r('app.string.task_water'), icon: $r('app.media.water'), - targetValue: '1', + targetValue: '0.25', isOpen: true, unit: 'L', isAlarm: false, diff --git a/ETSUI/List_HDC/entry/src/main/ets/pages/ListIndexPage.ets b/ETSUI/List_HDC/entry/src/main/ets/pages/ListIndexPage.ets index cfa8d005ec7822da27cd825c18e9236a2f166983..b3bc22de52c685fb4b16314e8f52db879e60509b 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/pages/ListIndexPage.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/pages/ListIndexPage.ets @@ -33,6 +33,7 @@ struct Index { } .size({ width: THOUSANDTH_1000, height: THOUSANDTH_1000 }) .title(ADD_TASK_TITLE) + .titleMode(NavigationTitleMode.Mini) } .backgroundColor($r('app.color.primaryBgColor')) .height(THOUSANDTH_1000) diff --git a/ETSUI/List_HDC/entry/src/main/ets/pages/TaskEditPage.ets b/ETSUI/List_HDC/entry/src/main/ets/pages/TaskEditPage.ets index 7935b9eb555c6c4813825262e49d8cc24d1e8181..6e66a9b40f2a3a1b93287df3a16d41eb496f380e 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/pages/TaskEditPage.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/pages/TaskEditPage.ets @@ -30,6 +30,7 @@ struct TaskEdit { } .size({ width: THOUSANDTH_1000, height: THOUSANDTH_1000 }) .title(EDIT_TASK_TITLE) + .titleMode(NavigationTitleMode.Mini) } .height(THOUSANDTH_1000) .backgroundColor($r('app.color.primaryBgColor')) diff --git a/ETSUI/List_HDC/entry/src/main/ets/view/TaskDetail.ets b/ETSUI/List_HDC/entry/src/main/ets/view/TaskDetail.ets index 00850987ffb2acb2cad8d7f4c3099d67d0fa9c7d..504fc3ccb3a4b7455597c6d6f1a0bcd076cfe51c 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/view/TaskDetail.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/view/TaskDetail.ets @@ -29,9 +29,9 @@ import { BroadCast, BroadCastType } from '../common/utils/BroadCast'; import { EventSourceManager } from '../model/EventSourceManager'; import { CustomDialogView } from './CustomDialogView'; -@Styles function listItemStyle () { +@Styles function listItemStyle() { .backgroundColor($r('app.color.white')) - .height(commonConst.THOUSANDTH_80) + .height(commonConst.DEFAULT_56) .borderRadius(commonConst.DEFAULT_10) .padding({ left: commonConst.DEFAULT_12, right: commonConst.DEFAULT_12 }) } @@ -58,74 +58,75 @@ export default struct TaskDetail { } build() { - Row() { - Column() { - List({ space: commonConst.LIST_ITEM_SPACE }) { - ListItem() { - TaskChooseItem() - } - .listItemStyle() - - ListItem() { - TargetSetItem() - } - .listItemStyle() - .enabled( - this.settingParams?.isOpen - && (this.settingParams?.taskID !== taskType.smile) - && (this.settingParams?.taskID !== taskType.brushTeeth) - ) - .onClick(() => { - this.broadCast.emit( - BroadCastType.SHOW_TARGET_SETTING_DIALOG); - }) - - ListItem() { - OpenRemindItem() - } - .listItemStyle() - .enabled(this.settingParams?.isOpen) - - ListItem() { - RemindTimeItem() - } - .listItemStyle() - .enabled(this.settingParams?.isOpen && this.settingParams?.isAlarm) - .onClick(() => { - this.broadCast.emit( - BroadCastType.SHOW_REMIND_TIME_DIALOG - ); - }) - - ListItem() { - FrequencyItem() - } - .listItemStyle() - .enabled(this.settingParams?.isOpen) - .onClick(() => { - this.broadCast.emit( - BroadCastType.SHOW_FREQUENCY_DIALOG, - ); - }) + Column() { + List({ space: commonConst.LIST_ITEM_SPACE }) { + ListItem() { + TaskChooseItem() + } + .listItemStyle() + + ListItem() { + TargetSetItem() + } + .listItemStyle() + .enabled( + this.settingParams?.isOpen + && (this.settingParams?.taskID !== taskType.smile) + && (this.settingParams?.taskID !== taskType.brushTeeth) + ) + .onClick(() => { + this.broadCast.emit( + BroadCastType.SHOW_TARGET_SETTING_DIALOG); + }) + ListItem() { + OpenRemindItem() } - .width(commonConst.THOUSANDTH_940) - .margin({ bottom: commonConst.THOUSANDTH_400 }) + .listItemStyle() + .enabled(this.settingParams?.isOpen) - Button() { - Text($r('app.string.complete')).fontSize(commonConst.DEFAULT_20).fontColor($r('app.color.blueColor')) + ListItem() { + RemindTimeItem() } - .width(commonConst.THOUSANDTH_800) - .height(commonConst.DEFAULT_48) - .backgroundColor($r('app.color.borderColor')) + .listItemStyle() + .enabled(this.settingParams?.isOpen && this.settingParams?.isAlarm) .onClick(() => { - this.finishTaskEdit(); + this.broadCast.emit( + BroadCastType.SHOW_REMIND_TIME_DIALOG + ); }) - CustomDialogView() + ListItem() { + FrequencyItem() + } + .listItemStyle() + .enabled(this.settingParams?.isOpen) + .onClick(() => { + this.broadCast.emit( + BroadCastType.SHOW_FREQUENCY_DIALOG, + ); + }) + + } + .width(commonConst.THOUSANDTH_940) + + Button() { + Text($r('app.string.complete')).fontSize(commonConst.DEFAULT_20).fontColor($r('app.color.blueColor')) } - .width(commonConst.THOUSANDTH_1000) + .width(commonConst.THOUSANDTH_800) + .height(commonConst.DEFAULT_48) + .backgroundColor($r('app.color.borderColor')) + .onClick(() => { + this.finishTaskEdit(); + }) + .position({ + x: commonConst.THOUSANDTH_100, + y: commonConst.THOUSANDTH_800 + }) + + CustomDialogView() } + .width(commonConst.THOUSANDTH_1000) } } diff --git a/ETSUI/List_HDC/entry/src/main/ets/view/TaskList.ets b/ETSUI/List_HDC/entry/src/main/ets/view/TaskList.ets index f414145c0ce5cc558d390de11af5ad5ad418fa79..da6d9a1da5b02dc72340eda2b0960114dbb66faa 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/view/TaskList.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/view/TaskList.ets @@ -53,7 +53,7 @@ export default struct TaskList { .height(commonConst.THOUSANDTH_80) .borderRadius(commonConst.DEFAULT_12) .onClick(() => { - router.push({ + router.pushUrl({ url: 'pages/TaskEditPage', params: { params: formatParams(item), diff --git a/ETSUI/List_HDC/entry/src/main/ets/view/TaskSettingDialog.ets b/ETSUI/List_HDC/entry/src/main/ets/view/TaskSettingDialog.ets index e06ebd25d76df27f8bd6f9397a8377feeacd0aa1..0485459ae556b51c6614e91021b0233cb2b08a26 100644 --- a/ETSUI/List_HDC/entry/src/main/ets/view/TaskSettingDialog.ets +++ b/ETSUI/List_HDC/entry/src/main/ets/view/TaskSettingDialog.ets @@ -27,7 +27,7 @@ export struct TargetSettingDialog { controller: CustomDialogController; drinkRange: string[] = createDrinkRange(); appleRange: string[] = createAppleRange(); - currentValue: string = '1'; + currentValue: string = this.settingParams.targetValue; currentTime: string = commonConst.DEFAULT_TIME; private tip: string = ''; diff --git a/ETSUI/List_HDC/entry/src/main/module.json5 b/ETSUI/List_HDC/entry/src/main/module.json5 index 1e82b178ebb2fc602c622adeb67f4551a86abf2c..87bd4701e800e59c486ec97a4198527a9a747eaf 100644 --- a/ETSUI/List_HDC/entry/src/main/module.json5 +++ b/ETSUI/List_HDC/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/List_HDC/package.json b/ETSUI/List_HDC/package.json index 75fb28f1eff1582da5c5bea3ac3040e85dbed70e..7d56e1c90cc454ff8a78c3683c80998a1c5f19c0 100644 --- a/ETSUI/List_HDC/package.json +++ b/ETSUI/List_HDC/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "list_hdc", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "list_hdc", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/ETSUI/Multi_device/build-profile.json5 b/ETSUI/Multi_device/build-profile.json5 index fc53829be062f3a883f815802e6039c733ebb352..d7b1117cdb34aab2983ac65026d9e8dcc91332d1 100644 --- a/ETSUI/Multi_device/build-profile.json5 +++ b/ETSUI/Multi_device/build-profile.json5 @@ -1,5 +1,6 @@ { "app": { + "signingConfigs": [], "compileSdkVersion": 9, "compatibleSdkVersion": 9, "products": [ diff --git a/ETSUI/Multi_device/entry/src/main/ets/common/constants/CommonConstants.ets b/ETSUI/Multi_device/entry/src/main/ets/common/constants/CommonConstants.ets index d69eb196bfeb7017fe0b47c35e2c1aeea1216804..48a6aff81a9f524a8d1330faf409c8842375a267 100644 --- a/ETSUI/Multi_device/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/ETSUI/Multi_device/entry/src/main/ets/common/constants/CommonConstants.ets @@ -32,7 +32,7 @@ export default class CommonConstants { static readonly BORDER_RADIUS = 10; static readonly SWIPER_WIDTH = 330; static readonly SWIPER_SCALE = 0.9; - static readonly ITEM_SPACE = 15; + static readonly ITEM_SPACE = 12; static readonly PADDING = 15; static readonly PADDING_SCALE = 0.05; } \ No newline at end of file diff --git a/ETSUI/Multi_device/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/Multi_device/entry/src/main/ets/entryability/EntryAbility.ts index af4d05f57c4fd30d32abf5e83d53ec389fb90b19..80bf23d92d4c7ebf18f86238222fbd1c7da079a9 100644 --- a/ETSUI/Multi_device/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/Multi_device/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,10 +14,10 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' -export default class entryAbility extends Ability { +export default class entryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); @@ -35,6 +35,14 @@ export default class entryAbility extends Ability { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + windowStage.getMainWindow((err, data) => { + if (err && err.code) { + console.error('getMainWindow error'); + return; + } + data.setSystemBarEnable([]); + }) + windowStage.loadContent('pages/Home', (err, data) => { if (err.code) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); diff --git a/ETSUI/Multi_device/entry/src/main/ets/pages/Home.ets b/ETSUI/Multi_device/entry/src/main/ets/pages/Home.ets index e392d957cbfdb709bc3c159ddb013af025c4e92d..aee1e53218075b5168b1ebea1ecac07cfe80801b 100644 --- a/ETSUI/Multi_device/entry/src/main/ets/pages/Home.ets +++ b/ETSUI/Multi_device/entry/src/main/ets/pages/Home.ets @@ -41,7 +41,7 @@ struct HomeComponent { TabContent() { HomeTabComponent() } - .padding({ left: $r('app.float.home_padding'), right: $r('app.float.home_padding')}) + .padding({ left: $r('app.float.home_padding') }) TabContent() { } diff --git a/ETSUI/Multi_device/entry/src/main/module.json5 b/ETSUI/Multi_device/entry/src/main/module.json5 index a14a4b9fe8cbab939cf19a3f0630d477cc2f1770..98eff6f52d0a91d8e2e43137fa5c66c76b34cae0 100644 --- a/ETSUI/Multi_device/entry/src/main/module.json5 +++ b/ETSUI/Multi_device/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/Multi_device/package.json b/ETSUI/Multi_device/package.json index 0f648d1132fb20f3f382b178d4ff8d5bd540a156..317da94b124de50e41c2f9c848060a7ccbb541d0 100644 --- a/ETSUI/Multi_device/package.json +++ b/ETSUI/Multi_device/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"multi_device", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "multi_device", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/OHLayoutAlign/entry/src/main/ets/entryability/EntryAbility.ts index 05a7e6833337cd4868172cb865db4255b6a5593e..7cfa648a70557bc4e06adccbac5257d6a2e1e427 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,5 +1,5 @@ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import Ability from '@ohos.app.ability.UIAbility'; import Window from '@ohos.window' export default class EntryAbility extends Ability { diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/LayoutAlignIndex.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/LayoutAlignIndex.ets index 4106d4b5c3880881607bf2f922bca74d90834081..e8c0a4288bb38492ceb5f9cfd7ff9ee59d5cffa3 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/LayoutAlignIndex.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/LayoutAlignIndex.ets @@ -48,7 +48,7 @@ struct LayoutAlignIndex { ListItem() { ListItemComp({ item: item }).margin({ top: MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN }) } - }, item => item.name) + }, item => JSON.stringify(item)) } .listDirection(Axis.Vertical) .margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) @@ -88,7 +88,7 @@ struct ListItemComp { .margin({ left: MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN, right: MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN }) .backgroundColor($r("app.color.white")) .onClick(() => { - router.push({ + router.pushUrl({ url: SECOND_PAGE, params: { containerType: this.item['containerType'], diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/Second.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/Second.ets index b039c1fb940ee0bf8bdcee68c62e52627b775274..ff7831c2d27825faeca026d294b51e360c0039d6 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/Second.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/pages/Second.ets @@ -57,16 +57,18 @@ struct Second { Column({ space: MARGIN_FONT_SIZE_SPACE.SIXTH_MARGIN }) { Column() { BackComp({ componentName: this.componentName }) - if (this.containerType == CONTAINER_TYPE.FLEX) { + if (this.containerType === CONTAINER_TYPE.FLEX) { FlexShowList() - } else if (this.containerType == CONTAINER_TYPE.COLUMN) { + } else if (this.containerType === CONTAINER_TYPE.COLUMN) { ColumnShowList() - } else if (this.containerType == CONTAINER_TYPE.ROW) { + } else if (this.containerType === CONTAINER_TYPE.ROW) { RowShowList() } else { StackComponent() } - }.width(ALL_PERCENT).height(ALL_PERCENT) + } + .width(ALL_PERCENT) + .height(ALL_PERCENT) } .width(ALL_PERCENT) } diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets index 3a63f29418a5980ad9d7e195770e404bcb6ff7e1..885a0694d07d426cbc79214ecc2a958400ca6b12 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets @@ -43,7 +43,7 @@ export struct ColumnAxisAlignRadioList { ForEach(this.radioList, (item, index) => { AxisAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -67,7 +67,7 @@ struct AxisAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.START: this.currentColumnAlignItems = HorizontalAlign.Start; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets index fb8703b04787a339a2f0861a38a19f4bc3f558a1..441be60ab3277e1ce09365e5bbd01b48a697fa36 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets @@ -13,19 +13,19 @@ * limitations under the License. */ -import { MARGIN_FONT_SIZE_SPACE, ATTRIBUTE_OPACITY, ATTRIBUTE,ALL_PERCENT } from '../common/Constants/CommonConstants'; -import {getColumnModuleList} from '../viewmodel/AttributeModuleData'; -import {ContainerModuleItem} from '../common/bean/ContainerModuleItem'; +import { MARGIN_FONT_SIZE_SPACE, ATTRIBUTE_OPACITY, ATTRIBUTE, ALL_PERCENT } from '../common/Constants/CommonConstants'; +import { getColumnModuleList } from '../viewmodel/AttributeModuleData'; +import { ContainerModuleItem } from '../common/bean/ContainerModuleItem'; /** *Set Main Alignment in Column */ @Component export struct ColumnMainAlignRadioList { - private columnModuleList :ContainerModuleItem[] = getColumnModuleList(); + private columnModuleList: ContainerModuleItem[] = getColumnModuleList(); private groupName: string = this.columnModuleList[0]['groupName']; - private moduleName: Resource = this.columnModuleList[0]['moduleName']; - private radioList: Array =this.columnModuleList[0]['attributeList']; + private moduleName: Resource = this.columnModuleList[0]['moduleName']; + private radioList: Array = this.columnModuleList[0]['attributeList']; build() { Column({ space: MARGIN_FONT_SIZE_SPACE.FIRST_MARGIN }) { @@ -44,7 +44,7 @@ export struct ColumnMainAlignRadioList { ForEach(this.radioList, (item, index) => { MainAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -68,7 +68,7 @@ struct MainAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.START: this.currentColumnJustifyContent = FlexAlign.Start; @@ -81,7 +81,9 @@ struct MainAlignRadioItem { break; } }) - Text(this.textName).fontSize(MARGIN_FONT_SIZE_SPACE.THIRD_MARGIN).opacity(ATTRIBUTE_OPACITY) + Text(this.textName) + .fontSize(MARGIN_FONT_SIZE_SPACE.THIRD_MARGIN) + .opacity(ATTRIBUTE_OPACITY) } } } diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets index f53783118d0424182dd7b7199e919111c714c65c..09f6fdbd9c60c6ce8f442fec7a9d9739d1391035 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets @@ -33,7 +33,7 @@ export struct ColumnShowList { Column() { ForEach(LIST, (item) => { CommonItem({ item: item }) - }, item => item) + }, item => JSON.stringify(item)) } .alignItems(this.currentColumnAlignItems) .justifyContent(this.currentColumnJustifyContent) @@ -43,14 +43,15 @@ export struct ColumnShowList { .backgroundColor($r("app.color.show_list_backgroundColor")) .margin({ top: MARGIN_FONT_SIZE_SPACE.FIRST_MARGIN }) // set main align - ColumnMainAlignRadioList().margin({top:MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN}) + ColumnMainAlignRadioList() + .margin({top:MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN}) // set axis align - ColumnAxisAlignRadioList().margin({top:MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN}) + ColumnAxisAlignRadioList() + .margin({top:MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN}) } .layoutWeight(1) .height(ALL_PERCENT) .width(ALL_PERCENT) - } } diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets index a279d046636d20bb76cf49844583c880388ff05a..ddea853200abaa1ac488f978a844e731f2ac7df3 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets @@ -44,7 +44,7 @@ export struct FlexAxisAlignRadioList { ForEach(this.radioList, (item, index) => { AxisAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -68,7 +68,7 @@ struct AxisAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.START: this.currentFlexAlignItems = ItemAlign.Start; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets index aa11ada8ec06b584e3286a72c22d533e37002ff9..010440bd8d218f5e45faf29d007b627deeb09333 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets @@ -45,7 +45,7 @@ export struct FlexMainAlignRadioList { ForEach(this.radioList, (item, index) => { MainAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN}) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -70,7 +70,7 @@ struct MainAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.START: this.currentFlexJustifyContent = FlexAlign.Start; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainDirectionRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainDirectionRadioList.ets index e0c08f0f1deded0a125fb81fb6f467db6eddfa17..ec0e8d6ad31ab54d02220e34ff1698e9fef4ca4e 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainDirectionRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainDirectionRadioList.ets @@ -44,7 +44,7 @@ export struct FlexMainDirectionRadioList { ForEach(this.radioList, (item, index) => { MainDirectionRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -68,7 +68,7 @@ struct MainDirectionRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.COLUMN: this.currentFlexDirection = FlexDirection.Column; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets index 2ae4d6380ffd105f5c0cbb3c62b1b23c2fb88339..aa59acc61b73a3d0facdd5afd93c4fca35e87792 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets @@ -43,7 +43,7 @@ export struct FlexShowList { }) { ForEach(this.list, (item) => { CommonItem({ item: item }) - }, item => item.toString()) + }, item => JSON.stringify(item)) } .padding(MARGIN_FONT_SIZE_SPACE.COMMON_PADDING) .width(ALL_PERCENT) diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets index 72edd5644ad8d22112f8c06344152cc0504d9e6e..87e052fc80f6ae109c6e5276c0f09ccdda680c88 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets @@ -44,7 +44,7 @@ export struct RowAxisAlignRadioList { ForEach(this.radioList, (item, index) => { AxisAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -68,7 +68,7 @@ struct AxisAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.TOP: this.currentRowAlignItems = VerticalAlign.Top; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowMainAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowMainAlignRadioList.ets index af8739bc875f8d16b2859c9184e29b5124b3f131..eedfdfedbd3a6ac2fa654c0b2b89f2ae3beed52a 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowMainAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowMainAlignRadioList.ets @@ -44,7 +44,7 @@ export struct RowMainAlignRadioList { ForEach(this.radioList, (item, index) => { MainAlignRadioItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) @@ -68,7 +68,7 @@ struct MainAlignRadioItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { + .onClick(() => { switch (this.textName) { case ATTRIBUTE.START: this.currentRowJustifyContent = FlexAlign.Start; diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets index 3f22f1fd2dfbb977dc2e7aa2ff72823b3542c1bc..2293d3983450d121ff9c0c2aaa8435bcd1a6b2db 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets @@ -28,13 +28,11 @@ export struct RowShowList { build() { Column() { - - // Row中元素对齐方式布局 Row() { ForEach(LIST, (item) => { CommonItem({ item: item }) - }, item => item) + }, item => JSON.stringify(item)) } .alignItems(this.currentRowAlignItems) .justifyContent(this.currentRowJustifyContent) @@ -45,9 +43,11 @@ export struct RowShowList { .margin({ top: MARGIN_FONT_SIZE_SPACE.FIRST_MARGIN }) // set main align - RowMainAlignRadioList().margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) + RowMainAlignRadioList() + .margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) // set axis align - RowAxisAlignRadioList().margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) + RowAxisAlignRadioList() + .margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) } .layoutWeight(1) .height(ALL_PERCENT) diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets index 814b9a617d4ea53cebfda9cc27e6936f390ef87f..119d3e9f3d9b4061dd6c52aad2a592319eef9384 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets @@ -43,10 +43,10 @@ export struct StackAlignRadioList { ForEach(this.radioList, (item, index) => { StackAlignRadioListItem({ textName: item, groupName: this.groupName, isChecked: index === 0 ? true : false }) .margin({ right: MARGIN_FONT_SIZE_SPACE.COMMON_MARGIN }) - }) + }, item => JSON.stringify(item)) } .width(ALL_PERCENT) - .height(MARGIN_FONT_SIZE_SPACE.SEVENTH_MARGIN) + .height(ALL_PERCENT) } .width(ALL_PERCENT) .justifyContent(FlexAlign.Start) @@ -56,11 +56,11 @@ export struct StackAlignRadioList { @Component export struct StackAlignRadioListItem { - @Consume message: string; private textName: string; private groupName: string; private isChecked: boolean; @Consume currentStackAlignContent: Alignment; + @Consume message: string; build() { Row() { @@ -68,23 +68,27 @@ export struct StackAlignRadioListItem { .checked(this.isChecked) .height((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) .width((MARGIN_FONT_SIZE_SPACE.SECOND_MARGIN)) - .onChange(() => { - this.message = this.textName; + .onClick(() => { switch (this.textName) { case ATTRIBUTE.TOP_START: this.currentStackAlignContent = Alignment.TopStart; + this.message = ATTRIBUTE.TOP_START; break; case ATTRIBUTE.TOP_END: this.currentStackAlignContent = Alignment.TopEnd; + this.message = ATTRIBUTE.TOP_END; break; case ATTRIBUTE.CENTER: this.currentStackAlignContent = Alignment.Center; + this.message = ATTRIBUTE.CENTER; break; case ATTRIBUTE.BOTTOM_START: this.currentStackAlignContent = Alignment.BottomStart; + this.message = ATTRIBUTE.BOTTOM_START; break; default: this.currentStackAlignContent = Alignment.BottomEnd; + this.message = ATTRIBUTE.BOTTOM_END; break; } }) diff --git a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets index 4ce6f12b95ca76985769cd8ce32dcc21217d8233..c10b547861c5afbe6734823b05b06494932fcb38 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets +++ b/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets @@ -27,9 +27,8 @@ export struct StackComponent { build() { Column() { - Stack({ alignContent: this.currentStackAlignContent }) { - Text("") + Text('') .width(ALL_PERCENT) .height(ALL_PERCENT) .fontSize(MARGIN_FONT_SIZE_SPACE.FOURTH_MARGIN) @@ -46,11 +45,11 @@ export struct StackComponent { .width(ALL_PERCENT) .height(SHOW_LIST_HEIGHT_PERCENT.STACK_SHOW_LIST_HEIGHT) // set align in stack - StackAlignRadioList().margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) + StackAlignRadioList() + .margin({ top: MARGIN_FONT_SIZE_SPACE.EIGHTH_MARGIN }) } .layoutWeight(1) .height(ALL_PERCENT) .width(ALL_PERCENT) - } } diff --git a/ETSUI/OHLayoutAlign/entry/src/main/module.json5 b/ETSUI/OHLayoutAlign/entry/src/main/module.json5 index 0e288c05b41ef026b9f802f6c848bd5301ebc785..82ec596813a9f4a6ef659055a88c85a026c1d39b 100644 --- a/ETSUI/OHLayoutAlign/entry/src/main/module.json5 +++ b/ETSUI/OHLayoutAlign/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", @@ -20,6 +24,7 @@ "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", + "orientation": "portrait", "visible": true, "skills": [ { diff --git a/ETSUI/OHLayoutAlign/package.json b/ETSUI/OHLayoutAlign/package.json index 5fd132ed9dfe110c447eb3dcf2b3742915515f4b..72ae3b8e2b8d603df16553918745c0f9ffbd2ea2 100644 --- a/ETSUI/OHLayoutAlign/package.json +++ b/ETSUI/OHLayoutAlign/package.json @@ -11,8 +11,8 @@ "repository":{}, "version":"1.0.0", "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "@ohos/hypium":"1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } \ No newline at end of file diff --git a/ETSUI/RankingDemo/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/RankingDemo/entry/src/main/ets/entryability/EntryAbility.ts index 050f87783728cb6dcc29df60f5a2302799da620f..74885804398ed1c8bf07773cd195439a0eccb9e6 100644 --- a/ETSUI/RankingDemo/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/RankingDemo/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,7 +14,7 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import Ability from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' export default class EntryAbility extends Ability { diff --git a/ETSUI/RankingDemo/entry/src/main/ets/pages/RankPage.ets b/ETSUI/RankingDemo/entry/src/main/ets/pages/RankPage.ets index a6e466762a244fc764dec3cd66c8d5ea21e272eb..33e0d62b7150d5446bd23d408fcb9364e29cd091 100644 --- a/ETSUI/RankingDemo/entry/src/main/ets/pages/RankPage.ets +++ b/ETSUI/RankingDemo/entry/src/main/ets/pages/RankPage.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import prompt from '@ohos.promptAction'; import { RankViewModel } from '../viewmodel/RankViewModel'; import { RankData } from '../common/bean/RankData'; import { ListHeaderComponent } from '../view/ListHeaderComponent'; @@ -52,8 +52,12 @@ struct RankPage { } onBackPress() { + let options = { + message: $r('app.string.prompt_text'), + duration: TIME + } if (this.isShowToast()) { - prompt.showToast({ message: $r('app.string.prompt_text'), duration: TIME }); + prompt.showToast(options); this.clickBackTimeRecord = new Date().getTime(); return true; } @@ -70,11 +74,16 @@ struct RankPage { TitleComponent({ isRefreshData: $isSwitchDataSource, title: TITLE }) // The head style of List component. ListHeaderComponent({ - paddingValue: { left: Style.RANK_PADDING, - right: Style.RANK_PADDING }, + paddingValue: { + left: Style.RANK_PADDING, + right: Style.RANK_PADDING + }, widthValue: Style.CONTENT_WIDTH - }).margin({ top: Style.HEADER_MARGIN_TOP, - bottom: Style.HEADER_MARGIN_BOTTOM }) + }) + .margin({ + top: Style.HEADER_MARGIN_TOP, + bottom: Style.HEADER_MARGIN_BOTTOM + }) // The style of List component. this.RankList(Style.CONTENT_WIDTH) } @@ -93,14 +102,16 @@ struct RankPage { isSwitchDataSource: this.isSwitchDataSource }) } - }, (item, index) => item.id) + }, item => JSON.stringify(item)) } .width(WEIGHT) .height(Style.LIST_HEIGHT) .divider({ strokeWidth: Style.STROKE_WIDTH }) } - .padding({ left: Style.RANK_PADDING, - right: Style.RANK_PADDING }) + .padding({ + left: Style.RANK_PADDING, + right: Style.RANK_PADDING + }) .borderRadius(Style.BORDER_RADIUS) .width(widthValue) .alignItems(HorizontalAlign.Center) diff --git a/ETSUI/RankingDemo/entry/src/main/ets/view/TitleComponent.ets b/ETSUI/RankingDemo/entry/src/main/ets/view/TitleComponent.ets index 3a6ecb8b7f8e998f07882fc223fd00d020f7f80d..3d15432e077c91d742ac9d58c7fc32ada8961a44 100644 --- a/ETSUI/RankingDemo/entry/src/main/ets/view/TitleComponent.ets +++ b/ETSUI/RankingDemo/entry/src/main/ets/view/TitleComponent.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import AppContext from '@ohos.application.context'; +import AppContext from '@ohos.app.ability.common'; import { FontSize, TitleBarStyle, WEIGHT } from '../common/constants/Constants'; @Component @@ -29,7 +29,7 @@ export struct TitleComponent { .width(TitleBarStyle.IMAGE_BACK_SIZE) .margin({ right: TitleBarStyle.IMAGE_BACK_MARGIN_RIGHT }) .onClick(() => { - let handler = getContext(this) as AppContext.AbilityContext; + let handler = getContext(this) as AppContext.UIAbilityContext; handler.terminateSelf(); }) Text(this.title) diff --git a/ETSUI/RankingDemo/entry/src/main/module.json5 b/ETSUI/RankingDemo/entry/src/main/module.json5 index 4277a83625ecc055fc275776bb26af28b8b252c6..609cd388c676a4ffdbbade936ca29e569bc74a9f 100644 --- a/ETSUI/RankingDemo/entry/src/main/module.json5 +++ b/ETSUI/RankingDemo/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "entryAbility", diff --git a/ETSUI/RankingDemo/package.json b/ETSUI/RankingDemo/package.json index bf26b8adcebd5ff1803d76c41165795fab53c5f5..c799079b29e6eecb4900578a96310c267a06086f 100644 --- a/ETSUI/RankingDemo/package.json +++ b/ETSUI/RankingDemo/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"ranking_demo", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } -} \ No newline at end of file + "license": "ISC", + "devDependencies": {}, + "name": "ranking_demo", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } +} diff --git a/ETSUI/SetAppFontSize/build-profile.json5 b/ETSUI/SetAppFontSize/build-profile.json5 index fc53829be062f3a883f815802e6039c733ebb352..7d18441853f8bbde636911803a4b3f3d5668cd97 100644 --- a/ETSUI/SetAppFontSize/build-profile.json5 +++ b/ETSUI/SetAppFontSize/build-profile.json5 @@ -5,7 +5,7 @@ "products": [ { "name": "default", - "signingConfig": "default", + "signingConfig": "default" } ] }, diff --git a/ETSUI/SetAppFontSize/entry/src/main/ets/entryability/EntryAbility.ets b/ETSUI/SetAppFontSize/entry/src/main/ets/entryability/EntryAbility.ets index 73b7d27374472345483f4794b2d861fcd14a6628..096993b25163234e565327f6ebfd97819e0e4d88 100644 --- a/ETSUI/SetAppFontSize/entry/src/main/ets/entryability/EntryAbility.ets +++ b/ETSUI/SetAppFontSize/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import CommonConstants from '../common/constants/CommonConstants'; import Logger from '../common/utils/Logger'; import PreferencesUtil from '../common/database/Preferencesutil'; @@ -23,7 +23,7 @@ const TAG = '[entryAbility]'; /** * Lift cycle management of Ability. */ -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { Logger.info(TAG, 'onCreate'); globalThis.abilityWant = want; diff --git a/ETSUI/SetAppFontSize/entry/src/main/ets/pages/HomePage.ets b/ETSUI/SetAppFontSize/entry/src/main/ets/pages/HomePage.ets index 94f04fd3790850ce3785834ccca7a85527b3f295..6a13d399eed8a3d805cc2734e6f8a85f2312a9cf 100644 --- a/ETSUI/SetAppFontSize/entry/src/main/ets/pages/HomePage.ets +++ b/ETSUI/SetAppFontSize/entry/src/main/ets/pages/HomePage.ets @@ -47,7 +47,8 @@ struct HomePage { Row() { SettingItemComponent({ setting: this.settingArr[CommonConstants.DISPLAY_INDEX], - changeFontSize: this.changeFontSize + changeFontSize: this.changeFontSize, + itemClick: () => {} }) } .blockBackground(StyleConstants.BLOCK_TOP_MARGIN_FIRST_PERCENT) @@ -55,7 +56,8 @@ struct HomePage { Row() { SettingItemComponent({ setting: this.settingArr[CommonConstants.VOICE_INDEX], - changeFontSize: this.changeFontSize + changeFontSize: this.changeFontSize, + itemClick: () => {} }) } .blockBackground(StyleConstants.BLOCK_TOP_MARGIN_SECOND_PERCENT) @@ -76,7 +78,11 @@ struct HomePage { ListItem() { SettingItemComponent({ setting: item, changeFontSize: this.changeFontSize, itemClick: () => { if (index === CommonConstants.SET_FONT_INDEX) { - router.push({ url: CommonConstants.SET_URL }); + router.pushUrl({ + url: CommonConstants.SET_URL + }).catch((error) => { + Logger.info(TAG, 'HomePage push error' + JSON.stringify(error)); + }); } } }) } diff --git a/ETSUI/SetAppFontSize/entry/src/main/ets/view/TitleBarComponent.ets b/ETSUI/SetAppFontSize/entry/src/main/ets/view/TitleBarComponent.ets index 06a84494f1774f086cc5c53266b01865dc2bdb2e..026ca961205581a354a29312bc3681197bc3fb8d 100644 --- a/ETSUI/SetAppFontSize/entry/src/main/ets/view/TitleBarComponent.ets +++ b/ETSUI/SetAppFontSize/entry/src/main/ets/view/TitleBarComponent.ets @@ -30,7 +30,7 @@ export default struct TitleBarComponent { Image($r('app.media.ic_public_back')) .height($r('app.float.title_ic_size')) .width($r('app.float.title_ic_size')) - .padding($r('app.float.title_ic_padding')) + .margin({ right: $r('app.float.title_ic_margin') }) .onClick(() => { router.back(); }) diff --git a/ETSUI/SetAppFontSize/entry/src/main/module.json5 b/ETSUI/SetAppFontSize/entry/src/main/module.json5 index 8d7910c562e10693ce422333a18f8a7e1de7dd48..6c23de3e831f5e9d705713ef54d6429ac8f2070b 100644 --- a/ETSUI/SetAppFontSize/entry/src/main/module.json5 +++ b/ETSUI/SetAppFontSize/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/SetAppFontSize/entry/src/main/resources/base/element/float.json b/ETSUI/SetAppFontSize/entry/src/main/resources/base/element/float.json index e4bae108735c35efd60b669e275316d2545539b9..a6f431d26c5855adf12b0e677e4c707c10e5dbbd 100644 --- a/ETSUI/SetAppFontSize/entry/src/main/resources/base/element/float.json +++ b/ETSUI/SetAppFontSize/entry/src/main/resources/base/element/float.json @@ -2,11 +2,11 @@ "float": [ { "name": "title_ic_size", - "value": "40vp" + "value": "24vp" }, { - "name": "title_ic_padding", - "value": "8vp" + "name": "title_ic_margin", + "value": "4vp" }, { "name": "title_padding_left", diff --git a/ETSUI/SetAppFontSize/package.json b/ETSUI/SetAppFontSize/package.json index c52c8b471760f47b77fcc1b0c40611523ac2d843..7f524722f1ed5d1b057d791f98b22012c7b7f6ff 100644 --- a/ETSUI/SetAppFontSize/package.json +++ b/ETSUI/SetAppFontSize/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "setappfontsize", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1-rc27", - "@ohos/hvigor": "1.3.1-rc27" - } + "license": "ISC", + "devDependencies": {}, + "name": "setappfontsize", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/ETSUI/SliderExample/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/SliderExample/entry/src/main/ets/entryability/EntryAbility.ts index 5b82fe1d26691c31aca61a6fe245a7152bcf1ed8..9b7c69887fb80e3ad521e43ab555be8d4fa5f325 100644 --- a/ETSUI/SliderExample/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/SliderExample/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,7 +14,7 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import Ability from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' export default class EntryAbility extends Ability { diff --git a/ETSUI/SliderExample/entry/src/main/ets/pages/SliderPage.ets b/ETSUI/SliderExample/entry/src/main/ets/pages/SliderPage.ets index ba29e0a5fc115b65ac6291036a6f6fb4f5cfb6ce..7c03890f31f920208164bf6b39eaa80c48c80411 100644 --- a/ETSUI/SliderExample/entry/src/main/ets/pages/SliderPage.ets +++ b/ETSUI/SliderExample/entry/src/main/ets/pages/SliderPage.ets @@ -69,8 +69,11 @@ struct SliderPage { step: SliderScale.STEP, style: SliderStyle.InSet } - }).margin({ bottom: Constants.PANEL_MARGIN_BOTTOM, - top: Constants.PANEL_MARGIN_TOP }); + }) + .margin({ + bottom: Constants.PANEL_MARGIN_BOTTOM, + top: Constants.PANEL_MARGIN_TOP + }); } .justifyContent(FlexAlign.End) .height(Constants.PERCENTAGE_100) diff --git a/ETSUI/SliderExample/entry/src/main/module.json5 b/ETSUI/SliderExample/entry/src/main/module.json5 index de5498e33051616668d8443e52dbdd41e93eb7e4..1d686a50c087ac9dad221ddc0ac80ed3e5bd8662 100644 --- a/ETSUI/SliderExample/entry/src/main/module.json5 +++ b/ETSUI/SliderExample/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "entryAbility", diff --git a/ETSUI/SliderExample/package.json b/ETSUI/SliderExample/package.json index 77ff1fa3ab8fe10cf4cbfdfeed0fdc061641ce7d..d55606fb455dbf0fe10018874477fc858222ba52 100644 --- a/ETSUI/SliderExample/package.json +++ b/ETSUI/SliderExample/package.json @@ -12,7 +12,7 @@ "version": "1.0.0", "dependencies": { "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } diff --git a/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets b/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets index 8f40b8306f4431fc21b8eb3ed5ab8c549b59f996..e09d2e166f382daccd18b68838dd5b8e8ff164df 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets @@ -102,4 +102,24 @@ export const SHARE_ITEM_DURATION = 1000; /** * Share page url. */ -export const SHARE_PAGE_URL = 'pages/SharePage'; \ No newline at end of file +export const SHARE_PAGE_URL = 'pages/SharePage'; + +/** + * Border radius of row. + */ +export const BORDER_RADIUS = 32; + +/** + * Domain of log. + */ +export const DOMAIN = 0xFF00; + +/** + * Prefix of log. + */ +export const PREFIX = '[ReadingRecorder]'; + +/** + * Format of log. + */ +export const FORMAT = `%{public}s, %{public}s`; \ No newline at end of file diff --git a/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets b/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets index d4475d59457d2b3fb0d0335646c1a409a68bd5ce..a9ac6b91b5aec4c8762cc93f4bd4d114b16e6d53 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets +++ b/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import ctx from '@ohos.application.context'; +import ctx from '@ohos.app.ability.common'; var context = getContext(this) as ctx.Context; diff --git a/ETSUI/TransitionAnimation/entry/src/main/ets/entryAbility/EntryAbility.ts b/ETSUI/TransitionAnimation/entry/src/main/ets/entryAbility/EntryAbility.ts index 23a7d273ee37576b3ebcb03f539d6feae9ba0614..71b596f9f5d5112ec8ad31d70e92d2c7fea80ee2 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/ets/entryAbility/EntryAbility.ts +++ b/ETSUI/TransitionAnimation/entry/src/main/ets/entryAbility/EntryAbility.ts @@ -13,10 +13,10 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; import display from '@ohos.display'; -export default class MainAbility extends Ability { +export default class MainAbility extends UIAbility { onCreate(want) { globalThis.abilityWant = want; } diff --git a/ETSUI/TransitionAnimation/entry/src/main/ets/pages/Index.ets b/ETSUI/TransitionAnimation/entry/src/main/ets/pages/Index.ets index 5ca0836b216fb6ded1bd6b26dc79f7fe6c50c7cf..0d7b2d336081c9656716538fd50a1648856bd4e9 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/ets/pages/Index.ets +++ b/ETSUI/TransitionAnimation/entry/src/main/ets/pages/Index.ets @@ -14,8 +14,17 @@ */ import router from '@ohos.router'; -import { INDEX_ANIMATION_MODE, FULL_LENGTH, DEFAULT_LAYOUT_WEIGHT } from '../common/constants/CommonConstants'; +import { + INDEX_ANIMATION_MODE, + FULL_LENGTH, + DEFAULT_LAYOUT_WEIGHT, + BORDER_RADIUS, + DOMAIN, + PREFIX, + FORMAT +} from '../common/constants/CommonConstants'; import DimensionUtil from '../common/utils/DimensionUtil'; +import hilog from '@ohos.hilog'; @Entry @Component @@ -35,17 +44,21 @@ struct Index { Scroll() { Column() { ForEach(INDEX_ANIMATION_MODE, ({ imgRes , url }) => { - Button() + Row() .backgroundImage(imgRes) .backgroundImageSize(ImageSize.Cover) .backgroundColor($r('app.color.trans_parent')) .height(DimensionUtil.getVp($r('app.float.main_page_body_height'))) .margin({ bottom: DimensionUtil.getVp($r('app.float.main_page_body_margin')) }) .width(FULL_LENGTH) + .borderRadius(BORDER_RADIUS) .onClick(() => { - router.push({ url: url }); + router.pushUrl({ url: url }) + .catch(err => { + hilog.error(DOMAIN, PREFIX, FORMAT, err); + }); }) - }, item => item.toString()) + }, item => JSON.stringify(item)) } } .layoutWeight(DEFAULT_LAYOUT_WEIGHT) diff --git a/ETSUI/TransitionAnimation/entry/src/main/ets/pages/ShareItem.ets b/ETSUI/TransitionAnimation/entry/src/main/ets/pages/ShareItem.ets index aea05d8eaf96b0b9e598bc59fc7573e757cce3df..949a8ade95da389446c3e29d8a99f587ecabecd5 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/ets/pages/ShareItem.ets +++ b/ETSUI/TransitionAnimation/entry/src/main/ets/pages/ShareItem.ets @@ -20,9 +20,13 @@ import { SHARE_TRANSITION_ID, SHARE_ITEM_ANIMATION_DELAY, SHARE_PAGE_URL, - FULL_LENGTH + FULL_LENGTH, + DOMAIN, + PREFIX, + FORMAT } from '../common/constants/CommonConstants'; import DimensionUtil from '../common/utils/DimensionUtil'; +import hilog from '@ohos.hilog'; @Entry @Component @@ -40,7 +44,10 @@ struct ShareItem { delay: SHARE_ITEM_ANIMATION_DELAY }) .onClick(() => { - router.push({ url: SHARE_PAGE_URL }); + router.pushUrl({ url: SHARE_PAGE_URL }) + .catch(err => { + hilog.error(DOMAIN, PREFIX, FORMAT, err); + }); }) Text($r('app.string.Share_Item_hint')) .width(FULL_LENGTH) diff --git a/ETSUI/TransitionAnimation/entry/src/main/module.json5 b/ETSUI/TransitionAnimation/entry/src/main/module.json5 index 92941b536d33eeae0711b792d120a72ba7de20ea..4754e5251da5e9e76d79d8d9a9c3cff769bee0ed 100644 --- a/ETSUI/TransitionAnimation/entry/src/main/module.json5 +++ b/ETSUI/TransitionAnimation/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "MainAbility", diff --git a/ETSUI/TransitionAnimation/package.json b/ETSUI/TransitionAnimation/package.json index 107b91c6df6dbfde541da7cb6d674e3fd10e9031..5072f4dcd70ef10c9f723b78b46980d07963119c 100644 --- a/ETSUI/TransitionAnimation/package.json +++ b/ETSUI/TransitionAnimation/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "transitionanimationets", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "transitionanimationets", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/ETSUI/WebComponent/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/WebComponent/entry/src/main/ets/entryability/EntryAbility.ts index 258fd9968d37fa24d06e1fc80ef16786a8a23cbd..7b0dd84958e7c90f2459b317ed8d5a0555e2e1f3 100644 --- a/ETSUI/WebComponent/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/WebComponent/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,8 +1,8 @@ +import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' -import Window from '@ohos.window' +import Window from '@ohos.window'; -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/ETSUI/WebComponent/entry/src/main/ets/pages/MainPage.ets b/ETSUI/WebComponent/entry/src/main/ets/pages/MainPage.ets index d3f038cb4473822418c0cd924feba9fd91eb20c2..ba272fd955144108c4aa3f0fe031b314bcadac82 100644 --- a/ETSUI/WebComponent/entry/src/main/ets/pages/MainPage.ets +++ b/ETSUI/WebComponent/entry/src/main/ets/pages/MainPage.ets @@ -31,6 +31,7 @@ struct MainPage { build() { Column() { Image($r('app.media.background')) + .width(MainConstant.FULL_HEIGHT) .height(MainConstant.IMAGE_HEIGHT) Navigator({ target: WEB_PAGE_URI, type: NavigationType.Push }) { Button($r('app.string.loadLocalH5')) diff --git a/ETSUI/WebComponent/entry/src/main/ets/pages/WebPage.ets b/ETSUI/WebComponent/entry/src/main/ets/pages/WebPage.ets index 68d635fb1a3187e91192c104ce6820e812d1329f..c87032355e7e3f003966355a71aae963710b190f 100644 --- a/ETSUI/WebComponent/entry/src/main/ets/pages/WebPage.ets +++ b/ETSUI/WebComponent/entry/src/main/ets/pages/WebPage.ets @@ -14,17 +14,19 @@ */ import router from '@ohos.router'; +import web_webview from '@ohos.web.webview'; import { WebConstant, MainConstant, WEB_ALERT_DIALOG_TEXT_VALUE } from '../common/Constant'; @Entry @Component struct WebPage { - webViewController: WebController = new WebController(); + webController: web_webview.WebviewController = new web_webview.WebviewController(); @State params: object = router.getParams(); build() { Stack({ alignContent: Alignment.TopStart }) { Image($r('app.media.background')) + .width(MainConstant.FULL_HEIGHT) .height(MainConstant.IMAGE_HEIGHT) Row() { Column() { @@ -46,7 +48,7 @@ struct WebPage { }.height(WebConstant.TOP_ROW_HEIGHT) // web组件加载本地H5 - Web({ src: this.params['path'], controller: this.webViewController }) + Web({ src: this.params['path'], controller: this.webController }) .zoomAccess(false) .width(WebConstant.WIDTH) .aspectRatio(1) @@ -95,7 +97,7 @@ struct WebPage { .backgroundColor($r('app.color.blue')) .borderRadius(WebConstant.BUTTON_BORDER_RADIUS) .onClick(() => { - this.webViewController.runJavaScript({ script: 'startDraw()'}); + this.webController.runJavaScript('startDraw()'); }) } .width(WebConstant.FULL_WIDTH) diff --git a/ETSUI/WebComponent/entry/src/main/module.json5 b/ETSUI/WebComponent/entry/src/main/module.json5 index dcad1254c6a450543cde1539299028641cfb6b19..06fa6f5b2fbd882332d2edb65567b6570c11aeea 100644 --- a/ETSUI/WebComponent/entry/src/main/module.json5 +++ b/ETSUI/WebComponent/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "requestPermissions": [ { "name": "ohos.permission.INTERNET" diff --git a/ETSUI/WebComponent/entry/src/main/resources/rawfile/js/index.js b/ETSUI/WebComponent/entry/src/main/resources/rawfile/js/index.js index 8682e4b6c8af40b24e8272be0a4fd06d3a79a866..3ac79cbb2858212c9dbbe9a3d4db6e67bf98c321 100644 --- a/ETSUI/WebComponent/entry/src/main/resources/rawfile/js/index.js +++ b/ETSUI/WebComponent/entry/src/main/resources/rawfile/js/index.js @@ -34,7 +34,7 @@ let prizesPosition = 0; // 转到哪个位置 for (let j = 0;j < prizesImg.length; j++) { prizesImg[j].src = arrBigImg[j]; } -let speed = 500; // 转圈速度,值越大越慢 +let speed = 500; //转圈速度,值越大越慢 // 旋转函数 function roll() { diff --git a/ETSUI/WebComponent/package.json b/ETSUI/WebComponent/package.json index c6852abbbf79c9a966a423464f6039a60ee3a460..ae4638a3487a54dba23f64b64de2d384fe550089 100644 --- a/ETSUI/WebComponent/package.json +++ b/ETSUI/WebComponent/package.json @@ -1,18 +1,18 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "webcomponent", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.3", - "@ohos/hvigor-ohos-plugin": "1.3.1", - "@ohos/hvigor": "1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "webcomponent", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/ETSUI/WebCookie/LICENSE b/ETSUI/WebCookie/LICENSE index 261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 100644 --- a/ETSUI/WebCookie/LICENSE +++ b/ETSUI/WebCookie/LICENSE @@ -1,201 +1,78 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] + Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. 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 + 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets b/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets index 2d7483a70e830515a29e664971308a8d246f32b1..4f50c2c75c231394aa41411a39f5ce8d0a37319f 100644 --- a/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets +++ b/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets @@ -110,16 +110,6 @@ export const NAVIGATOR_MARGIN_TOP = '1.7%'; */ export const NAVIGATOR_MARGIN_LEFT = '10%'; -/** - * top margin of page title - */ -export const PAGE_TITLE_MARGIN_TOP = '4.2%'; - -/** - * bottom margin of page title - */ -export const PAGE_TITLE_MARGIN_BOTTOM = '3.7%'; - /** * deeper font weight than normal font */ @@ -128,22 +118,17 @@ export const FONT_WEIGHT_DEEPER = 500; /** * top margin of app title */ -export const APP_TITLE_MARGIN_TOP = '1.7%'; +export const APP_TITLE_MARGIN_TOP = '15vp'; /** * left margin of app title */ -export const APP_TITLE_MARGIN_LEFT = '15%'; - -/** - * bottom margin of row - */ -export const ROW_MARGIN_BOTTOM = '12%'; +export const APP_TITLE_MARGIN_LEFT = '26vp'; /** * bottom margin of web */ -export const WEB_MARGIN_BOTTOM = '12%'; +export const WEB_MARGIN_BOTTOM = '90vp'; /** * type of cookie Operation diff --git a/ETSUI/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts b/ETSUI/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts index 1c121b269e6632d9dd52caee5e07d8295af76278..5401503a51cc7535e4217f0e57dbc39bb45ba13d 100644 --- a/ETSUI/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ETSUI/WebCookie/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,66 +1,41 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability'; -import Window from '@ohos.window'; +import window from '@ohos.window'; -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); } onDestroy() { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - onWindowStageCreate(windowStage: Window.WindowStage) { + onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/WebIndex', (err, data) => { if (err.code) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); } onWindowStageDestroy() { // Main window is destroyed, release UI related resources - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground() { // Ability has brought to foreground - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground() { // Ability has back to background - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } } \ No newline at end of file diff --git a/ETSUI/WebCookie/entry/src/main/ets/pages/Verify.ets b/ETSUI/WebCookie/entry/src/main/ets/pages/Verify.ets index 8c653e682dd865e2896756144fcd6a9c7848f949..ef61aafadfd87021ee0337ac3152cefed93a1f26 100644 --- a/ETSUI/WebCookie/entry/src/main/ets/pages/Verify.ets +++ b/ETSUI/WebCookie/entry/src/main/ets/pages/Verify.ets @@ -30,8 +30,6 @@ import { PAGE_TITLE_WIDTH, NAVIGATOR_MARGIN_TOP, NAVIGATOR_MARGIN_LEFT, - PAGE_TITLE_MARGIN_TOP, - PAGE_TITLE_MARGIN_BOTTOM, FONT_WEIGHT_DEEPER } from '../common/constants/CommonConstant'; @@ -74,7 +72,7 @@ struct Verify { .fontColor($r('app.color.title_black')) .width(PAGE_TITLE_WIDTH) .height(PAGE_TITLE_HEIGHT) - .margin({ top: PAGE_TITLE_MARGIN_TOP, bottom: PAGE_TITLE_MARGIN_BOTTOM }) + .margin({ top: $r('app.float.page_title_margin_top'), bottom: $r('app.float.page_title_margin_bottom') }) Web({ src: USER_ABOUT_URL, @@ -86,14 +84,14 @@ struct Verify { .javaScriptAccess(true) .onPageEnd(() => { try { - if (this.isRedirect) { + let originCookie = web_webview.WebCookieManager.getCookie(USER_ABOUT_URL); + if (originCookie === '' || this.isRedirect) { return; } this.isRedirect = true; - let originCookie = web_webview.WebCookieManager.getCookie(USER_ABOUT_URL); showDialog(originCookie); } catch (error) { - showDialog(`EorrorCode:${error.code},Message:${error.message}`); + showDialog(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) } diff --git a/ETSUI/WebCookie/entry/src/main/ets/pages/WebIndex.ets b/ETSUI/WebCookie/entry/src/main/ets/pages/WebIndex.ets index eb69096846430070a77fb556b75f0be663fff905..9302c45a858f521d41da8a606af7b2c30129f099 100644 --- a/ETSUI/WebCookie/entry/src/main/ets/pages/WebIndex.ets +++ b/ETSUI/WebCookie/entry/src/main/ets/pages/WebIndex.ets @@ -24,13 +24,10 @@ import { WEB_WIDTH, PAGE_TITLE_HEIGHT, PAGE_TITLE_WIDTH, - PAGE_TITLE_MARGIN_TOP, - PAGE_TITLE_MARGIN_BOTTOM, FONT_WEIGHT_DEEPER, APP_TITLE_MARGIN_TOP, APP_TITLE_MARGIN_LEFT, WEB_MARGIN_BOTTOM, - ROW_MARGIN_BOTTOM, CookieOperation } from '../common/constants/CommonConstant'; import { LinkButton } from '../view/LinkButton' @@ -59,7 +56,7 @@ struct WebIndex { .fontColor($r('app.color.title_black')) .width(PAGE_TITLE_WIDTH) .height(PAGE_TITLE_HEIGHT) - .margin({ top: PAGE_TITLE_MARGIN_TOP, bottom: PAGE_TITLE_MARGIN_BOTTOM }) + .margin({ top: $r('app.float.page_title_margin_top'), bottom: $r('app.float.page_title_margin_bottom') }) Web({ src: USER_CENTER_URL, @@ -79,9 +76,7 @@ struct WebIndex { LinkButton({ buttonType: CookieOperation.DELETE_COOKIE, isNeedDivider: true }) LinkButton({ buttonType: CookieOperation.VERIFY_COOKIE, isNeedDivider: false }) } - .align(Alignment.End) .width(WEB_WIDTH) - .margin({ bottom: ROW_MARGIN_BOTTOM }) } .backgroundColor($r('app.color.page_background_grey')) .width(FULL_WIDTH) diff --git a/ETSUI/WebCookie/entry/src/main/ets/view/LinkButton.ets b/ETSUI/WebCookie/entry/src/main/ets/view/LinkButton.ets index a34727c42d8945514fb2a57991f59f3fe33e117d..e9253ebad4bca098c5796bdebe9dc3846f6be218 100644 --- a/ETSUI/WebCookie/entry/src/main/ets/view/LinkButton.ets +++ b/ETSUI/WebCookie/entry/src/main/ets/view/LinkButton.ets @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import web_webview from '@ohos.web.webview'; import router from '@ohos.router'; import { showDialog } from '../common/utils/DialogUtil'; @@ -61,15 +60,15 @@ export struct LinkButton { let originCookie = web_webview.WebCookieManager.getCookie(USER_CENTER_URL); showDialog(originCookie); } catch (error) { - showDialog(`EorrorCode:${error.code},Message:${error.message}`); + showDialog(`ErrorCode: ${error.code}, Message: ${error.message}`); } break; case CookieOperation.SET_COOKIE: try { - web_webview.WebCookieManager.setCookie(USER_ABOUT_URL, 'info=测试cookie写入') + web_webview.WebCookieManager.setCookie(USER_ABOUT_URL, 'info=测试cookie写入'); showDialog($r('app.string.write_success')); } catch (error) { - showDialog($r('app.string.write_fail')); + showDialog(`ErrorCode: ${error.code}, Message: ${error.message}`); } break; case CookieOperation.DELETE_COOKIE: @@ -78,8 +77,10 @@ export struct LinkButton { showDialog(deleteMessage); break; case CookieOperation.VERIFY_COOKIE: - router.push({ + router.pushUrl({ url: PAGE_VERIFY + }).catch(err => { + console.error('[LinkButton] push url fail: ' + err); }); break; default: diff --git a/ETSUI/WebCookie/entry/src/main/module.json5 b/ETSUI/WebCookie/entry/src/main/module.json5 index 0c611438d62d6b638f03a8bb085998fa2259cf76..9c47b9c03d7f88195bf6e458eea523dcbc78664c 100644 --- a/ETSUI/WebCookie/entry/src/main/module.json5 +++ b/ETSUI/WebCookie/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/ETSUI/WebCookie/entry/src/main/resources/base/element/float.json b/ETSUI/WebCookie/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..c6be08bb6de0509f224ceae44eab11eaf7c783af --- /dev/null +++ b/ETSUI/WebCookie/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float": [ + { + "name": "page_title_margin_top", + "value": "48vp" + }, + { + "name": "page_title_margin_bottom", + "value": "28vp" + } + ] +} \ No newline at end of file diff --git a/ETSUI/WebCookie/package.json b/ETSUI/WebCookie/package.json index e07870ba80838cb6260694ecdbb734033fe0c130..fb8d5563ef60f21a1a43b98969635fe2c07b6dac 100644 --- a/ETSUI/WebCookie/package.json +++ b/ETSUI/WebCookie/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"webcookie", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "webcookie", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } \ No newline at end of file diff --git a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/entryability/EntryAbility.ts b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/entryability/EntryAbility.ts index f6b8bc1784d8ef6e67c98c5593a99eb542038b92..6bb8555f84a8a7f31f4bd5d3a34d8abcf981a25b 100644 --- a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/entryability/EntryAbility.ts +++ b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,8 +1,8 @@ +import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' import Window from '@ohos.window' -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets index 0e1b70ad497c0022f61abdd060c7fa15edb8c1f9..877a3cd2d781946cd078c1490533f865cb8da720 100644 --- a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets +++ b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets @@ -68,7 +68,7 @@ struct TaskPage { @State taskList: Array = TASK_LIST; taskClickAction() { - router.push({ + router.pushUrl({ url: 'pages/TaskDetailPage' }); } diff --git a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/module.json5 b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/module.json5 index c70b7cf2cbb974b877f0b02144e394e2a148f0ec..8e4a7cd2cf4aa8c255bbca6d3636b390f6afa09a 100644 --- a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/module.json5 +++ b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/module.json5 @@ -10,6 +10,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/resources/base/media/right_grey.png b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/resources/base/media/right_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..bebf1f6df388728a4f1c251490db661e52386811 Binary files /dev/null and b/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/resources/base/media/right_grey.png differ diff --git a/EfficiencyEnhancementKit/SuperVisualSample/package.json b/EfficiencyEnhancementKit/SuperVisualSample/package.json index db2fe96aaf04d314a9b191f2d2604d55c2a1c7b1..ac50b1b8f061d03dc06a233d40150c928b62a04d 100644 --- a/EfficiencyEnhancementKit/SuperVisualSample/package.json +++ b/EfficiencyEnhancementKit/SuperVisualSample/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"supervisualsample", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "supervisualsample", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/DataUtils.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/DataUtils.ets index de43b1486a03d7206db97a943294ab2b18e4742d..2f2c49e2bdf8a5382c67b41c343534407ead07f4 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/DataUtils.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/DataUtils.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import promptAction from '@ohos.promptAction'; import { SERVER, GET_NEWS_TYPE, @@ -34,7 +34,7 @@ import { httpRequestGet } from '../utils/HttpUtil'; export async function getTabData(currentPage: number, pageSize: number, currentIndex: number, callback) { currentPage = currentPage + GET_TAB_DATA_CURRENT_PAGE; if (currentPage > pageSize) { - prompt.showToast({ message: $r('app.string.prompt_message') }); + promptAction.showToast({ message: $r('app.string.prompt_message') }); currentPage = currentPage - GET_TAB_DATA_CURRENT_PAGE; } let newsPageData = []; diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullDownRefresh.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullDownRefresh.ets index ac37d291115b0de235889c8df381268aba57a821..5ff405ebd1d66f3a1a51dcf63b470ac59815fd5a 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullDownRefresh.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullDownRefresh.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import promptAction from '@ohos.promptAction'; import { getTabData } from './DataUtils'; import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; import { @@ -95,7 +95,7 @@ export function touchUpPullRefresh() { closeRefresh.call(self, true); }, onFail: (msg) => { - prompt.showToast({ message: msg }); + promptAction.showToast({ message: msg }); closeRefresh.call(self, false); } }); diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullUpLoadMore.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullUpLoadMore.ets index 562b19cd9b96c41fd3459959e5082fc7928d0208..1b1326a4d3135c69da06f522115b1e36899ae1c6 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullUpLoadMore.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/utils/PullUpLoadMore.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import prompt from '@ohos.prompt'; +import promptAction from '@ohos.promptAction'; import { getTabData } from '../utils/DataUtils'; import { DELAY_TIME, ANIMATION_DURATION, Y_OFF_SET_COEFFICIENT } from '../constant/CommonConstant'; @@ -44,7 +44,7 @@ export function touchUpLoadMore() { self.currentPage = parseInt(value.currentPage.toString()); self.newsData = self.newsData.concat(value.newsPageData); }, - onFail: (msg) => prompt.showToast({ message: msg }) + onFail: (msg) => promptAction.showToast({ message: msg }) }); }, DELAY_TIME); } else { diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/entryability/EntryAbility.ts b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/entryability/EntryAbility.ts index f8ccb4129901cdfb9e5fedfec34adb48b831eacb..1a5f42fedf9363ca26dc303e9f25d2952fb509ad 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/entryability/EntryAbility.ts +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,10 +14,10 @@ */ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' -export default class EntryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets index 8987e4889b51d6b2d3d075d825d2a9c02dbcfd97..bdf6db79df6f14b06021fdddcd6efc3324eea71a 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets @@ -62,7 +62,7 @@ export default struct NewsItem { .objectFit(ImageFit.Cover) .borderRadius(NewsGrid.IMAGE_BORDER_RADIUS) } - }, itemImg => this.newsData.imagesUrl.indexOf(itemImg.id).toString()) + }, (itemImg, index) => JSON.stringify(itemImg) + index.toString()) } .aspectRatio(NewsGrid.ASPECT_RATIO) .columnsTemplate('1fr '.repeat(this.newsData.imagesUrl.length)) diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets index 46dc8b3d9fb809ca785404096a4c29e8ce0a068a..8332eaaf40330ab92ecf3b539708e200cddb903a 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets @@ -114,7 +114,7 @@ export default struct NewsList { .backgroundColor($r('app.color.white')) .margin({ top: NewsListConstant.ITEM_MARGIN_TOP, right: NewsListConstant.LIST_MARGIN_RIGHT }) .borderRadius(NewsListConstant.ITEM_BORDER_RADIUS) - }, item => item.id) + }, (item, index) => JSON.stringify(item) + index.toString()) ListItem() { LoadMoreLayout({ loadMoreLayoutClass: new CustomRefreshLoadLayoutClass(this.isVisiblePullUpLoad, this.pullUpLoadImage, diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets index 755efedce89d8496bf34c2cf467ad308c050e081..105a3b860b1a136bb2156df08c66bcf0f8537e12 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets @@ -29,11 +29,6 @@ export default struct RefreshLayout { CustomRefreshLoadLayout({ customRefreshLoadClass: new CustomRefreshLoadLayoutClass (this.refreshLayoutClass.isVisible, this.refreshLayoutClass.imageSrc, this.refreshLayoutClass.textValue, this.refreshLayoutClass.heightValue) }) - } else { - CustomRefreshLoadLayout({ - customRefreshLoadClass: new CustomRefreshLoadLayoutClass(this.refreshLayoutClass.isVisible, - this.refreshLayoutClass.imageSrc, this.refreshLayoutClass.textValue, 0) - }) } } } diff --git a/NetworkManagement/NewsDataArkTS/entry/src/main/module.json5 b/NetworkManagement/NewsDataArkTS/entry/src/main/module.json5 index 2fae781d571bdc4c042a3544758f47180ef61a96..20b75335411fa4b1718b5a8988f049547e6bd581 100644 --- a/NetworkManagement/NewsDataArkTS/entry/src/main/module.json5 +++ b/NetworkManagement/NewsDataArkTS/entry/src/main/module.json5 @@ -11,6 +11,10 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", diff --git a/NetworkManagement/NewsDataArkTS/package.json b/NetworkManagement/NewsDataArkTS/package.json index 1ee06bae49ff0280a56cf4770aa6335b3a3a382f..f3f95ab89cc3fc74033cf4000ae95599b796c3e9 100644 --- a/NetworkManagement/NewsDataArkTS/package.json +++ b/NetworkManagement/NewsDataArkTS/package.json @@ -12,7 +12,7 @@ "version":"1.0.0", "dependencies":{ "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1-rc27", - "@ohos/hvigor":"1.3.1-rc27" - } + "@ohos/hvigor": "1.4.0", + "@ohos/hvigor-ohos-plugin": "1.4.0" + } } \ No newline at end of file diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/entryability/EntryAbility.ts b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/entryability/EntryAbility.ts index d22225897c53cb18d58d1c5b4dfc3bccc11e0b54..e3ffc4d6a4711413ff40b6038fa89da483238fba 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/entryability/EntryAbility.ts @@ -1,23 +1,18 @@ import hilog from '@ohos.hilog'; -import Ability from '@ohos.application.Ability' -import Window from '@ohos.window' +import UIAbility from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window'; -export default class entryAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); } onDestroy() { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } onWindowStageCreate(windowStage: Window.WindowStage) { // Main window is created, set main page for this ability - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/MainPage', (err, data) => { @@ -33,19 +28,16 @@ export default class entryAbility extends Ability { onWindowStageDestroy() { // Main window is destroyed, release UI related resources - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground() { // Ability has brought to foreground - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground() { // Ability has back to background - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } } diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/pages/MainPage.ets b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/pages/MainPage.ets index fd9a1fdb3d6f2b143d7034e18d90ab24f4bd3692..80d75f451396918f36f0c490faff9d808c497f3d 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/pages/MainPage.ets +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/pages/MainPage.ets @@ -74,6 +74,7 @@ struct Index { } .title(this.NavigationTitle) .hideBackButton(true) + .titleMode(NavigationTitleMode.Mini) } .backgroundColor($r('app.color.app_bg')) } diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/view/InnerComponent.ets b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/view/InnerComponent.ets index 0694a82f58a2e10e672aef281a493f32e123bf39..c59df50c7d18bc4074d7cf5cf0881e6a3dd87197 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/view/InnerComponent.ets +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/ets/view/InnerComponent.ets @@ -55,8 +55,7 @@ export struct Inner { buttonShape: item.buttonShape, buttonType: item.buttonType, stateEffect: item.stateEffect, - fontColor: item.fontColor, - click: ()=> {} + fontColor: item.fontColor }) .alignSelf(ItemAlign.Center) .margin({ bottom: $r('app.float.default_21') }) diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/module.json5 b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/module.json5 index 0e288c05b41ef026b9f802f6c848bd5301ebc785..ac21237621133028a3175eb853fec0c4f15f837d 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/module.json5 +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/module.json5 @@ -2,7 +2,7 @@ "module": { "name": "entry", "type": "entry", - "description": "$string:module_desc", + "description": "$string:entry_desc", "mainElement": "EntryAbility", "deviceTypes": [ "default", @@ -11,15 +11,19 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], "abilities": [ { "name": "EntryAbility", "srcEntrance": "./ets/entryability/EntryAbility.ts", - "description": "$string:EntryAbility_desc", + "description": "$string:MainAbility_desc", "icon": "$media:icon", - "label": "$string:EntryAbility_label", + "label": "$string:MainAbility_label", "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", + "startWindowBackground": "$color:white", "visible": true, "skills": [ { diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/color.json b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/color.json index 6c2d3ffbc4779f561226ff5266d31561837fe6b7..cf1f2852dbff1255a7ee30abfc6e559f4f57c425 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/color.json +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/color.json @@ -1,9 +1,5 @@ { "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - }, { "name": "white", "value": "#FFFFFF" diff --git a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/string.json b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/string.json index 0a05d18bb7335514455c88537022202725d06308..a5b6c849c6e94aa055389a44b31ff3f279eb22f6 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/string.json +++ b/ThirdPartyComponents/ThirdPartyLibrary/entry/src/main/resources/base/element/string.json @@ -1,16 +1,12 @@ { "string": [ { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", + "name": "entry_desc", "value": "description" }, { - "name": "EntryAbility_label", - "value": "label" + "name": "MainAbility_desc", + "value": "description" }, { "name": "MainAbility_label", diff --git a/ThirdPartyComponents/ThirdPartyLibrary/library/package.json b/ThirdPartyComponents/ThirdPartyLibrary/library/package.json index a4710dd701a1cec3f35577eff274a4e718c82636..37320f6b7be08e16f22fe86a08cc445988fe226d 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/library/package.json +++ b/ThirdPartyComponents/ThirdPartyLibrary/library/package.json @@ -1,14 +1,14 @@ { - "license":"ISC", - "types":"", - "devDependencies":{}, - "name":"@ohos/library", - "description":"a npm package which contains arkUI2.0 page", - "ohos":{ - "org":"" + "license": "ISC", + "types": "", + "devDependencies": {}, + "name": "@ohos/library", + "description": "a npm package which contains arkUI2.0 page", + "ohos": { + "org": "" }, - "main":"MainPage.ets", - "type":"module", - "version":"1.0.0", - "dependencies":{} + "main": "src/main/ets/components/MainPage/MainPage.ets", + "type": "module", + "version": "1.0.0", + "dependencies": {} } \ No newline at end of file diff --git a/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/ets/components/mainpage/Buttons.ets b/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/ets/components/mainpage/Buttons.ets index 5241c70bfdaddb5db4ea4554748ed2a0e6823cf2..f04abd3922c8cac78232d8e957ac4548098a573e 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/ets/components/mainpage/Buttons.ets +++ b/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/ets/components/mainpage/Buttons.ets @@ -22,7 +22,6 @@ export struct Buttons { @Prop buttonShape: string; @Prop buttonType: string; @Prop fontColor: string; - click: () => void; build() { Row() { @@ -35,9 +34,6 @@ export struct Buttons { .width($r('app.float.default_90')) .height($r('app.float.default_35')) .backgroundColor(ButtonViewModel.fetchBackgroundColor(this.buttonType)) - .onClick(() => { - this.click(); - }) } } } diff --git a/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/resources/base/media/icon.png b/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ThirdPartyComponents/ThirdPartyLibrary/library/src/main/resources/base/media/icon.png differ diff --git a/ThirdPartyComponents/ThirdPartyLibrary/package.json b/ThirdPartyComponents/ThirdPartyLibrary/package.json index 59e3fc0b3112c03f6b25e8c869728c63ca1b7b69..ca0215dcd6748576ea505ce8e4dfbf467185fcfa 100644 --- a/ThirdPartyComponents/ThirdPartyLibrary/package.json +++ b/ThirdPartyComponents/ThirdPartyLibrary/package.json @@ -1,18 +1,18 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"thirdpartylibrary", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "@ohos/hvigor":"1.3.1" - } + "license": "ISC", + "devDependencies": {}, + "name": "thirdpartylibrary", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } \ No newline at end of file