From 88150eb95cb6fe7019074be78899659c1d0d49a8 Mon Sep 17 00:00:00 2001 From: ding_chengjie Date: Sun, 23 Apr 2023 20:59:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DDevEco=20Studio=203.1=20Beta1?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ding_chengjie --- AppScope/app.json5 | 4 +- AppScope/resources/base/element/string.json | 2 +- CHANGELOG.md | 4 ++ OAT.xml | 34 ++++++++++++-- README.md | 2 +- build-profile.json5 | 7 ++- entry/build-profile.json5 | 2 +- hvigorfile.js => entry/hvigorfile.ts | 2 +- entry/package.json | 30 ++++++------ .../src/main/ets/Application/AbilityStage.ts | 23 --------- .../EntryAbility.ts} | 31 +++++++----- .../main/ets/pages/index_adapter_animator.ets | 5 +- .../main/ets/pages/index_item_animator.ets | 9 ++-- entry/src/main/ets/pages/main.ets | 10 ++-- entry/src/main/module.json5 | 25 ++++++---- .../main/resources/base/element/color.json | 4 +- .../main/resources/base/element/string.json | 10 ++-- .../main/resources/en_US/element/string.json | 16 +++++++ .../main/resources/zh_CN/element/string.json | 16 +++++++ .../{TestAbility.ts => TestAbility.ets} | 41 +++++++++------- .../ohosTest/ets/TestAbility/pages/index.ets | 4 +- .../ets/TestRunner/OpenHarmonyTestRunner.ts | 43 +++++++---------- entry/src/ohosTest/ets/test/Ability.test.ets | 40 ++++++++++++---- entry/src/ohosTest/module.json5 | 7 +-- .../resources/base/element/color.json | 8 ++++ .../resources/base/element/string.json | 8 ++-- .../resources/base/profile/test_pages.json | 2 +- entry/hvigorfile.js => hvigorfile.ts | 2 +- package.json | 33 +++++++------ recyclerview_animators/build-profile.json5 | 7 ++- .../{hvigorfile.js => hvigorfile.ts} | 3 +- recyclerview_animators/package.json | 47 ++++++++++--------- .../src/main/ets/components/RecyclerView.ets | 14 +++++- .../AlphaInAnimationAdapter.ets | 12 +++-- .../ScaleInAnimationAdapter.ets | 16 ++++--- .../SlideInBottomAnimationAdapter.ets | 18 +++---- .../SlideInLeftAnimationAdapter.ets | 18 +++---- .../SlideInRightAnimationAdapter.ets | 18 +++---- .../itemAnimator/FadeInAnimator.ets | 2 +- .../itemAnimator/FadeInDownAnimator.ets | 2 +- .../itemAnimator/FadeInLeftAnimator.ets | 2 +- .../itemAnimator/FadeInRightAnimator.ets | 2 +- .../itemAnimator/FadeInUpAnimator.ets | 2 +- .../itemAnimator/LandingAnimator.ets | 2 +- .../itemAnimator/OvershootInLeftAnimator.ets | 2 +- .../itemAnimator/OvershootInRightAnimator.ets | 2 +- .../itemAnimator/ScaleInAnimator.ets | 2 +- .../itemAnimator/ScaleInBottomAnimator.ets | 2 +- .../itemAnimator/ScaleInLeftAnimator.ets | 2 +- .../itemAnimator/ScaleInRightAnimator.ets | 2 +- .../itemAnimator/ScaleInTopAnimator.ets | 2 +- .../itemAnimator/SlideInDownAnimator.ets | 2 +- .../itemAnimator/SlideInLeftAnimator.ets | 2 +- .../itemAnimator/SlideInRightAnimator.ets | 2 +- .../itemAnimator/SlideInUpAnimator.ets | 2 +- recyclerview_animators/src/main/module.json5 | 4 +- .../main/resources/en_US/element/string.json | 8 ++++ .../main/resources/zh_CN/element/string.json | 8 ++++ 58 files changed, 379 insertions(+), 252 deletions(-) rename hvigorfile.js => entry/hvigorfile.ts (63%) delete mode 100644 entry/src/main/ets/Application/AbilityStage.ts rename entry/src/main/ets/{MainAbility/MainAbility.ts => entryability/EntryAbility.ts} (47%) create mode 100644 entry/src/main/resources/en_US/element/string.json create mode 100644 entry/src/main/resources/zh_CN/element/string.json rename entry/src/ohosTest/ets/TestAbility/{TestAbility.ts => TestAbility.ets} (40%) create mode 100644 entry/src/ohosTest/resources/base/element/color.json rename entry/hvigorfile.js => hvigorfile.ts (63%) rename recyclerview_animators/{hvigorfile.js => hvigorfile.ts} (62%) create mode 100644 recyclerview_animators/src/main/resources/en_US/element/string.json create mode 100644 recyclerview_animators/src/main/resources/zh_CN/element/string.json diff --git a/AppScope/app.json5 b/AppScope/app.json5 index 31e70b7..ccaeee9 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -1,9 +1,9 @@ { "app": { - "bundleName": "jp.wasabeef.example.recyclerview", + "bundleName": "cn.openharmony.recyclerview", "vendor": "example", "versionCode": 1000000, - "versionName": "1.1.0", + "versionName": "1.0.0", "icon": "$media:app_icon", "label": "$string:app_name", "distributedNotificationEnabled": true diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json index 3adf43f..f35fd86 100644 --- a/AppScope/resources/base/element/string.json +++ b/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "recyclerview" + "value": "RecyclerviewAnimators" } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b20ce5..e39066d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.1.1 + +- 适配DevEco Studio 版本:3.1 Beta1(3.1.0.200),OpenHarmony SDK:API9(3.2.10.6) + ## v1.1.0 1. 名称由recyclerview-animators-ets修改recyclerview-animators。 diff --git a/OAT.xml b/OAT.xml index 29b566e..dcc3ae9 100644 --- a/OAT.xml +++ b/OAT.xml @@ -2,11 +2,37 @@ - - + + + + - - + + + + diff --git a/README.md b/README.md index c780f5e..3926c21 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ build() { 在下述版本验证通过: -DevEco Studio 版本:3.1 Beta1(3.1.0.200),SDK:API9 Beta5(3.2.10.6) +- DevEco Studio 版本:3.1 Beta1(3.1.0.200),OpenHarmony SDK:API9(3.2.10.6) ## 目录结构 ```` diff --git a/build-profile.json5 b/build-profile.json5 index bb53cf8..a2df217 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,15 +1,14 @@ { "app": { + "signingConfigs": [ + ], "compileSdkVersion": 9, "compatibleSdkVersion": 9, "products": [ { "name": "default", - "signingConfig": "default" + "signingConfig": "default", } - ], - "signingConfigs": [ - ] }, "modules": [ diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index 7dc37bb..f8f0340 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -4,7 +4,7 @@ }, "targets": [ { - "name": "default", + "name": "default" }, { "name": "ohosTest", diff --git a/hvigorfile.js b/entry/hvigorfile.ts similarity index 63% rename from hvigorfile.js rename to entry/hvigorfile.ts index 5f2735e..80e4ec5 100644 --- a/hvigorfile.js +++ b/entry/hvigorfile.ts @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').appTasks \ No newline at end of file +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/entry/package.json b/entry/package.json index 36bca6f..616cf20 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,16 +1,16 @@ { - "license":"Apache-2.0", - "devDependencies":{}, - "name":"entry", - "ohos":{ - "org":"huawei", - "directoryLevel":"module", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.1.0", - "dependencies":{ - "@ohos/recyclerview-animators":"file:../recyclerview_animators" - } -} \ No newline at end of file + "license": "Apache-2.0", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.1.1", + "dependencies": { + "@ohos/recyclerview-animators": "file:../recyclerview_animators" + } +} diff --git a/entry/src/main/ets/Application/AbilityStage.ts b/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 47de182..0000000 --- a/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import AbilityStage from "@ohos.application.AbilityStage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("[Demo] MyAbilityStage onCreate") - } -} \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/MainAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts similarity index 47% rename from entry/src/main/ets/MainAbility/MainAbility.ts rename to entry/src/main/ets/entryability/EntryAbility.ts index 606656a..06d557b 100644 --- a/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -14,37 +14,44 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { - console.log("[Demo] MainAbility onCreate") - globalThis.abilityWant = want; + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } onDestroy() { - console.log("[Demo] MainAbility onDestroy") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - onWindowStageCreate(windowStage) { + onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability - console.log("[Demo] MainAbility onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/main", null) + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/main', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); } onWindowStageDestroy() { // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility onWindowStageDestroy") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground() { // Ability has brought to foreground - console.log("[Demo] MainAbility onForeground") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground() { // Ability has back to background - console.log("[Demo] MainAbility onBackground") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } } diff --git a/entry/src/main/ets/pages/index_adapter_animator.ets b/entry/src/main/ets/pages/index_adapter_animator.ets index e66d21d..00ace17 100644 --- a/entry/src/main/ets/pages/index_adapter_animator.ets +++ b/entry/src/main/ets/pages/index_adapter_animator.ets @@ -57,11 +57,12 @@ struct Index_adapter_animator { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { Select(this.animTypes) .selected(this.selectIndex) + .value(this.animTypes[this.selectIndex].value) .font({ size: 18, weight: 400, family: 'serif', style: FontStyle.Normal }) .selectedOptionFont({ size: 18, weight: 500, family: 'serif', style: FontStyle.Normal }) .optionFont({ size: 18, weight: 400, family: 'serif', style: FontStyle.Normal }) - // @ts-ignore - .onSelected((index: number) => { + .backgroundColor('#3dc49d') + .onSelect((index: number) => { this.selectIndex = index this.controller.setAdapterAnimation(this.animTypes[index].enumType) }) diff --git a/entry/src/main/ets/pages/index_item_animator.ets b/entry/src/main/ets/pages/index_item_animator.ets index 676c261..da34299 100644 --- a/entry/src/main/ets/pages/index_item_animator.ets +++ b/entry/src/main/ets/pages/index_item_animator.ets @@ -15,7 +15,7 @@ */ import { RecyclerView } from "@ohos/recyclerview-animators" -import router from '@system.router'; +import router from '@ohos.router'; @Entry @Component @@ -59,7 +59,7 @@ struct Index_item_animator { RecyclerView({ array: this.listDatas, controller: this.controller, - columnsNum: router.getParams().isOn == true ? 2 : 1, + columnsNum: router.getParams()['isOn'] == true ? 2 : 1, // @ts-ignore child: (itemData) => { this.SpecificChild(itemData) @@ -71,11 +71,12 @@ struct Index_item_animator { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { Select(this.animTypes) .selected(this.selectIndex) + .value(this.animTypes[this.selectIndex].value) .font({ size: 18, weight: 400, family: 'serif', style: FontStyle.Normal }) .selectedOptionFont({ size: 18, weight: 500, family: 'serif', style: FontStyle.Normal }) .optionFont({ size: 18, weight: 400, family: 'serif', style: FontStyle.Normal }) - // @ts-ignore - .onSelected((index: number) => { + .backgroundColor('#3dc49d') + .onSelect((index: number) => { this.selectIndex = index this.controller.setItemAnimation(this.animTypes[index].enumType) }) diff --git a/entry/src/main/ets/pages/main.ets b/entry/src/main/ets/pages/main.ets index 7baeb3e..6a13a0b 100644 --- a/entry/src/main/ets/pages/main.ets +++ b/entry/src/main/ets/pages/main.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import router from '@system.router'; +import router from '@ohos.router'; @Entry @Component @@ -28,8 +28,8 @@ struct Index { .backgroundColor('#d6d7d7') .fontColor('black') .onClick(e => { - router.push({ - uri: 'pages/index_item_animator', + router.pushUrl({ + url: 'pages/index_item_animator', params: { isOn: this.isOn } }) }) @@ -53,8 +53,8 @@ struct Index { .fontColor('black') .margin({left: 30}) .onClick(e => { - router.push({ - uri: 'pages/index_adapter_animator' + router.pushUrl({ + url: 'pages/index_adapter_animator' }) }) } diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 35faec6..f635347 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -2,9 +2,8 @@ "module": { "name": "entry", "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:entry_desc", - "mainElement": "MainAbility", + "description": "$string:module_desc", + "mainElement": "EntryAbility", "deviceTypes": [ "default", "tablet" @@ -12,13 +11,21 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "metadata": [ + { + "name": "ArkTSPartialUpdate", + "value": "true" + } + ], "abilities": [ { - "name": "MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:MainAbility_desc", + "name": "EntryAbility", + "srcEntrance": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", "icon": "$media:icon", - "label": "$string:MainAbility_label", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", "visible": true, "skills": [ { @@ -29,9 +36,7 @@ "action.system.home" ] } - ], - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:background_color" + ] } ] } diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 3fc805d..3c71296 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -1,8 +1,8 @@ { "color": [ { - "name": "background_color", - "value": "#ffffff" + "name": "start_window_background", + "value": "#FFFFFF" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 490210a..4a6cdae 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -1,16 +1,16 @@ { "string": [ { - "name": "entry_desc", - "value": "description" + "name": "module_desc", + "value": "module description" }, { - "name": "MainAbility_desc", + "name": "EntryAbility_desc", "value": "description" }, { - "name": "MainAbility_label", - "value": "label" + "name": "EntryAbility_label", + "value": "RecyclerviewAnimators" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..4a6cdae --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "RecyclerviewAnimators" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..776829d --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "RecyclerviewAnimators" + } + ] +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/TestAbility.ts b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets similarity index 40% rename from entry/src/ohosTest/ets/TestAbility/TestAbility.ts rename to entry/src/ohosTest/ets/TestAbility/TestAbility.ets index f7a2dd9..d79f7ec 100644 --- a/entry/src/ohosTest/ets/TestAbility/TestAbility.ts +++ b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets @@ -14,42 +14,51 @@ * limitations under the License. */ -import Ability from '@ohos.application.Ability' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; -export default class TestAbility extends Ability { +export default class TestAbility extends UIAbility { onCreate(want, launchParam) { - console.log('TestAbility onCreate') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); var abilityDelegator: any abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() var abilityDelegatorArguments: any abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { - console.log('TestAbility onDestroy') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); } - onWindowStageCreate(windowStage) { - console.log('TestAbility onWindowStageCreate') - windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) - - globalThis.abilityContext = this.context; + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); } onWindowStageDestroy() { - console.log('TestAbility onWindowStageDestroy') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); } onForeground() { - console.log('TestAbility onForeground') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); } onBackground() { - console.log('TestAbility onBackground') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); } } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/entry/src/ohosTest/ets/TestAbility/pages/index.ets index 58e8126..b2b95b9 100644 --- a/entry/src/ohosTest/ets/TestAbility/pages/index.ets +++ b/entry/src/ohosTest/ets/TestAbility/pages/index.ets @@ -14,13 +14,13 @@ * limitations under the License. */ -import router from '@ohos.router'; +import hilog from '@ohos.hilog'; @Entry @Component struct Index { aboutToAppear() { - console.info('TestAbility index aboutToAppear') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); } @State message: string = 'Hello World' build() { diff --git a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts index 97d7e3b..c189137 100644 --- a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -14,32 +14,19 @@ * limitations under the License. */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; var abilityDelegator = undefined var abilityDelegatorArguments = undefined -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s it', - '-s level', '-s testType', '-s size', '-s timeout' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams = `${targetParams} ${key} ${parameters[key]}` - } - } - return targetParams.trim() -} - async function onAbilityCreateCallback() { - console.log("onAbilityCreateCallback"); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); } async function addAbilityMonitorCallback(err: any) { - console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); } export default class OpenHarmonyTestRunner implements TestRunner { @@ -47,11 +34,11 @@ export default class OpenHarmonyTestRunner implements TestRunner { } onPrepare() { - console.info("OpenHarmonyTestRunner OnPrepare ") + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); } async onRun() { - console.log('OpenHarmonyTestRunner onRun run') + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' @@ -61,14 +48,18 @@ export default class OpenHarmonyTestRunner implements TestRunner { }; abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); }) - console.info('OpenHarmonyTestRunner onRun end') + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); } } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index b56e663..5c22875 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -14,16 +14,38 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function abilityTest() { - describe('ActsAbilityTest', function () { - it('assertContain',0, function () { - console.info("it begin") - let a = 'abc' - let b = 'b' - expect(a).assertContain(b) - expect(a).assertEqual(a) - }) + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) } \ No newline at end of file diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 index d4d6e20..476d153 100644 --- a/entry/src/ohosTest/module.json5 +++ b/entry/src/ohosTest/module.json5 @@ -2,8 +2,7 @@ "module": { "name": "entry_test", "type": "feature", - "srcEntrance": "./ets/TestAbility/TestAbility.ts", - "description": "$string:entry_test_desc", + "description": "$string:module_test_desc", "mainElement": "TestAbility", "deviceTypes": [ "default", @@ -15,11 +14,13 @@ "abilities": [ { "name": "TestAbility", - "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "srcEntrance": "./ets/testability/TestAbility.ets", "description": "$string:TestAbility_desc", "icon": "$media:icon", "label": "$string:TestAbility_label", "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", "skills": [ { "actions": [ diff --git a/entry/src/ohosTest/resources/base/element/color.json b/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000..3c71296 --- /dev/null +++ b/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json index 8407800..65d8fa5 100644 --- a/entry/src/ohosTest/resources/base/element/string.json +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -1,16 +1,16 @@ { "string": [ { - "name": "entry_test_desc", - "value": "i am an entry for tv" + "name": "module_test_desc", + "value": "test ability description" }, { "name": "TestAbility_desc", - "value": "the tv entry test ability" + "value": "the test ability" }, { "name": "TestAbility_label", - "value": "tvBase" + "value": "test label" } ] } \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json index fcef82b..b7e7343 100644 --- a/entry/src/ohosTest/resources/base/profile/test_pages.json +++ b/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -1,5 +1,5 @@ { "src": [ - "TestAbility/pages/index" + "testability/pages/Index" ] } diff --git a/entry/hvigorfile.js b/hvigorfile.ts similarity index 63% rename from entry/hvigorfile.js rename to hvigorfile.ts index d7720ee..6478186 100644 --- a/entry/hvigorfile.js +++ b/hvigorfile.ts @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/package.json b/package.json index 537cde7..69058f8 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,18 @@ { - "license": "Apache-2.0", - "devDependencies": {}, - "name": "recyclerview_animators", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.1.0", - "dependencies": { - "@ohos/hypium": "1.0.1", - "@ohos/hvigor-ohos-plugin": "1.1.6", - "hypium": "^1.0.0", - "@ohos/hvigor": "1.1.6" - } + "license": "Apache-2.0", + "devDependencies": {}, + "name": "recyclerview_animators", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.1.1", + "dependencies": { + "@ohos/hypium": "1.0.5", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/recyclerview_animators/build-profile.json5 b/recyclerview_animators/build-profile.json5 index 35dff6d..79961f9 100644 --- a/recyclerview_animators/build-profile.json5 +++ b/recyclerview_animators/build-profile.json5 @@ -1,5 +1,10 @@ { "apiType": "stageMode", "buildOption": { - } + }, + "targets": [ + { + "name": "default" + } + ] } diff --git a/recyclerview_animators/hvigorfile.js b/recyclerview_animators/hvigorfile.ts similarity index 62% rename from recyclerview_animators/hvigorfile.js rename to recyclerview_animators/hvigorfile.ts index 42ed4b4..47e6e1f 100644 --- a/recyclerview_animators/hvigorfile.js +++ b/recyclerview_animators/hvigorfile.ts @@ -1,3 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').harTasks - +export { harTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/recyclerview_animators/package.json b/recyclerview_animators/package.json index 4b9f44d..a55fd28 100644 --- a/recyclerview_animators/package.json +++ b/recyclerview_animators/package.json @@ -1,23 +1,26 @@ { - "types":"", - "keywords":[ - "UI", - "Animation" - ], - "author":"hihope", - "description":"RecyclerView Animators is an Ohos library that allows developers to easily create RecyclerView with animations.", - "ohos":{ - "org":"opensource" - }, - "main":"index.ets", - "repository":"https://gitee.com/openharmony-sig/recyclerview-animators", - "version":"1.1.0", - "tags":[ - "UI", - "Animation" - ], - "dependencies":{}, - "license":"Apache-2.0", - "devDependencies":{}, - "name":"@ohos/recyclerview-animators" -} \ No newline at end of file + "types": "", + "keywords": [ + "UI", + "Animation", + "HarmonyOS" + ], + "author": "hihope", + "description": "RecyclerView Animators is an Ohos library that allows developers to easily create RecyclerView with animations.", + "ohos": { + "org": "opensource" + }, + "main": "index.ets", + "type": "module", + "repository": "https://gitee.com/openharmony-sig/recyclerview-animators", + "version": "1.1.1", + "tags": [ + "UI", + "Animation", + "HarmonyOS" + ], + "dependencies": {}, + "license": "Apache-2.0", + "devDependencies": {}, + "name": "@ohos/recyclerview-animators" +} diff --git a/recyclerview_animators/src/main/ets/components/RecyclerView.ets b/recyclerview_animators/src/main/ets/components/RecyclerView.ets index f22424f..64fe22a 100644 --- a/recyclerview_animators/src/main/ets/components/RecyclerView.ets +++ b/recyclerview_animators/src/main/ets/components/RecyclerView.ets @@ -41,7 +41,7 @@ import {SlideInBottomAnimationAdapter} from './adapterAnimator/SlideInBottomAnim struct RecyclerView { array: Array = [] @BuilderParam child: (itemData) => {}; - controller: RecyclerView.Controller = new RecyclerView.Controller() + @State controller: RecyclerView.Controller = new RecyclerView.Controller() columnsNum: number = 1 build() { @@ -307,6 +307,8 @@ namespace RecyclerView { itemAnimation = RecyclerView.ItemAnimationType.FadeIn adapterAnimation = null isFirstOnly: boolean = false + mWidth: number = 480 + mHeight: number = 855 public addValue(index: number, value: any) { this.addValueCallback(index, value) @@ -331,6 +333,16 @@ namespace RecyclerView { public setFirstOnly(isFirstOnly: boolean) { this.isFirstOnly = isFirstOnly } + + public setWidth(width: number) { + this.mWidth = width + return this + } + + public setHeight(height: number) { + this.mHeight = height + return this + } } } diff --git a/recyclerview_animators/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets b/recyclerview_animators/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets index 40fe0e1..4f78f25 100644 --- a/recyclerview_animators/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets +++ b/recyclerview_animators/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets @@ -22,6 +22,7 @@ export struct AlphaInAnimationAdapter { @BuilderParam child: (itemData) => {}; @State controller: RecyclerView.Controller = new RecyclerView.Controller() @State private list: Array = [] + @State private animateList: Array = [] @State private start: number = 0 @State private end: number = 0 @@ -32,6 +33,7 @@ export struct AlphaInAnimationAdapter { value: item } this.list.push(temp) + this.animateList.push(temp) }) } @@ -42,7 +44,7 @@ export struct AlphaInAnimationAdapter { this.child(item.value) } .width('100%') - .opacity(item.alpha) + .opacity(this.animateList[index].alpha) .animation({ duration: this.controller.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 @@ -50,26 +52,26 @@ export struct AlphaInAnimationAdapter { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .width('100%') .onScrollIndex((start, end) => { this.start = start this.end = end - this.list.forEach((item, index) => { + this.animateList.forEach((item, index) => { if (index >= start && index <= end) { let temp = { alpha: 1, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } else { if (this.controller.isFirstOnly) { let temp = { alpha: 0, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } } }) diff --git a/recyclerview_animators/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets b/recyclerview_animators/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets index 4703abd..c365eb0 100644 --- a/recyclerview_animators/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets +++ b/recyclerview_animators/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets @@ -22,6 +22,7 @@ export struct ScaleInAnimationAdapter { @BuilderParam child: (itemData) => {}; @State controller: RecyclerView.Controller = new RecyclerView.Controller() @State private list: Array = [] + @State private animateList: Array = [] @State private start: number = 0 @State private end: number = 0 @@ -32,6 +33,7 @@ export struct ScaleInAnimationAdapter { value: item } this.list.push(temp) + this.animateList.push(temp) }) } @@ -44,9 +46,9 @@ export struct ScaleInAnimationAdapter { .width('100%') .scale( { - x: item.landing, - y: item.landing, - z: item.landing + x: this.animateList[index].landing, + y: this.animateList[index].landing, + z: this.animateList[index].landing } ) .animation({ @@ -56,26 +58,26 @@ export struct ScaleInAnimationAdapter { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .width('100%') .onScrollIndex((start, end) => { this.start = start this.end = end - this.list.forEach((item, index) => { + this.animateList.forEach((item, index) => { if (index >= start && index <= end) { let temp = { landing: 1, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } else { if (this.controller.isFirstOnly) { let temp = { landing: 0, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } } }) diff --git a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets index 8797b3b..5d734a1 100644 --- a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets +++ b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets @@ -22,16 +22,18 @@ export struct SlideInBottomAnimationAdapter { @BuilderParam child: (itemData) => { }; @State controller: RecyclerView.Controller = new RecyclerView.Controller() @State private list: Array = [] + @State private animateList: Array = [] @State private start: number = 0 @State private end: number = 0 aboutToAppear() { this.array.forEach(item => { let temp = { - y: '100%', + y: this.controller.mHeight, value: item } this.list.push(temp) + this.animateList.push(temp) }) } @@ -43,7 +45,7 @@ export struct SlideInBottomAnimationAdapter { } .width('100%') .translate({ - y: item.y + y: this.animateList[index].y }) .animation({ duration: this.controller.duration, // 动画时长 @@ -52,26 +54,26 @@ export struct SlideInBottomAnimationAdapter { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .width('100%') .onScrollIndex((start, end) => { this.start = start this.end = end - this.list.forEach((item, index) => { + this.animateList.forEach((item, index) => { if (index >= start && index <= end) { let temp = { - y: '0%', + y: 0, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } else { if (this.controller.isFirstOnly) { let temp = { - y: '100%', + y: this.controller.mHeight, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } } }) diff --git a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets index 9be62e4..30ab611 100644 --- a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets +++ b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets @@ -22,16 +22,18 @@ export struct SlideInLeftAnimationAdapter { @BuilderParam child: (itemData) => { }; @State controller: RecyclerView.Controller = new RecyclerView.Controller() @State private list: Array = [] + @State private animateList: Array = [] @State private start: number = 0 @State private end: number = 0 aboutToAppear() { this.array.forEach(item => { let temp = { - x: '-100%', + x: -this.controller.mWidth, value: item } this.list.push(temp) + this.animateList.push(temp) }) } @@ -43,7 +45,7 @@ export struct SlideInLeftAnimationAdapter { } .width('100%') .translate({ - x: item.x + x: this.animateList[index].x }) .animation({ duration: this.controller.duration, // 动画时长 @@ -52,26 +54,26 @@ export struct SlideInLeftAnimationAdapter { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .width('100%') .onScrollIndex((start, end) => { this.start = start this.end = end - this.list.forEach((item, index) => { + this.animateList.forEach((item, index) => { if (index >= start && index <= end) { let temp = { - x: '0%', + x: 0, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } else { if (this.controller.isFirstOnly) { let temp = { - x: '-100%', + x: -this.controller.mWidth, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } } }) diff --git a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets index eeeb208..6adf375 100644 --- a/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets +++ b/recyclerview_animators/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets @@ -22,16 +22,18 @@ export struct SlideInRightAnimationAdapter { @BuilderParam child: (itemData) => { }; @State controller: RecyclerView.Controller = new RecyclerView.Controller() @State private list: Array = [] + @State private animateList: Array = [] @State private start: number = 0 @State private end: number = 0 aboutToAppear() { this.array.forEach(item => { let temp = { - x: '100%', + x: this.controller.mWidth, value: item } this.list.push(temp) + this.animateList.push(temp) }) } @@ -43,7 +45,7 @@ export struct SlideInRightAnimationAdapter { } .width('100%') .translate({ - x: item.x + x: this.animateList[index].x }) .animation({ duration: this.controller.duration, // 动画时长 @@ -52,26 +54,26 @@ export struct SlideInRightAnimationAdapter { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .width('100%') .onScrollIndex((start, end) => { this.start = start this.end = end - this.list.forEach((item, index) => { + this.animateList.forEach((item, index) => { if (index >= start && index <= end) { let temp = { - x: '0%', + x: 0, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } else { if (this.controller.isFirstOnly) { let temp = { - x: '100%', + x: this.controller.mWidth, value: item.value } - this.list.splice(index, 1, temp) + this.animateList.splice(index, 1, temp) } } }) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInAnimator.ets index 7796c9f..269d96a 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInAnimator.ets @@ -108,7 +108,7 @@ export struct FadeInAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets index 5d74d63..e5234d9 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets @@ -113,7 +113,7 @@ export struct FadeInDownAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets index b051613..4328721 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets @@ -113,7 +113,7 @@ export struct FadeInLeftAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets index 12f6221..db4fde6 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets @@ -113,7 +113,7 @@ export struct FadeInRightAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets index b800b0f..c8bde95 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets @@ -113,7 +113,7 @@ export struct FadeInUpAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/LandingAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/LandingAnimator.ets index 6f2f8cb..e4cbf94 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/LandingAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/LandingAnimator.ets @@ -126,7 +126,7 @@ export struct LandingAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets index 13a26bd..a2bae54 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets @@ -129,7 +129,7 @@ export struct OvershootInLeftAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets index bb48bf9..0a1a698 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets @@ -130,7 +130,7 @@ export struct OvershootInRightAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInAnimator.ets index 0f9696b..2c00457 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInAnimator.ets @@ -126,7 +126,7 @@ export struct ScaleInAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets index 67088e0..10b8352 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets @@ -128,7 +128,7 @@ export struct ScaleInBottomAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets index 54c4285..14af456 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets @@ -128,7 +128,7 @@ export struct ScaleInLeftAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets index cff9d0b..3f32128 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets @@ -128,7 +128,7 @@ export struct ScaleInRightAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets index 91f3bba..023b07d 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets @@ -128,7 +128,7 @@ export struct ScaleInTopAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets index 0adb319..f37a605 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets @@ -128,7 +128,7 @@ export struct SlideInDownAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets index d83ed0d..31aa876 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets @@ -124,7 +124,7 @@ export struct SlideInLeftAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets index f63a98c..6c44e0e 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets @@ -124,7 +124,7 @@ export struct SlideInRightAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets index 665aa76..074eab8 100644 --- a/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets +++ b/recyclerview_animators/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets @@ -128,7 +128,7 @@ export struct SlideInUpAnimator { iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }) - }, item => item.toString()) + }) } .columnsTemplate(this.colNumStr) .columnsGap(2) diff --git a/recyclerview_animators/src/main/module.json5 b/recyclerview_animators/src/main/module.json5 index b5092a7..9cae898 100644 --- a/recyclerview_animators/src/main/module.json5 +++ b/recyclerview_animators/src/main/module.json5 @@ -5,6 +5,6 @@ "deviceTypes": [ "default", "tablet" - ], + ] } -} \ No newline at end of file +} diff --git a/recyclerview_animators/src/main/resources/en_US/element/string.json b/recyclerview_animators/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..1e76de0 --- /dev/null +++ b/recyclerview_animators/src/main/resources/en_US/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/recyclerview_animators/src/main/resources/zh_CN/element/string.json b/recyclerview_animators/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..1e76de0 --- /dev/null +++ b/recyclerview_animators/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} -- Gitee