diff --git a/CHANGELOG.md b/CHANGELOG.md index 843383b..a9b74c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ - svg解码单位改为px - 修复预加载接口preLoadCache传ImageKnifeOption失效 - 文件缓存初始化接口新增目录参数 +- 占位图从内存获取提前到判断队列前面 +- 图片改为不可拖拽 +- 修复getCacheImage默认内存获取后不返回数据 +- 成功回调返回GIF图宽高 ## 3.0.0-rc.7 - 修复成功回调获取不到宽高 diff --git a/entry/src/main/ets/pages/ImageTransformation.ets b/entry/src/main/ets/pages/ImageTransformation.ets index 526ca46..844ed62 100644 --- a/entry/src/main/ets/pages/ImageTransformation.ets +++ b/entry/src/main/ets/pages/ImageTransformation.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { BlurTransformation, BrightnessTransformation, diff --git a/entry/src/main/ets/pages/ObjectFitPage.ets b/entry/src/main/ets/pages/ObjectFitPage.ets index 02f7f8c..c86415f 100644 --- a/entry/src/main/ets/pages/ObjectFitPage.ets +++ b/entry/src/main/ets/pages/ObjectFitPage.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { ImageKnife, ImageKnifeComponent, ImageKnifeOption } from '@ohos/libraryimageknife' @Entry diff --git a/entry/src/main/ets/pages/User.ets b/entry/src/main/ets/pages/User.ets index 02e5cc0..1e3e582 100644 --- a/entry/src/main/ets/pages/User.ets +++ b/entry/src/main/ets/pages/User.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { ImageKnifeComponent, ImageKnifeOption } from '@ohos/libraryimageknife' // const logger = new imUtils.logger.IMLogger('Avatar') diff --git a/entry/src/main/ets/pages/UserPage.ets b/entry/src/main/ets/pages/UserPage.ets index b2bedeb..ee210bc 100644 --- a/entry/src/main/ets/pages/UserPage.ets +++ b/entry/src/main/ets/pages/UserPage.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { UserAvatar } from './User' class CommonDataSource implements IDataSource { diff --git a/library/BuildProfile.ets b/library/BuildProfile.ets index 56a40f4..774bfdf 100644 --- a/library/BuildProfile.ets +++ b/library/BuildProfile.ets @@ -1,4 +1,18 @@ -export default class BuildProfile { +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default class BuildProfile { static readonly HAR_VERSION = '3.0.0-rc.0'; static readonly BUILD_MODE_NAME = 'debug'; static readonly DEBUG = true; diff --git a/library/index.ets b/library/index.ets index 1b690d5..671d8a0 100644 --- a/library/index.ets +++ b/library/index.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export { ImageKnifeComponent } from './src/main/ets/components/ImageKnifeComponent' export { ImageKnife } from './src/main/ets/ImageKnife' diff --git a/library/src/main/ets/ImageKnife.ets b/library/src/main/ets/ImageKnife.ets index e58fadd..10329c4 100644 --- a/library/src/main/ets/ImageKnife.ets +++ b/library/src/main/ets/ImageKnife.ets @@ -227,7 +227,7 @@ export class ImageKnife { this.readFileCache(loadSrc, engineKeyImpl, resolve) } else { let data = this.readMemoryCache(loadSrc, option, engineKeyImpl) - data == undefined ? this.readFileCache(loadSrc, engineKeyImpl, resolve) : data + data == undefined ? this.readFileCache(loadSrc, engineKeyImpl, resolve) : resolve(data) } }) } diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index 03d7a70..14dc829 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -103,8 +103,13 @@ export class ImageKnifeDispatcher { if (this.showFromMemomry(request, request.imageKnifeOption.loadSrc, ImageKnifeRequestSource.SRC)) { return } - - //2.判断是否要排队 + // 2.内存获取占位图 + if (request.imageKnifeOption.placeholderSrc !== undefined) { + if (this.showFromMemomry(request, request.imageKnifeOption.placeholderSrc, ImageKnifeRequestSource.PLACE_HOLDER)) { + request.drawPlayHolderSuccess = true + } + } + //3.判断是否要排队 if (this.executingJobMap.length > this.maxRequests) { this.jobQueue.add(request) return @@ -115,10 +120,8 @@ export class ImageKnifeDispatcher { executeJob(request: ImageKnifeRequest): void { LogUtil.log("ImageKnife_DataTime_executeJob.start:" + request.imageKnifeOption.loadSrc) // 加载占位符 - if (request.imageKnifeOption.placeholderSrc !== undefined) { - if (this.showFromMemomry(request, request.imageKnifeOption.placeholderSrc, ImageKnifeRequestSource.PLACE_HOLDER) === false) { - this.getAndShowImage(request, request.imageKnifeOption.placeholderSrc, ImageKnifeRequestSource.PLACE_HOLDER) - } + if (request.imageKnifeOption.placeholderSrc !== undefined && request.drawPlayHolderSuccess == false) { + this.getAndShowImage(request, request.imageKnifeOption.placeholderSrc, ImageKnifeRequestSource.PLACE_HOLDER) } // 加载主图 @@ -532,6 +535,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List { this.currentWidth = newValue.width as number this.currentHeight = newValue.height as number diff --git a/library/src/test/List.test.ets b/library/src/test/List.test.ets index bb5b5c3..f43d80b 100644 --- a/library/src/test/List.test.ets +++ b/library/src/test/List.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 localUnitTest from './LocalUnit.test'; export default function testsuite() { diff --git a/library/src/test/LocalUnit.test.ets b/library/src/test/LocalUnit.test.ets index ed22d4d..dacc818 100644 --- a/library/src/test/LocalUnit.test.ets +++ b/library/src/test/LocalUnit.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; export default function localUnitTest() { diff --git a/sharedlibrary/Index.ets b/sharedlibrary/Index.ets index 468219f..84f5bb0 100644 --- a/sharedlibrary/Index.ets +++ b/sharedlibrary/Index.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export { add } from './src/main/ets/utils/Calc' export { InitImageKnife } from "./src/main/ets/pages/InitImageKnife" diff --git a/sharedlibrary/src/main/ets/utils/Calc.ets b/sharedlibrary/src/main/ets/utils/Calc.ets index e6b7cf2..b2ed92e 100644 --- a/sharedlibrary/src/main/ets/utils/Calc.ets +++ b/sharedlibrary/src/main/ets/utils/Calc.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export function add(a:number, b:number) { return a + b; } \ No newline at end of file diff --git a/sharedlibrary/src/ohosTest/ets/test/Ability.test.ets b/sharedlibrary/src/ohosTest/ets/test/Ability.test.ets index 85c78f6..3417975 100644 --- a/sharedlibrary/src/ohosTest/ets/test/Ability.test.ets +++ b/sharedlibrary/src/ohosTest/ets/test/Ability.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { hilog } from '@kit.PerformanceAnalysisKit'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; diff --git a/sharedlibrary/src/ohosTest/ets/test/List.test.ets b/sharedlibrary/src/ohosTest/ets/test/List.test.ets index 794c7dc..b80e94c 100644 --- a/sharedlibrary/src/ohosTest/ets/test/List.test.ets +++ b/sharedlibrary/src/ohosTest/ets/test/List.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 abilityTest from './Ability.test'; export default function testsuite() { diff --git a/sharedlibrary/src/ohosTest/ets/testability/TestAbility.ets b/sharedlibrary/src/ohosTest/ets/testability/TestAbility.ets index 3e04349..64fb765 100644 --- a/sharedlibrary/src/ohosTest/ets/testability/TestAbility.ets +++ b/sharedlibrary/src/ohosTest/ets/testability/TestAbility.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { abilityDelegatorRegistry } from '@kit.TestKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; diff --git a/sharedlibrary/src/ohosTest/ets/testability/pages/Index.ets b/sharedlibrary/src/ohosTest/ets/testability/pages/Index.ets index 423b427..98be4ce 100644 --- a/sharedlibrary/src/ohosTest/ets/testability/pages/Index.ets +++ b/sharedlibrary/src/ohosTest/ets/testability/pages/Index.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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. + */ @Entry @Component struct Index { diff --git a/sharedlibrary/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets b/sharedlibrary/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets index 713592f..a5c1586 100644 --- a/sharedlibrary/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +++ b/sharedlibrary/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit'; import { UIAbility, Want } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; diff --git a/sharedlibrary/src/test/List.test.ets b/sharedlibrary/src/test/List.test.ets index bb5b5c3..f43d80b 100644 --- a/sharedlibrary/src/test/List.test.ets +++ b/sharedlibrary/src/test/List.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 localUnitTest from './LocalUnit.test'; export default function testsuite() { diff --git a/sharedlibrary/src/test/LocalUnit.test.ets b/sharedlibrary/src/test/LocalUnit.test.ets index 165fc16..9ec8a77 100644 --- a/sharedlibrary/src/test/LocalUnit.test.ets +++ b/sharedlibrary/src/test/LocalUnit.test.ets @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2024 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; export default function localUnitTest() {